Skip navigation

Tracking Log File Growth on SQL Server 2000

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
GO

SELECT Operation,
   Context,
   \[Log Size\] = SUM(\[Log Record Length\])
FROM ::fn_dblog(null, null)
GROUP BY Operation, Context
GO


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.

Cheers,

-Kevin

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish