Question: How do you remove the status of "Emergency" from the Suspected Database in Microsoft SQL Server 2019 or in Docker SQL Server?
Login to See the Rest of the Answer
Answer: This is the most annoying problem to be faced with, keep in mind that whatever you do on Production Database e.g. Modifying the Database Files on Disk, make sure you have backups. Modifying the Actual Database files on Disk could result in the Database getting suspected which might cause the data to be corrupted.
If you need to remove the "Suspect" status from the SQL Server Database hosted in Docker Container follow the steps below:
1. Make sure you had backed up your database earlier or have a current copy of the database you are trying to remove from Suspect or EMERGENCY status.
2. Follow the steps in the code below: After completion, refresh the Server Instance or the Database: Click on the Database itself, then refresh.
--Step 1
ALTER DATABASE database_name SET EMERGENCY
--Step 2
--ALTER DATABASE database_name set single_user
-- Step 3
--DBCC CHECKDB (database_name, REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
-- Step 4
--DBCC CHECKDB ('database_name')
--Step 5
--ALTER DATABASE database_name SET MULTI_USER