Gert Drapers, whom I consider to be a super-genius of the SQL Server world and owner of the very useful website http://www.sqldev.net/, wrote a useful little script a few years ago that I thought I'd share. This is a SQL query that will show who and what is causing the log of a database, in this case tempdb, to grow:
USE tempdb<br>GO<p>SELECT Operation,<br> Context,<br> \[Log Size\] = SUM(\[Log Record Length\])<br>FROM ::fn_dblog(null, null)<br>GROUP BY Operation, Context<br>GO</p>
This dumps the active part of the log in tempdb and provides an aggregate per operation and the context it occured in. The \[Object Name\] and \[Index Name\] columns provide info on which object, \[Server UID\], \[UID\] and \[SPID\] can provide user context when applicable.