Wednesday, November 2, 2011

Upgrade from SQL2000 to SQL2008 put the DB in the Suspect Mode

    After upgrade from SQL 2000 to SQL2008 by restore the backup of database, the database will be in the suspect mode, to put it back to the on line mode we have to follow the steps:
  1. Change the database status to Emergency using the following command. Emergency mode allows you to access the databases as normal but with no consistency guarantee. This option also allows us to export the table data so that we can minimize the damage.
  2. ALTER DATABASE DBNAME SET EMERGENCY
  3. You need to set the database to single mode because Emergency mode allow multiple connections from members of the sysadmin role and to repair database using (DBCC CHECKDB) in should be in single mode,  to put database in single mode you can run the following script:
  4. ALTER DBNAME SET SINGLE_USER
  5. Run the DBCC CHECKDB command
  6. If there is no issues with the database you can make it available on line:
  7. ALTER DBNAME SET ONLINE
  8. Finally you can make it available for all users by reset the database to Multiple user mode:
  9. ALTER  DBNAME  SET MULTI_USER
    Note: if the runing the  DBCC CHECKDB command not fix the issues, you can run it using the REPAIR_ALLOW_DATA_LOSS option, this option should be tried as last option because it could lead to remove data from the tables.
    DBCC CHECKDB (DBNAME  ,REPAIR_ALLOW_DATA_LOSS)

No comments:

Post a Comment

SSRS - How to Parameterizing the SQL Query

We need to create separated dataset to handle the pre defined list in that dataset we will use simple select statement to define the li...