Recover SQL Server from ‘Suspect’ Status

Last night, I had a power outage and a SQL Server went down. When I rebooted it, the database was in ‘Suspect’ mode. After some quick googling I found a solution.

[code lang=”sql”]
EXEC sp_resetstatus ‘yourDBname’;
ALTER DATABASE yourDBname SET EMERGENCY;
DBCC checkdb(‘yourDBname’);
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DBCC CheckDB (‘yourDBname’, REPAIR_ALLOW_DATA_LOSS);
ALTER DATABASE yourDBname SET MULTI_USER;
[/code]

This entry was posted in sql. Bookmark the permalink.