During regular usage, SQL Server databases may encounter several technical issues that can be hard to resolve. One such issue is the "SQL Server database recovery in suspended state." If you encounter this problem accidentally, don't worry. You can refer to the solutions here to fix the SQL Server database recovery in suspended state. Additionally, if you're not an expert in SQL Server database issues and lack confidence in resolving it, you can use the MS SQL Recovery tool to resolve the problem efficiently and easily.

Please provide the English content you want translated, and I'll do my best to translate it into Chinese.

Solution That Works Step-by-Step Troubleshooting
1. Mark the SQL Database as Emergency Mode The emergency mode will mark the SQL database as read-only and disable logging...Full Steps
2. Disconnect the Primary Database ALTER DATABASE [DBName] SET EMERGENCY > ALTER DATABASE [DBName] set multi_user...Full Steps
3. Resolve the Recovery Pending State Download and run the MS SQL Recovery tool. Click on the ellipsis (Browse button) to select the target MDF file...Full Steps

Three States of a SQL Server Database

SQL database might get corrupt if any one or more of its MDF/NDF files get corrupted. Different levels of corruption exhibit different states. Let's have a detailed look at them.

Tip

You can run the following query to check the status of your SQL Server:

SELECT name, state_desc from sys.databases

GO

  • Online: If one of the damaged data files, the database remains accessible and remains online.
  • Suspect: The transaction log is damaged and prevents recovery or prevents rollback of transactions from completing, causing the SQL database to fail.
  • Recovery pending: SQL Server needs to run database recovery, but can't start for some reason. This is different from the suspect state, where recovery might fail, but hasn't started yet.

Reasons for "Recovery Pending" State in SQL Server

A SQL Server database being in a recovery pending state can be caused by several factors. The primary reasons are as follows:

  • The database was not shut down normally, meaning that there were one or more active, uncommitted transactions whose log files have since been deleted.
  • The transaction log file became corrupted during the move, possibly due to a performance issue.
  • There was insufficient available storage on the drive containing the database partition, preventing SQL Server from opening and locking the database file.

How to Resolve the Suspended State Issue in a SQL Server Database

You can manually resolve the suspended recovery state issue in SQL Server databases through some queries. Alternatively, to avoid aggravating the problem with improper operations, you can utilize professional MS SQL recovery tools to assist you in the process.

Warning
If you plan to manually resolve the suspended recovery issue by running relevant SQL queries, it is a technically involved process that, if mishandled, can lead to serious issues. Therefore, make sure to back up your SQL Server before you start. Alternatively, if you are not a tech expert, you can use the MS SQL Recovery software tool to assist you in performing this operation in a risk-free manner.

Method 1: Place the SQL Database in Emergency Mode

The emergency mode marks the SQL database as read-only and disables logging. At this point, only a DBA can access it. Entering emergency mode and starting database recovery can fix any technical issues. The database will automatically exit emergency mode.

Set database [DBName] to emergency mode;

Start

ALTER DATABASE [DBName] SET SINGLE_USER

Start

The SQL command `DBCC CHECKDB ([Database_Name], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;` is used to check the integrity of the specified database (replace 'Database_Name' with the actual name) and fix any existing issues. The `REPAIR_ALLOW_DATA_LOSS` option suggests that some data loss might occur in order to complete the repair, while `WITH ALL_ERRORMSGS` option ensures all error messages are displayed. Caution should be exercised when using `REPAIR_ALLOW_DATA_LOSS` as it can lead to irreversible data loss. It's advisable to back up your database before executing this command.

Start

Change the database [DBName] to multi-user mode

GO can be translated as "go" or "head to" in English. Depending on the context, it might have other meanings, such as "start" or "act" in a game or competition.

Method 2: Mark the SQL database as emergency mode and disconnect the primary database

Executing these queries will cause the server to delete the corrupted log and create a new one automatically.

This SQL command translates to: SET DATABASE [DBName] TO EMERGENCY; In Chinese, it is: 将[DBName]数据库设置为紧急模式。

Set the database [DBName] to multi-user mode

Execute the stored procedure `sp_detach_db '[DBName]'`

Execute the stored procedure to attach a single-file database: ```sql EXEC sp_attach_single_file_db @DBName = '[Database Name]', @physname = N'[mdf path]' ```

A Simpler, Risk-Free Way to Resolve SQL Server Recovery Pending State

The above manual solutions effectively resolve the issue of suspended recovery. If you are an expert in SQL Server database issues, they are your go-to options. However, if you have limited knowledge about SQL Server databases, we highly recommend that you opt for a safer and automated solution. Use MS SQL Recovery software to fix corrupted databases in 823/824/825 errors.

Step 1: Download and run the MS SQL Recovery tool.

Step 2. Click on the two dots (Browse button) to select the target MDF file, or click on “Search” and choose the file to be repaired from the listed files. Thereafter, click on “Repair” to initiate the repair process.

Repair MDF File - Step 2

Step 3: Once the scan is complete, a window will pop up confirming that the analysis has been successfully finished. All recovered tables and record items will be displayed in the left pane with their original table names.

Repair MDF File - Step 3

4. Click the “Export” button at the bottom right corner of the screen. You can save the recovered database to a database or an SQL script as needed. Then, you need to input the server/instance name and connect to the server. If you choose “Export to Database,” you can create a new database or export to an existing one.

Repair MDF File - Step 4