Recover Sharepoint 2013 WSS_Logging Database marked as suspect

When you see your database in suspect mode, you can follow below mentioned steps to repair your database. In my case, it was SharePoint database name WSS_Logging .

Step 1: First of all we’ll reset the suspect flag on the database by run this command

  1. EXEC sp_resetstatus 'WSS_Logging'  

Step 2: Then we’ll set the database in Emergency mode by run this command.

  1. ALTER DATABASE WSS_Logging SET EMERGENCY  

Step 3: Check the logical and physical integrity of the objects in the database by run this command.

  1. DBCC checkdb('WSS_Logging')  

Step 4: After that we’ll set the database in single user mode

  1. ALTER DATABASE WSS_Logging SET SINGLE_USER WITH ROLLBACK IMMEDIATE  

Step 5: Fix the error by running this command

  1. DBCC CheckDB ('WSS_Logging', REPAIR_ALLOW_DATA_LOSS)  

Step 6: Then we’ll set the database in multi user mode.

  1. ALTER DATABASE WSS_Logging SET MULTI_USER