Emulate suspect and fixing it
Last updated:
Warning: Review and test in a non-production environment before running.
emulate a suspect database
1. Create a Dummy Database to play with.
2. Shutdown your SQL Server DB Engine Service.
3. Open your LDF file with Hex Editor and edit it manually with few Bogus entries.
4. Start your SQL Instance, you should be seeing your Database marked as Suspect by SQL Server.
5. write the command : select DATABASEPROPERTYEX('database_name','status')
fixing suspect database
1. Turn off the suspect flag on the database and set it to EMERGENCY
EXEC sp_resetstatus 'db_name';
ALTER DATABASE db_name SET EMERGENCY
2. Perform a consistency check on the master database
DBCC CHECKDB ('db_name')
3. Bring the database into the Single User mode and roll back the previous transactions
ALTER DATABASE database_name SET SINGLE_USER WITH ROLLBACK IMMEDIATE
4. Take a complete backup of the database
5. Attempt the Database Repair allowing some data loss
DBCC CheckDB (‘database_name’, REPAIR_ALLOW_DATA_LOSS)
6. Bring the database into the Multi-User mode
ALTER DATABASE database_name SET MULTI_USER
7.Refresh the database server and verify the connectivity of database