Tuesday, 27 January 2015

How to recover sharepoint 2013 Databases from Suspect Mode.


I restarted my SharePoint server, opened Central Administration and encountered the following error:
Server Error in ‘/’ Application
Runtime Error
Description: An application error occurred on the server.
In order to troubleshoot this issue I had to check couple of thing:
  • Make sure SQL Server services are up and running
  • Make sure the IIS application pools are started
  • Review Windows logs and gather more information about the server. I noticed the following event:
 
 
This event made me suspect something is wrong with my SQL Server. I openedSQL Server management studio and noticed that some of my most critical SharePoint databases are not accessible and set to suspect mode. 02 - SharePoint 2013 databases are in Suspect mode

Open your SQL Server management studio and execute the following queries one after another.

1. EXEC sp_resetstatus 'SharePoint_Config'

2. ALTER DATABASE SharePoint_Config SET EMERGENCY
 3. ALTER DATABASE

SharePoint_Config SET SINGLE_USER

WITH ROLLBACK IMMEDIATE

4. DBCC CheckDB ('SharePoint_Config', REPAIR_ALLOW_DATA_LOSS)

5. ALTER DATABASE SharePoint_Config SET MULTI_USER

6.DBCC CheckDB ('SharePoint_Config')

7. From the services restart Sql Server(MSSQLSERVER).

8. In Sql Server management studio, Object explorer refresh the SharePoint_Config database and open your site it will be work properly.

Repeat this action for each one of the affected databases.