views:

34

answers:

1

When you right-click on database, Reports...Disk Usage, I get a report. Because I have limited permissions, I only get the top portion, which shows "Transaction Log Space Usage" - that number alone could be useful to me.

However, later I get error messages about not having permissions to run DBCC showfilestats, and I also definitely don't have access to sys.dm_os_performance_counters or DBCC SQLPERF('logspace').

If I can just get that top number, that would be useful. Unfortunately, I cannot run the profiler, of course, so I have no idea what command or query it's issuing to even get that data...

+1  A: 

Profiler capture of my own SSMS Disk Usage report shows 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''
Remus Rusanu
Thanks, I guess it must get elevated privileges somehow.
Cade Roux