How to install a database in emergency mode?

my database is stopped. I can’t do anything, choose, update, nothing. someone told me to install the database in emergency mode, but I don’t know how?

+4
source share
4 answers

I found a solution: ALTER DATABASE dbName SET Emergency

+2
source

I think this is only for the server database or not?

in the SQL documentation there was a query like this:

set emergency mode "databasename" 

try it! cos' I only have an Express Edition SQL Server here

0
source

If your data file is in suspicious mode, you will need to save this database in ascent mode (in order to access this database).

 alter database datasename set emergency 

Then run the DBCC statement as:

 dbcc chedkdb(DBname,repair_rebuild) with no_infomsgs 

If this does not work, save the DB in singleuser mode as shown below and run the checkdb statement

 alter database DBname set single_user dbcc checkdb(DBname,repair_allow_data_loss) with no_infomsgs 

If it succeeds, now keep the database online through

 alter database DBname set multi_user 
0
source
 USE [master] GO -- Method 1: I use this method EXEC sp_attach_single_file_db @dbname='TestDb', @physname=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf' GO -- Method 2: CREATE DATABASE TestDb ON (FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf') FOR ATTACH_REBUILD_LOG GO 
-1
source

All Articles