SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Help! My Database is Marked Suspect.

By Brian Knight, 2004/03/31

Total article views: 51062 | Views in the last 30 days: 370
A database can be marked for many reasons. Generally it falls into the following conditions :
  • A database or log file is missing.
  • In SQL 6.5, a device may not be present or in 7.0/2000 a file may not exist.
  • SQL Server may not have been able to restore the database in ample time.
  • The database could be corrupt.
  • The database is being help by the operating system. This could be a 3rd party backup software or defrag software. I've had even a virus scanning software cause this once.
  • SQL Server does not have enough space to recover the database on startup.

To fix this problem, perform the following functions:

  1. Review the SQL Server and NT error logs to see if you can find where the problem occured.
  2. Start SQL Server in single user mode.
    • Go to your control panel and services.
    • Stop SQL Server
    • Add the -m switch in the parameters pane below.
    • Start SQL Server
  3. Run sp_resetstatus with the @dbname parameter. (ie : sp_resetstatus @dbname = "pubs")
  4. Perform detailed DBCC checks (CHECKDB, CHECKALLOC, etc)
  5. Run a few random queries to see if you experience any problems.
  6. If no problems occur, stop and start SQL Server and open the database to production.

    As an absolute last resort, you can place your database in emergency mode. By placing it in this mode, you will be allowed to copy data out of the database, even if the data is corrupt. To place your database in emergency mode, use the following command:

    SP_CONFIGURE 'allow updates', 1
    RECONFIGURE WITH OVERRIDE
    GO
    UPDATE master..sysdatabases set status = -32768 WHERE name = 'pubs'
    GO
    SP_CONFIGURE 'allow updates', 0
    RECONFIGURE WITH OVERRIDE

    You can then BCP data out and place it into a different database.

By Brian Knight, 2004/03/31

Total article views: 51062 | Views in the last 30 days: 370
Your response
 
 
Related tags
 
Related content

Process Tracking

By Steve Jones | Category: Administering
| 4,398 reads

Log Your Changes

By Steve Jones | Category: Administering
| 5,138 reads
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com