FortiClient
FortiClient proactively defends against advanced attacks. Its tight integration with the Security Fabric enables policy-based automation to contain threats and control outbreaks. FortiClient is compatible with Fabric-Ready partners to further strengthen enterprises’ security posture.
Anil_Solakoglu
Article Id 287638
Description

This article describes how to deal with suspect mode on any SQL database it could be related to damage in transaction log files, hindering database recovery, and preventing the rollback of a transaction. 

Scope Forticlient EMS, SQL Server, Database.
Solution

Corruption can be caused by many reasons such as:

 

  1. Unexpected Database Shutdown: If the database is shut down unexpectedly, trying to reach to database can initiate a recovery process but recovery may fail because of corrupted logs and data.
  2.  Crash During Operations: SQL Server can crash while it is performing Daily Operations, and it can cause corruption. In addition to corruption databases also can encounter a suspect mode. Independent of the specific reason following steps can be applied to solve the problem and get the database back online.

The below example uses this case: 

 

Picture1.png

 
 

To set emergency Mode to Fix a Suspect Database

To set up emergency mode in the suspected database following steps can be used.

 

  1. Activate EMERGENCY Mode:

ALTER DATABASE 'FCM_Default' SET EMERGENCY 

  

Note:

If the database cannot be set to EMERGENCY state, make the database OFFLINE and then bring it ONLINE again.

 

  1. Set Database into SINGLE_USER Mode: The EMERGENCY mode allows all users who have a sysadmin role to reach the database. However, to run the repair process, it is necessary to put the database into single-user mode. The following query can be used.

 

ALTER DATABASE 'FCM_Default' SET SINGLE_USER WITH ROLLBACK IMMEDIATE   

 

  1. Backup the Database: It is always suggested to have a backup of the DB backup in a running state. This backup can be used just in case of any kind of recovery scenario if the procedure does not go as expected.
  2.  Perform Database Repair: The (REPAIR_ALLOW_DATA_LOSS) should be used with care since there is always the possibility of data loss. If corrupted records are found under the data page the entire record can be deleted. Use the following command to repair DB:

 

DBCC CHECKDB ('FCM_Default', REPAIR_ALLOW_DATA_LOSS)

 

  1. Return to MULTI_USER Mode: To adjust MULTI_USER back the following query can be used:

 

ALTER DATABASE 'FCM_Default' SET MULTI_USER

 

  1. Used command summary below:

 

ALTER DATABASE 'FCM_Default' SET EMERGENCY

ALTER DATABASE 'FCM_Default' SET SINGLE_USER WITH ROLLBACK IMMEDIATE

DBCC CHECKDB ('FCM_Default', REPAIR_ALLOW_DATA_LOSS)

ALTER DATABASE 'FCM_Default' SET MULTI_USER