65.9K
CodeProject is changing. Read more.
Home

Time remaining of Database Shrink

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3 votes)

Apr 19, 2011

CPOL
viewsIcon

22540

Time remaining of Database Shrink

I found a stored procedure already in my database (via legacy), and modified it to display remaining seconds and lapsed seconds.
SELECT percent_complete, start_time, status, command, estimated_completion_time/1000/60 As 'Minutes to Completion', total_elapsed_time/1000/60 As 'Minutes Elapsed', wait_type, last_wait_type
FROM sys.dm_exec_requests
order by 'Minutes to Completion' desc
This is useful when you must perform a shrink or another time consuming task. It does not give much help besides "start_time" and "status" for ad hoc queries though.