The answer to this question depends on the size of the database that you are running this command, the parameters you will use with DBCC CHECKDB (such as NOINDEX, REPAIR_FAST) and your hardware resources.
However, if you have previously run a SQL Agent Job, you can find out how long it takes from Job’s History.
But what I want to share is that you can see how long it takes to run a DBCC CHECKDB with a DMV.(sys.dm_exec_requests
)
After running the DBCC CHECKDB command, you can run the following command in another Query Editor window and look at the values in the “start_time” and “percent_complete” fields and calculate the approximate time for the process to be completed.
1 2 |
SELECT [session_id], [start_time], [status], [command], db_name([database_id]) AS [db_name], [wait_type], [wait_resource], [percent_complete] FROM sys.dm_exec_requests WHERE [session_id] > 50 |
The “percent_complete” field on the sys.dm_exec_requests DMV will tell you how much of the processes have been completed in all of the following commands.
-
ALTER INDEX REORGANIZE
-
AUTO_SHRINK option with ALTER DATABASE
-
BACKUP DATABASE
-
DBCC CHECKDB
-
DBCC CHECKFILEGROUP
-
DBCC CHECKTABLE
-
DBCC INDEXDEFRAG
-
DBCC SHRINKDATABASE
-
DBCC SHRINKFILE
-
RECOVERY
-
RESTORE DATABASE,
-
ROLLBACK
-
TDE ENCRYPTION