How to check transaction log file size in Sql server

In SQL server to check transaction log file size you can simply run this dbcc sqlperf(“logspace”) . This query will provide you the transaction log usage statistics for all the databases.

 

How to check transaction log file size in Sql server
How to check transaction log file size in Sql server

The other way round is to run this DMV query which will provide you the usage for the selected database. Note,this will provide you usage only for the

selected database.

Use tempdb

SELECT total_log_size_in_bytes *1.0/1024/1024 AS [ Total log space in MB],
used_log_space_in_bytes *1.0/1024/1024 AS [ Used log space in MB],
(total_log_size_in_bytes – used_log_space_in_bytes)*1.0/1024/1024 AS [free log space in MB]
FROM sys.dm_db_log_space_usage;

 

How to check transaction log file size in Sql server
How to check transaction log file size in Sql server

 

 

 

 8,489 total views,  1 views today

Add a Comment

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