How to fix Recovery Pending State in SQL Server Database?
Summary: This post will outline the reasons why a database (db) is marked in recovery pending state. Also, it will describe methods to fix ‘SQL server database in recovery pending state’ problem. You can resolve the problem by executing queries in SQL Server Management Studio (SSMS), or by using Stellar Repair for MS SQL software.
Contents
SQL Server Database States
A SQL database is considered to be damaged if one or more of its core files are in an inconsistent state. Depending on how severe the damage is, the db is marked with different states. Some of these states are:
- Online – If one of the data files is damaged when executing a query or some other operation, the database will remain online and accessible.
- Suspect – If a database cannot be recovered during startup of SQL Server, the database is marked as Suspect.
- Recovery Pending – If the SQL Server knows that database recovery needs to be run but something is preventing it from starting, the Server marks the db in ‘Recovery Pending’ state. This is different from the SUSPECT state because it cannot be said that recovery is going to fail – it just hasn’t started yet.

Let’s first understand how you can check the current state of the database.
How to Check Database State?
To check the current state of an SQL db, run the following query:
SELECT name, state_desc from sys.databases
GO
Executing the query will give you an output that looks something like:

Reasons behind Recovery Pending State in SQL Server
Some of the reasons causing such an issue are:
- The database didn’t shut down properly and there is at least one uncommitted transaction active during the shutdown, resulting in deletion of the active transaction log file.
- User tried moving the log files to a new drive to overcome server performance issues but ended up corrupting the log files in the process.
- Database Recovery cannot be initiated due to insufficient memory space or disk storage.
Methods to Fix Recovery Pending in SQL Server Database Issue
Note: Before initiating any of the following repair procedures, make sure to take db backup, so as to have a fail-safe copy in case anything goes wrong.
Method 1 – Manual Ways to Resolve the Database in Pending State
Following are the two manual ways that helps bring SQL database in recovery mode to normal mode:
1. Mark Database in Emergency Mode and Initiate Forceful Repair
Database EMERGENCY mode marks the database as READ_ONLY, disables logging, and grants access only to system administrators. Essentially, setting the db in this mode can bring the inaccessible database online.
Note: Usually a database comes out of EMERGENCY mode automatically. If you are having issues restoring the db from this mode, read this Recover SQL Database from Emergency Mode to Normal Mode.
Once you have opened the db in EMERGENCY mode, try repairing the database using the DBCC CHECKDB command with the ‘REPAIR_ALLOW_DATA_LOSS’ option. To do so, open SSMS and execute the following set of queries:
ALTER DATABASE [DBName] SET EMERGENCY;
GO
ALTER DATABASE [DBName] set single_user
GO
DBCC CHECKDB ([DBName], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS;
GO
ALTER DATABASE [DBName] set multi_user
GO
2. Mark Database in Emergency Mode, Detach the Main Database and Re-attach It
This solution also requires to mark db in EMERGENCY mode. Once done, take the database offline (detach) and then bring it online (re-attach). To do so, execute the following set of queries in SSMS:
ALTER DATABASE [DBName] SET EMERGENCY;
ALTER DATABASE [DBName] set multi_user
EXEC sp_detach_db ‘[DBName]’
EXEC sp_attach_single_file_db @DBName = ‘[DBName]’, @physname = N'[mdf path]’
The above set of queries help make the server get rid of the corrupt log and build a new one automatically.
Method 2 – Use Stellar Repair for MS SQL Software
If the above methods cannot help resolve the db in recovery pending state issue, use Stellar Repair for MS SQL software. The software can help you repair corrupt database files and bring the database back online from recovery pending state quickly and smoothly.
Steps to Use Stellar Repair for MS SQL Software
- Download, install and Run Stellar Repair for MS SQL software.
- From Select Database window, click Browse or Search to select the database file you want to repair.

- Software provides Standard Scan and Advanced Scan option to scan the corrupt database.

- Click Repair to start the repair process.
- The software shows preview of all the recoverable db components.

- To save the repaired file and its components, click Save on File menu.

- From the Save Database window, do the following:
- Choose MDF under Save As.
- Select New Database or Live Database under Saving Option.
- Enter the required details in the Connect to Server section by Authentication or SQL Server Authentication.

- Click Browse to choose the destination for saving the repaired file.

- Click Save.
- When the ‘Save Complete’ message box appears, click OK.

The repaired file will get saved in the selected location.
Note: For detailed information about using Stellar Repair for MS SQL software, refer to this user guide.
Key Features of Stellar Repair for MS SQL
- Repairs corrupt and inaccessible MS SQL Database (.mdf and .ndf) files.
- Recovers all database components like tables, keys, indexes, triggers, rules, and stored procedures, etc.
- Recovers deleted records.
- Supports MS SQL 2019, 2017, 2016, 2014, 2012, 2008, 2008 R2 and all lower versions.
- The software is trusted by Microsoft MVPs.
Conclusion
This post outlined reasons behind ‘db in recovery pending state’ issue like database is not cleanly shut down, database files (.mdf or .ndf) turned corrupt, insufficient memory or disk space. It also described methods to fix Recovery Pending State in SQL Server Database.
You can fix the database by setting it to emergency state, and initiating the repair process or de-attaching and reattaching the db. But, such solutions have their own downsides:
- It can only resolve minor database issues.
- It does not ensure complete recovery of the database.
- It involves data loss risk, particularly, running ‘REPAIR_ALLOW_DATA_LOSS’ command can delete some data.
You can overcome these limitations by using Stellar Repair for MS SQL software. The software helps SQL users and database administrators (DBAs) to fix severe database corruption errors. Also, it ensures complete recovery of db components, while preserving data integrity.
Nice. It works. Thanks.
Solution 1: Mark database in Emergency mode and initiate forceful Repair
Help me to resolve my issue of (Recovery Pending…) for my database.
Thanks
Great!
You can subscribe to our blog to receive the latest updates.
I tried manual methods to handle recovery pending state and now, the database in suspect mode. Please suggest….!
Hello Noel,
As database in the suspect mode so, you can download Stellar SQL database repair software and repair the MDF file. The software brings the SQL database from suspect mode to normal mode.
Good Luck!
Your blog saved me!!
The SQL recovery software done the miracle and repaired my database successfully.
Hello Grant,
Thanks for your valuable comment.
My SQL server is unable to build a new log. Why?
Hi Ruhel,
Read-only status of a data file is responsible for this problem.
Hi Priyanka
thank you , this worked like a GEM.
Now, I have lost my faith in a time-consuming manual method. Please help!
Don’t Panic!
Try free demo of Stellar Repair for MS SQL and share feedback with us.
On running SELECT name, state desc from sys.databases, I was getting RECOVERY_PENDING. Even after running multiple T-SQL commands and even the commands which you recommended, I’m not able to get my .mdf back in order.
Are you sure Stellar Repair for MS SQL would be able to resolve my database which is showing RECOVERY_PENDING issue?
Don’t worry!
For 100% transparency, you can go for free demo of Stellar Repair for MS SQL.
After reading the review of MVP (Damian Widera), I can test the software to fix our ongoing SQL server database issue.
MVP (Damian Widera) is a well-known expert in the tech industry.
My SSMS 2016 too was showing recovery in pending state and even after troubleshooting it for 12 hours straight.
I was not able to detect the error but thankfully with the help of your SQL reference. I found out that the space on the Hard Drive was not enough.
Thanks for the help,
Best Regards,
Neil Richards
Hi Neil,
If you wish to receive recent technical guide update, then subscribe our blog.