Database Technologies‎ > ‎MSSQL‎ > ‎

SQL Server Emergency Mode

Database Corruption.

Emergency Mode.

ALTER DATABASE test_db SET EMERGENCY

This allow System administrator to access to the data
it could be reviewed and transferred to another proper database

When you execute the statement SQL Server will shutdown the database
and restart the database without recovering it.
But good thing is that you could view database objects, db will be in read only mode

ALTER DATABASE TEST SET SINGLE_USER
DBCC CHECKDB('DB NAME', REPAIR_REBUILD)           // Will try to repair
DBCC CHECKDB('<db_name>',REPAIR_ALLOW_DATA_LOSS)  // This require db in single user mode
                                                                                                  //But data could be lost in here

Above if the command is succesfull it will db online.
If above doesn't work, restore from backup. If no backup. God Bless You.

Comments