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
- EXEC sp_resetstatus 'WSS_Logging'
Step 2: Then we’ll set the database in Emergency mode by run this command.
- ALTER DATABASE WSS_Logging SET EMERGENCY
Step 3: Check the logical and physical integrity of the objects in the database by run this command.
- DBCC checkdb('WSS_Logging')
Step 4: After that we’ll set the database in single user mode
- ALTER DATABASE WSS_Logging SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Step 5: Fix the error by running this command
- DBCC CheckDB ('WSS_Logging', REPAIR_ALLOW_DATA_LOSS)
Step 6: Then we’ll set the database in multi user mode.
- ALTER DATABASE WSS_Logging SET MULTI_USER