Reasons for database SUSPECT state:
1. Database corruption.
2. Not enough space for the SQL Server to recover the database during startup.
3. Insufficient memory or disk space.
4. Unexpected SQL Server Shutdown, Power failure or a Hardware failure.
Follow the below steps to repair the SUSPECT database:
1. Identify all the databases which are in SUSPECT mode
USE masterNote:Check the latest log for the database which is marked as suspect.
GO
SELECT NAME,STATE_DESC FROM SYS.DATABASES
WHERE STATE_DESC='SUSPECT'
GO
SQL Server -> Management -> SQL Server Logs
2. Get the database first into EMERGENCY mode to repair it
USE masterNote: The EMERGENCY database is one way which means read-only.
GO
ALTER DATABASE "databasename" SET EMERGENCY
GO
3. Repair the Database in emergency mode
DBCC checkdb('databasename')
ALTER DATABASE "databasename" SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('databasename', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE "databasename" SET MULTI_USER
No comments:
Post a Comment