- 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.
- 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:
- Run the DBCC CHECKDB command
- If there is no issues with the database you can make it available on line:
- Finally you can make it available for all users by reset the database to Multiple user 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:
ALTER DATABASE DBNAME SET EMERGENCY
ALTER DBNAME SET SINGLE_USER
ALTER DBNAME SET ONLINE
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