Click here to Skip to main content
11,719,185 members (86,373 online)
Click here to Skip to main content

How to Restore SQL Server 2005 Suspect Database

, 13 Sep 2007 CPOL 272K 46
Rate this:
Please Sign up or sign in to vote.
How to Restore SQL Server 2005 Suspect Database


If your project's database is in suspect mode, then no transaction will take place until and unless you repair your database. That causes a show stopper for your up and running application. Here, you will find a way to get out of this.


Your Database is in Suspect Mode. I guess, you haven't experienced this problem till now. But, if it comes to you and if the database is LIVE, then it's time to read this article to get out of this tension.

Using the Code

If you find your database in Suspect mode, then please keep your nerve strong. Just proceed step by step what I am written below. I think you will get out of this trouble. SQL Server 2005 introduced a new DB Status called Emergency. This mode can change the DB from Suspect mode to Emergency mode, so that you can retrieve the data in read only mode. The steps are... After executing the script given below, you will get back your database in operational mode. Actually I have tried with two of my existing live systems and found no data loss.

Note: Obviously there are two more options available. Run REPAIR_ALLOW_DATA_LOSS to ensure the database is returned to a structurally and transitionally consistent state. Here are a few things to bear in mind about emergency mode repair: it's a one-way operation. Anything it does cannot be rolled back or undone. If this worries you (if someone ever got into that state, then surely don't have the healthy concern about data that they should have in the first place) then make a copy of the damaged database before you run emergency mode repair.
As it's a one-way operation, you cannot wrap it in an explicit user-transaction.
It's the only repair option available in emergency mode - if you try to use REPAIR_REBUILD, then it won't work.

EXEC sp_resetstatus 'yourDBname';
DBCC checkdb('yourDBname')

Points of Interest

You will be happy that your database as well as the application are still in workable condition. Smile | :)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Suvendu Banik
Program Manager
India India
Love to code

You may also be interested in...

Comments and Discussions

Question5 Stars here too! Pin
bortolo5-Oct-12 11:53
memberbortolo5-Oct-12 11:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150901.1 | Last Updated 14 Sep 2007
Article Copyright 2007 by Suvendu Banik
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid