How To Repair A Suspect Database In MSSQL

Reasons of this error

Here are some following causes due to we have to face the suspected database error.

  1. Restart or shutdown the Database without shutting down the SharePoint server.
  2. The database could have become corrupted.
  3. There is not enough space available for the SQL Server to recover the database during startup.
  4. The database cannot be opened due to inaccessible files or insufficient memory or disk space.
  5. The database files are being held by the operating systems, third party backup software etc.
  6. There was an unexpected SQL Server Shutdown, power failure or a hardware failure.

Resolutions

Here are the few steps to resolve this issue. First, make sure you have to Microsoft SQL Server Management Studio in your system.

1.   First, open your Microsoft SQL Server Management Studio and fill your database credential to connect to your database.

2.   Then right-click on your suspected DB and click on the New Query button to write a query.

3.   After that paste the following SQL script into your New Query page. Here you need to replace [YourDatabase] with the name of your database Name.

EXEC sp_resetstatus [YourDatabase];
ALTER DATABASE [YourDatabase] SET EMERGENCY
DBCC checkdb([YourDatabase])
ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ([YourDatabase], REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE [YourDatabase] SET MULTI_USER

4. Click Execute.

5. After Execute the script refreshes the database.

 

Leave a Reply

Your email address will not be published. Required fields are marked *