THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Tamarick Hill

July, the 31 Days of SQL Server DMO’s – Day 26 (sys.dm_db_log_space_usage)

The sys.dm_db_log_space_usage DMV is a new DMV for SQL Server 2012. It returns Total Size, Used Size, and Used Percent size for a transaction log file of a given database. To illustrate this DMV, I will query the DMV against my AdventureWorks2012 database.

SELECT * FROM sys.dm_db_log_space_usage


As mentioned above, the result set gives us the total size of the transaction log in bytes, the used size of the log in bytes, and the percent of the log that has been used.

This is a very simplistic DMV but returns valuable information. Being able to detect when a transaction log is close to being full is always a valuable thing to alert on, and this DMV just provided an additional method for acquiring the necessary information.

Follow me on Twitter @PrimeTimeDBA

Published Friday, July 26, 2013 10:17 AM by Tamarick Hill



Sean McCown said:

Yeah it seems like they're heading backwards sometimes on the admin side.  with sqlperf we could see all the logs on the server to see which one may have grown too much, but with this we have to actually write a cursor or cycle through them by hand.  No thanks.

September 19, 2013 9:20 AM
New Comments to this post are disabled
Privacy Statement