How to get log file size

Recently one guy asked me how to get logfile size and free space in the log file.
We can get this information from dbcc sqlperf command.



Here is code for this


CREATE TABLE #logsize (

database_name VARCHAR(255),

log_size_mb DECIMAL(20,17),

log_space_used_mb DECIMAL(20,17),

status INT)


INSERT INTO #logsize

EXEC( 'DBCC sqlperf ( logspace )')


SELECT *

FROM #logsize

ORDER BY database_name


Cheers

No comments:

Post a Comment

Popular Posts