Захват профиля в моем собственном отчете об использовании диска SSMS показывает DBCC SQLPERF(LOGSPACE)
:
exec sp_executesql @stmt=N'begin try
declare @tran_log_space_usage table(
database_name sysname
, log_size_mb float
, log_space_used float
, status int
);
insert into @tran_log_space_usage
exec(''DBCC SQLPERF ( LOGSPACE )'') ;
select 1 as l1
, 1 as l2
, log_size_mb as LogSizeMB
, cast( convert(float,log_space_used) as decimal(10,1)) as SpaceUsage
, ''Used'' as UsageType
from @tran_log_space_usage
where database_name = DB_NAME()
UNION
select 1 as l1
, 1 as l2
, log_size_mb
, cast(convert(float,(100-log_space_used)) as decimal(10,1)) as SpaceUsage
, ''Unused'' as UsageType
from @tran_log_space_usage
where database_name = DB_NAME();
end try
begin catch
select -100 as l1
, ERROR_NUMBER() as l2
, ERROR_SEVERITY() as LogSizeMB
, ERROR_STATE() as SpaceUsage
, ERROR_MESSAGE() as UsageType
end catch',@params=N''