Wednesday, October 3, 2012

Recovering a SQL Server Database from Suspect Mode



Please use this script to recover database from suspect mode in MS SQL Server 2008, 2005 through SQL Server management Studio.


Follow below steps to recover database from suspect mode:


  1. ALTER DATABASE [database_name] SET EMERGENCY 
  2. DBCC checkdb('database_name') 
  3. ALTER DATABASE [database_name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE 
  4. DBCC CheckDB ('database_name', REPAIR_ALLOW_DATA_LOSS)
  5. ALTER DATABASE [database_name]  SET MULTI_USER





EXEC sp_resetstatus 'SharePoint_AdminContent_db71de42-7853-45fa-b5c2-f401913bf791';
1.ALTER DATABASE "SharePoint_AdminContent_db71de42-7853-45fa-b5c2-f401913bf791" SET EMERGENCY

2.DBCC checkdb('SharePoint_AdminContent_db71de42-7853-45fa-b5c2-f401913bf791')

3.ALTER DATABASE "SharePoint_AdminContent_db71de42-7853-45fa-b5c2-f401913bf791" SET SINGLE_USER WITH ROLLBACK IMMEDIATE

4.DBCC CheckDB ('SharePoint_AdminContent_db71de42-7853-45fa-b5c2-f401913bf791', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE "SharePoint_AdminContent_db71de42-7853-45fa-b5c2-f401913bf791" SET MULTI_USER
5.DBCC CheckDB ('SharePoint_AdminContent_db71de42-7853-45fa-b5c2-f401913bf791')