SQL Server: Observing Log File size in SQL Server – Percentage Full of each log

Dear All,

You can use DBCC SQLPERF(‘logspace’) command to observe the Log File size:

DBCC SQLPERF('logspace')

The output is as follows:

1_Observing_Log_File_size_in_SQL_Server_Percentage_Full_of_each_log

But its hard to filter the data here. So we can use the DMV sys.dm_os_performance_counters as follows:

SELECT instance_name as [DBName],
cntr_value as "LogFullPercentage"
FROM sys.dm_os_performance_counters
WHERE counter_name LIKE 'Percent Log Used%'
AND instance_name not in ('_Total', 'mssqlsystemresource')

Here is the output:

2_Observing_Log_File_size_in_SQL_Server_Percentage_Full_of_each_log

And you can filter the way you want. More techniques welcomed.

 

Regards

Rahul Sharma

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook

Data Platform Virtual Summit 2020

Subscribe to SQLServerGeeks YouTube channel. If you want more learning content in your inbox, subscribe to SQLServerGeeks Bulletin.

SQLServerGeeks YouTube | SQLServerGeeks Bulletin | SQLServerGeeks Twitter

Leave a Reply

Your email address will not be published. Required fields are marked *