The SQL Server log and its maintenance, is a one of the important tasks for a Database Administrator. There are many optimized ways to configured SQL Server log, but then also we have to monitor the size of SQL Server logs.
Previously we have different method to find size of SQL Server Database Log like, DBCC commands, but now SQL Server 2012 introduced new dynamic management view name is dm_db_log_space_usage and using this dm-view we can easily calculate the size of the SQL Server Database log.
Below is a script to find the size of the SQL Server Database log.
DB_NAME(database_id) AS DatabaseName
,ROUND(CONVERT(FLOAT,total_log_size_in_bytes/1024)/1024,2) AS LogSizeInMB
,ROUND(CONVERT(FLOAT,used_log_space_in_bytes/1024)/1024,2) AS LogUsedSizeInMB
,ROUND(used_log_space_in_percent,2) AS LogUsedPercentInMB
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.