DBCC CheckDB or CheckTable – Find percent complete
You have a DBCC CHECKDB script running, something like the following, and it may take several hours to run to confirm if there is any corruption in your SQL Server Database.
DBCC CHECKDB ('MyDatabaseName') WITH DATA_PURITY, NO_INFOMSGS;
Then someone asks you the age old question… When will it be done?
You look at the window running the command and you can see how long it has been running, but there is no indication of when it will be done.
SELECT start_time, DATEDIFF(MINUTE, start_time, GETDATE()) elapsed_time_minutes, command, percent_complete, last_wait_type FROM sys.dm_exec_requests WHERE session_id = 55 -- Replace the 55 with your SPID (Session ID)
Just be sure to replace the 55 with the session running the DBCC Check that you are wanting to get the status on.
The same thing works for DBCC CHECKTABLE
If you run into issues with the results of CHECKDB or CHECKTABLE please remember that Stedman Solutions offers help in corrupt database repair.
More from Stedman Solutions:
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!
Thank you soo much, this is exactly what I was looking for!