How to fix a suspect database with SQL Management Studio

Introduction

This topic explains the process to recover a database which is marked as SUSPECT.

Some of the reasons why an SQL Server database can be marked as Suspect are:

 

 

Steps to Recover a Database Marked as Suspect

When a database is in Suspect mode connection to the database will not be possible. The first step is to get the database in Emergency mode to repair the database.

  1. Execute the following TSQL code to get the database in Emergency mode:

Use master

GO

ALTER DATABASE BPO SET EMERGENCY

GO

 

 

Once the database is in Emergency mode you will be able to query the database:

  

  1. Execute the DBCC CHECKDB command. This will check the logical and physical integrity of all the objects within the specified database.

DBCC CHECKDB (IRIS)

GO

 

 

 

The next step will be to bring the user database in Single_user mode.

  1. Execute the following TSQL code to get the database in Single_user mode:

ALTER DATABASE IRIS SET SINGLE_USER WITH ROLLBACK IMMEDIATE

GO

 

Once the database is in Single_user mode execute the TSQL code to repair the database. When the database is repaired using REPAIR_ALLOW_DATA_LOSS option of DBCC CHECKDB command, there can be some loss of data.

  1. Execute the following code to repair the database:

DBCC CHECKDB (BPO, REPAIR_ALLOW_DATA_LOSS)

GO

 

  1. Finally, execute the TSQL command to allow Multi_user access to the database:

ALTER DATABASE BPO SET MULTI_USER

GO