Tuesday, September 7, 2010

[mssql] Database in Recovery Status

Q: I have a database currently showing to be in recovery.  I have not been able to find a GUI method to monitor the progress (to determine when it might complete) so is there a command line T-SQL method to monitor the recovery process?

A: If this is 2005, this might be what you need:

SELECT session_id, command, status, percent_complete, *
  FROM sys.dm_exec_requests
 
It works for other types of commands that have known progress indicators.  If not, then I really don't think it tells you.  You might also check the error log to see how long it took the previous time...