Sql-server – DBCC CHECKDB REPAIR_REBUILD taking too long

corruptionsql-server-2008

I'm administrating a database that became corrupt and I tried to do a REPAIR_REBUILD.

The server on this installation is a bit weak but the database isn't that big (roughly 2GB).

It's been running for 48 hours and still not completed. Is it possible ? And is there any way to check the current state other than just seeing "Executing query" ?

Best Answer

You could always run the following script to check the running tasks:

SELECT 
    start_time,
    DATEADD(ms,estimated_completion_time,GETDATE()) AS 'EstimatedEndTime',
    percent_complete,
    --sqltext.TEXT, 
    req.session_id, 
    req.status, 
    req.command, 
    req.cpu_time, 
    req.total_elapsed_time
FROM sys.dm_exec_requests req 
CROSS APPLY sys.dm_exec_sql_text(req.sql_handle) 
where req.command like '%DBCC%'

Comment out the sqltext.TEXT column if you wish to view the whole statement.