Technical Article

Getting transaction log space usage statistics for all databases.

,

Copy the script to SSMS
Run it
Ensure that you have viewserverstate permission assigned.
----------------------------------------------------------------------------------------
declare @SQLPerfLogSpace table
(
    DBNAME          sysname,
    LogSizeMB         decimal(10,4),
    LogSpaceUsed      decimal(10,4),
Status               Bit --Status of the log file. Always 0.
)
insert into @SQLPerfLogSpace exec('DBCC SQLPERF(logspace)')
select * from @SQLPerfLogSpace
Order by LogSizeMB desc
select * from @SQLPerfLogSpace
Order by LogSpaceUSed desc
declare @SQLPerfLogSpace table
(
    DBNAME          sysname,
    LogSizeMB         decimal(10,4),
    LogSpaceUsed      decimal(10,4),
Status               Bit --Status of the log file. Always 0.
)
insert into @SQLPerfLogSpace exec('DBCC SQLPERF(logspace)')


select * from @SQLPerfLogSpace
Order by LogSizeMB desc


select * from @SQLPerfLogSpace
Order by LogSpaceUSed desc

Rate

3.25 (4)

You rated this post out of 5. Change rating

Share

Share

Rate

3.25 (4)

You rated this post out of 5. Change rating