July, the 31 Days of SQL Server DMO’s – Day 26 (sys.dm_db_log_space_usage)
Posted
by Tamarick Hill
on SQL Blog
See other posts from SQL Blog
or by Tamarick Hill
Published on Fri, 26 Jul 2013 14:17:00 GMT
Indexed on
2013/08/02
15:54 UTC
Read the original article
Hit count: 460
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
© SQL Blog or respective owner