TL;DR
SQL database Recovery Pending is not a status I ever want to see on my most important database. What I do next decides how my day goes, and whether I lose data or keep all of it. So I slow down and find out why it happened before I change anything. The safe path is usually short, and the risky shortcuts are the ones I cannot undo.
SQL Server Recovery Pending means the engine could not finish starting database recovery because a file, permission, or disk-space problem is blocking it.
Could you recover safely before attempting a database repair? See what a SQL Server Health Check finds
- The data is usually intact. I find the root cause in the SQL Server error log, fix it, then set the database ONLINE.
- I always confirm I have a current backup before I attempt any repair.
- I use
DBCC CHECKDB REPAIR_ALLOW_DATA_LOSSonly as a last resort, because it is irreversible and deletes data. - My safe order is: read the error log, fix the cause, set the database ONLINE, restore from backup, and only then think about repair.
- If the status says In Recovery instead of Recovery Pending, SQL Server is still working. I check progress and wait before I change anything.

SQL Database Recovery Pending: What It Means
A database in Recovery Pending hit a resource-related error during recovery and needs manual intervention before recovery can finish. I tell it apart from the other states with this table:
| State | What it means | What to do |
|---|---|---|
| ONLINE | Normal. Users can connect. | Nothing. |
| RECOVERING (shown as "In Recovery") | The normal, temporary "recovery is running" state. It moves to ONLINE on its own when recovery succeeds. | I wait and check progress. |
| RECOVERY PENDING | Recovery could not even start because of a missing or inaccessible resource. The database is not necessarily damaged. | I follow the safe order below. |
| SUSPECT | More serious. At least the primary filegroup is suspect and may be damaged. | I restore from backup. I get specialist help before any repair. |
| RESTORING | A restore is running, or a restore used NORECOVERY and the database is waiting for more backups. | I finish or check the restore. |
The good news: a Recovery Pending database is usually fine. The data is probably intact. I just need to clear whatever is blocking recovery. The database stays unavailable to users until I do.
How to Check the Database State
The examples below use a standalone SQL Server user database in SSMS or sqlcmd. I replace the placeholders, confirm the instance and database, and run only the step that applies. GO is a client batch separator. Reading metadata, changing database state, backup and restore, and repair each need different permissions, so I use the access my DBA role already has. I never run all sections as one script.
Every SQL Server database is always in one specific state. I read it from sys.databases:
USE master;
GO
SELECT name, state_desc, user_access_desc, recovery_model_desc
FROM sys.databases
WHERE name = N'YourDatabase';
GOI use sys.databases and not DATABASEPROPERTYEX. Microsoft's list of DATABASEPROPERTYEX status values has no Recovery Pending entry, and Paul Randal of SQLskills has noted that it can report SUSPECT for a database that is really Recovery Pending. A wrong SUSPECT label would send me down the wrong path.
Note: to read the error log with sp_readerrorlog, SQL Server 2019 and earlier need membership in the securityadmin fixed server role or VIEW SERVER STATE. SQL Server 2022 and later need securityadmin, VIEW ANY ERROR LOG or VIEW SERVER STATE.


Why a SQL Server Database Goes Into Recovery Pending
Common root causes include:
- SQL Server shut down unexpectedly (hardware, power, or a crash).
- A data (.mdf/.ndf) or log (.ldf) file is missing, renamed, or moved.
- The transaction log file is corrupted.
- The disk holding the files is missing, offline, or full.
- The SQL Server service account lost permission to the files (often after a server or directory change).
- An upgrade was interrupted partway through.
- Ransomware encrypted the database files.
A note on terminology: when the log fills during recovery, Microsoft's Error 9002 documentation describes the state as RESOURCE PENDING, while the database-states page documents RECOVERY PENDING. Either way, disk or log exhaustion during recovery is a real cause. Read the error log for the exact message.
How to Fix SQL Server Recovery Pending: The Safe Order
The order matters. I diagnose first, fix the cause, try a clean restart, restore from backup before any repair, and treat emergency-mode repair as the last resort. This order has not changed in SQL Server 2025.
Step 1: Read the SQL Server Error Log
I start here. The error log almost always names the real problem: a missing file, a permission failure, or a resource shortage.
-- Current error log, filtered to your database name:
EXEC sys.sp_readerrorlog 0, 1, N'YourDatabase';
GOIf this database-name filter returns no rows, I inspect the unfiltered current error log and the archived logs around the failure. No matching rows do not prove that no error occurred. See how to find and read the SQL Server error log. On Windows, I also check Event Viewer when relevant.
Three error numbers explain most of what I find in the log:
| Error | What it means | Where to go next |
|---|---|---|
| 17204 | SQL Server could not open a database file at startup. A user database that hits this error is left in RECOVERY_PENDING. The message includes an operating system error number. | Step 2 |
| 9002 | The transaction log is full. If it fills during recovery, the database is marked RESOURCE PENDING. | Step 2, and our guide to a transaction log that is too large |
| 3414 | Recovery started and failed. The database is SUSPECT. | Step 4 (restore), or call for help |
Step 2: Fix the Root Cause
I use the error number, full file path and operating-system message to choose the next check. For standalone SQL Server, this read-only query shows where the instance expects the files:
USE master;
GO
SELECT
name AS logical_file_name,
type_desc,
physical_name,
state_desc AS file_state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'YourDatabase');
GOI replace YourDatabase with the exact database name. These rows show registered paths and file states. They do not prove the files exist, that the operating-system account can access them, or that the disk has free space. No rows can mean an incorrect name or insufficient metadata visibility. Microsoft documents the view and its permissions. I use the DBA access I already have and do not grant broad permissions just to run the example.
On Windows, I match the error to the next check:
| Error | What I check next | Avoid |
|---|---|---|
| OS error 2 or 3File or path not found | I compare the full log path with registered file paths and drive availability.
| Empty placeholder files or assuming the log can always be rebuilt. |
| OS error 5Access denied | I have an administrator verify the Windows identity for the failing operation and its file and folder access. Startup and attach/restore can use different contexts. | Blanket permission changes without identifying the failing account. |
| OS error 32File in use | I identify the locking process with Process Explorer or Handle, then resolve the conflict. If antivirus is involved, I follow Microsoft guidance, or see our antivirus guide for SQL Server. | Disabling protection or using detach/attach as a routine fix. |
| SQL error 9002Transaction log full | I check A full log does not always mean a full disk. | Deleting the .ldf file. |
If the files were moved or renamed and I know where they are now, SQL Server has to be told the new location. A database that cannot start needs Microsoft's failure recovery procedure. Only members of the sysadmin fixed server role can move the file, and the steps include starting the instance in master-only recovery mode. That procedure stops the whole instance, so every database on it is unavailable until the instance restarts. I plan it as an outage. I follow Microsoft's move procedure, and I make sure the SQL Server service account can read and write the new folder.
If the same file errors hit a system database, the instance itself will not start. Microsoft's error 17204 page covers that case.
Microsoft documents these file-access errors and the causes of error 9002. Once I correct the underlying cause, I continue to Step 3.
For an availability-group database, I follow Microsoft's availability-group recovery procedure. The standalone restore and repair examples below are not a drop-in fix for an availability-group database.
Step 3: Try to Bring the Database Online
If the cause is corrected and the database should be recoverable, I try the least destructive restart. I run this in auto-commit mode, not inside an explicit transaction:
USE master;
GO
ALTER DATABASE [YourDatabase] SET ONLINE;
GOAfter SET ONLINE completes, I rerun the state query below. The target should report ONLINE. I also verify that the intended application can connect. If it remains unavailable or the command reports an error, I stop repeating it and move to a planned restore. ONLINE by itself does not prove integrity or no data loss.
USE master;
GO
SELECT name, state_desc, user_access_desc, recovery_model_desc
FROM sys.databases
WHERE name = N'YourDatabase';
GOStep 4: Restore From Backup (the Primary Fix)
If the database still will not recover, I restore from a known-good backup using a recovery plan matched to the database and the recovery point I need. I verify the backup sets, log-chain continuity, file locations, available space and required access. I resolve application connections before restoring. These examples are for a standalone SQL Server user database; they are not a script to run from top to bottom.
Every YourDatabase and X:\Backups\... value below is a placeholder. The backup directory must exist and be accessible to SQL Server. I run only the scenario that applies, one block at a time, and stop on any error. I never add WITH REPLACE to get past a backup or restore error.
Preserve the log tail when the recovery plan needs it
For FULL or BULK_LOGGED recovery, a tail-log backup can preserve transactions not yet backed up. It is not required when the chosen recovery point is already in an earlier backup. For a database that failed to start, the documented option is NO_TRUNCATE:
-- Failed-start database; only if this recovery plan needs a tail-log backup.
BACKUP LOG [YourDatabase]
TO DISK = N'X:\Backups\tail_unique.trn'
WITH NO_TRUNCATE;
GOIf the database is actually ONLINE and I am about to restore it, I use this alternative instead. NORECOVERY leaves the database unavailable for normal use, so I run it only as part of the agreed restore plan:
-- ONLINE database; alternative to the failed-start example above.
BACKUP LOG [YourDatabase]
TO DISK = N'X:\Backups\tail_unique.trn'
WITH NORECOVERY;
GOFor a damaged database, Microsoft describes CONTINUE_AFTER_ERROR. Success depends on an undamaged log, a database state that supports the backup and the absence of bulk-logged changes. I do not turn these options into an automatic retry sequence. If the needed tail cannot be captured, I explain which transactions cannot be recovered. See Microsoft's tail-log scenarios.
Scenario A: recover only to the end of a full backup
I use this only when the agreed recovery point is the full backup itself and no later differential or log backup needs to be applied. Changes after that backup will not be recovered by this example:
USE master;
GO
RESTORE DATABASE [YourDatabase]
FROM DISK = N'X:\Backups\full.bak'
WITH RECOVERY;
GOScenario B: full, differential and log chain through the log tail
This specific example assumes a matching full backup, its differential backup, two required log backups and a successful tail-log backup, all on one valid recovery path. I use the actual backup sets and every required log in order. If the differential is not part of my plan, I omit it and restore the logs required after the full backup. A missing or damaged log can limit the recovery point. I execute each RESTORE statement separately and stop immediately if one fails.
USE master;
GO
RESTORE DATABASE [YourDatabase]
FROM DISK = N'X:\Backups\full.bak' WITH NORECOVERY;
RESTORE DATABASE [YourDatabase]
FROM DISK = N'X:\Backups\diff.bak' WITH NORECOVERY;
RESTORE LOG [YourDatabase]
FROM DISK = N'X:\Backups\log_1.trn' WITH NORECOVERY;
RESTORE LOG [YourDatabase]
FROM DISK = N'X:\Backups\log_2.trn' WITH NORECOVERY;
RESTORE LOG [YourDatabase]
FROM DISK = N'X:\Backups\tail_unique.trn' WITH NORECOVERY;
GOStop here and confirm that every required backup, including the valid tail backup for this scenario, restored successfully. Only after the complete selected chain has been applied do I recover the database:
RESTORE DATABASE [YourDatabase] WITH RECOVERY;
GOI do not apply the tail blindly to an earlier point-in-time target. Point-in-time recovery needs a separate restore plan with the correct STOPAT target. After recovery, I rerun the state query and verify the intended application connects. ONLINE does not prove that all expected business data is present. Microsoft explains the required restore order.
Step 5: Last Resort, Emergency Mode and DBCC CHECKDB Repair
Only when restore is unavailable do I consider salvage or emergency repair, and it is a senior DBA call. REPAIR_ALLOW_DATA_LOSS can permanently remove data. Before any repair, I preserve physical copies of the database files and containers using a safe method. I do not copy live files casually, and I never overwrite the only surviving copy.
EMERGENCY mode is what makes this kind of repair possible, and it has limits. Microsoft's database states page says it marks the database read-only, turns logging off and limits access to sysadmin members. That gives me read-only access, so before I repair anything I try to copy out the data I can reach from the critical tables. Recovery has not run in that state, so what I read may not be consistent.
- Any
REPAIRoption requiresSINGLE_USERmode. - Normal REPAIR_REBUILD can be logged in a user transaction. Emergency-mode repair cannot be wrapped in a user transaction and rolled back.
- Emergency repair can leave transactional or referential inconsistencies. ONLINE is not proof of complete recovery.
- If repair has to rebuild the log, transactional consistency can be lost.
The following is a last-resort example, not the normal fix. It disconnects existing users and can lose data. Before I run it, I confirm the target database, the preserved copies and that the business accepts the possible loss. I stop if setting EMERGENCY or SINGLE_USER fails.
USE master;
GO
ALTER DATABASE [YourDatabase] SET EMERGENCY;
ALTER DATABASE [YourDatabase] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GOOnly after the database is in the intended emergency and single-user state do I run the repair attempt:
DBCC CHECKDB (N'YourDatabase', REPAIR_ALLOW_DATA_LOSS)
WITH ALL_ERRORMSGS, NO_INFOMSGS;
GOSTOP. I continue only if CHECKDB completed successfully and a fresh state query confirms ONLINE. If repair fails, the state is not ONLINE, or further errors remain, I stop and escalate. A GO separator does not prevent later batches running after an error; I never select and execute this whole section at once.
USE master;
GO
SELECT name, state_desc, user_access_desc, recovery_model_desc
FROM sys.databases
WHERE name = N'YourDatabase';
GOAfter repair succeeds and the state is ONLINE, I check constraints in the repaired database. I keep application traffic controlled until I have reviewed the results. If USE fails because another connection holds the single-user session, I stop and identify that connection. I never run this check from another database. The guard below uses THROW, available in SQL Server 2012 and later. This check requires sysadmin or db_owner and does not prove complete physical or business consistency:
USE [YourDatabase];
GO
IF DB_NAME() <> N'YourDatabase'
BEGIN
;THROW 50000, N'Wrong database context. Stop; do not run the constraint check.', 1;
END;
DBCC CHECKCONSTRAINTS WITH ALL_CONSTRAINTS;
GOI review every violation and any application-level inconsistencies. Then I take a fresh full backup to a new, unique file, without an unconditional INIT overwrite option. A backup after repair preserves the resulting state; it does not certify that no data was lost:
USE master;
GO
BACKUP DATABASE [YourDatabase]
TO DISK = N'X:\Backups\post_repair_unique_full.bak'
WITH CHECKSUM;
GOI return the database to MULTI_USER only after I have reviewed the checks and the backup result and I am ready to let the application back in:
ALTER DATABASE [YourDatabase] SET MULTI_USER;
GOMicrosoft recommends restoring a known-good backup before repair, and documents the constraint-check syntax. REPAIR_FAST remains only for backward compatibility and performs no repair. If I reach this point, I get specialist help rather than treating the script as a guaranteed recovery method.
SQL Server Database "In Recovery" or "Restoring": Is It Stuck?
"In Recovery" is not the same as Recovery Pending. A database that shows In Recovery (the RECOVERING state) is working. SQL Server runs recovery when it starts a database after a restart or a crash, and the database stays unavailable until recovery finishes. If recovery succeeds, the database goes ONLINE on its own. If it fails, the database becomes SUSPECT.
What happens during recovery
Recovery has three phases:
- Analysis. SQL Server reads the transaction log from the last checkpoint to find out which transactions were open when it stopped.
- Redo. It replays committed changes that had not reached the data files.
- Undo. It rolls back the transactions that were still open.
Microsoft explains that recovery time is roughly proportional to the size of the longest transaction that was active when SQL Server stopped. A very large open transaction at the time of a crash means a long wait.
Check progress before acting
I do not restart the service to speed things up. Recovery has to run again at the next start, so a restart only adds to the wait. I look at progress first. This query needs VIEW SERVER STATE, or VIEW SERVER PERFORMANCE STATE on SQL Server 2022 and later:
SELECT
session_id,
command,
status,
percent_complete,
total_elapsed_time / 1000 AS elapsed_seconds
FROM sys.dm_exec_requests
WHERE percent_complete > 0;
GOMicrosoft lists RECOVERY, RESTORE DATABASE and ROLLBACK among the commands that report percent_complete. A percentage that keeps rising means the work is going on. If no row appears, I may lack that permission, or recovery may not be reporting a percentage. I check the permission first, then read the error log with the Step 1 query. When recovery finishes, SQL Server writes a message like this one from Microsoft's error 3414 page: "Recovery completed for database mydb (database ID 13) in 2 second(s) (analysis 204 ms, redo 25 ms, undo 1832 ms.) This is an informational message only. No user action is required." If the percentage has not moved for a long time, I bring in a second DBA before I restart anything.
Stuck in Restoring after a restore
A database that shows Restoring is a different case. If a restore used NORECOVERY and I have no more backups to apply, I finish it:
USE master;
GO
RESTORE DATABASE [YourDatabase] WITH RECOVERY;
GOI run this only when every backup I need has already been restored. After WITH RECOVERY, I cannot apply more log backups to that database. If a restore is still running, I use the progress query above and let it finish.
Warning: I do not run this on a log shipping secondary or a database mirroring mirror. A mirror database must stay in the RESTORING state for database mirroring to work. A log shipping secondary is waiting for the next log backup, and recovering it brings it online, which is a failover. Running WITH RECOVERY on either one takes it out of its role. I check whether the database is part of log shipping or mirroring first.
Faster recovery with Accelerated Database Recovery
Accelerated Database Recovery (ADR) was introduced in SQL Server 2019. It is off by default on SQL Server and always on in Azure SQL Database and Azure SQL Managed Instance. It makes recovery time much less dependent on long-running transactions. It does not speed up a recovery that is already running. I turn it on later, once the database is ONLINE, so the next recovery is faster. On SQL Server it is turned on for one database at a time:
ALTER DATABASE [YourDatabase] SET ACCELERATED_DATABASE_RECOVERY = ON;
GOTurning it on needs an exclusive lock on the database, so the command waits until active sessions are gone. Microsoft says the overhead ranges from not detectable to minor for most workloads, but it can be larger for write-heavy ones. I read Microsoft's ADR guide and test before I turn it on in production.
Rebuilding a Missing Transaction Log
If the error log shows the database cannot recover because the log file is missing or corrupt, it is tempting to "just rebuild the log." I am careful here: detaching a database (sp_detach_db) and taking it offline (ALTER DATABASE ... SET OFFLINE) are not the same operation, and rebuilding a log only works under strict conditions.
The supported path is CREATE DATABASE ... FOR ATTACH_REBUILD_LOG, and it requires that the database was cleanly shut down and that all data files (.mdf and .ndf) are present. It works only for read/write databases. If a log file is missing, SQL Server creates a new 1 MB log. This breaks the log backup chain, so take a full backup immediately afterward. If the shutdown was not clean, this path will not work, and I go back to restoring from backup. This example assumes the database is already unattached. I do not detach an attached Recovery Pending database just to make this command applicable. I choose the recovery path first.
USE master;
GO
CREATE DATABASE [YourDatabase]
ON (FILENAME = N'X:\Data\YourDatabase.mdf'),
(FILENAME = N'X:\Data\YourDatabase_2.ndf')
FOR ATTACH_REBUILD_LOG;
GOI treat this as a controlled salvage operation, not a routine fix. The older undocumented log-rebuild tricks are not safe in 2026, and I do not use them. And before I restart a server mid-incident, I remember that restarting SQL Server can destroy the evidence I need to find the real cause.
What I Never Do to a Recovery Pending Database
Under pressure, some shortcuts look tempting. These are the ones I leave alone.
- I do not detach the database. SQL Server refuses to detach a suspect database, and Microsoft warns that an error during a detach can stop the log from being rebuilt later.
- I do not delete or rename the log file to make SQL Server build a new one. That only works after a clean shutdown, and it breaks the log backup chain.
- When the disk is full, I do not delete files to make room. I free space the normal way, then read the error log again.
- I do not run a repair before I have copied the database files and tried a restore. A repair cannot be undone, but a copy of the files gives me a way back.
- I do not restart the SQL Server service to hurry recovery along. Recovery has to run again at the next start.
Does SQL Server 2025 Change This?
The honest answer: the fix itself has not changed. As of SQL Server 2025 (17.x), there is no new database state, no changed definition of Recovery Pending, and no new repair-first workflow. My guidance is still: read the error log, fix the root cause, restart, and restore before repair. (For everything new in the release itself, see our SQL Server 2025 overview. This section only covers what touches recovery.)
What has moved in the 2025 era is adjacent, and mostly preventive:
- Accelerated Database Recovery (ADR) was introduced in 2019 and improved in 2022 and 2025. It makes crash recovery and long rollbacks far faster, which can shorten the window where a database is stuck recovering. It is still off by default on on-premises SQL Server and always on in Azure SQL Database and Managed Instance.
- ADR in tempdb is new in 2025. It can now be set
ACCELERATED_DATABASE_RECOVERY = ONfor tempdb, which earlier versions did not allow. It needs an engine restart to take effect. - tempdb space resource governance is new in 2025. It caps tempdb consumption per workload group, which helps prevent a runaway query from exhausting tempdb, one of the resource-driven causes of startup trouble.
Recovery Pending on Azure SQL and Amazon RDS
The on-premises playbook (fix file permissions, rebuild the log, detach and attach, emergency-mode repair) largely does not apply on managed platforms. I use the platform's restore tooling instead.
- Azure SQL Database: there is no instance or file access. Recovery is a service operation, so I use point-in-time restore, deleted-database restore, long-term-retention restore, or geo-restore. Restores create a new database; I cannot overwrite an existing one. I cannot use Transact-SQL to recover from the automated backups.
- Azure SQL Managed Instance: closer to SQL Server, but
EMERGENCY,OFFLINE, andSINGLE_USERcannot be set, andDBCC CHECKDBREPAIR options cannot be used because the database cannot be put in single-user mode. I use the platform's restore options and escalate suspected corruption to Azure support. ADR is always on. - Amazon RDS for SQL Server: plain
ALTER DATABASE ... SET ONLINEis not the RDS method. AWS documentsEXEC rdsadmin.dbo.rds_set_database_online <database name>instead. For anything beyond that, I use RDS's own restore tools and escalate to AWS support.
The takeaway: on managed platforms, the missing-file and emergency-repair steps are off the table. Restore is not just the safest option; it is usually the only option, which is one more reason I keep backups safe and tested.
When to Stop and Call for Help
I stop and bring in a specialist when any of these is true:
- The database is SUSPECT, or the error log reports corruption.
- I have no restorable backup, or the tail-log backup fails.
- The data files are missing and there is no backup to restore from.
- The database is in an availability group, or it runs on a managed platform I do not control.
- A system database is affected, or the instance will not start.
- Anyone suggests
REPAIR_ALLOW_DATA_LOSS. For me that is the point to stop and decide with a specialist, not the next step. - Recovery has stopped making progress.
While I wait for help, I leave the files, the error log and the service as they are. I do not delete files or detach the database. If a backup of the corrupt files is possible, I make one before anyone repairs anything. For a case with no backups at all, see how to recover a corrupted SQL Server database without backups.
How to Keep It From Happening Again
- I watch free space on the data and log drives, and alert before they fill. Log growth is a common cause.
- I keep antivirus away from database and log files, following Microsoft's guidance. See our antivirus guide for SQL Server.
- I take regular backups and test a restore. A restore that has never been tried is a guess.
- I size the log file once and avoid many small autogrowths. Microsoft says too many virtual log files can make database startup and recovery take a long time.
Frequently Asked Questions
How do I bring a database online from Recovery Pending in SQL Server?
ALTER DATABASE [YourDB] SET ONLINE;. If it still will not come online, I restore from the last good backup before trying any repair.How do I check Recovery Pending status in SQL Server?
sys.databases and read state_desc: SELECT name, state_desc FROM sys.databases WHERE name = N'YourDB';. A value of RECOVERY_PENDING confirms the state.Is a Recovery Pending database damaged?
What is the difference between Recovery Pending and Suspect?
Can I just rebuild the transaction log to fix it?
CREATE DATABASE ... FOR ATTACH_REBUILD_LOG. It breaks the backup chain. I treat it as a salvage operation, not a first move. Restore from backup is safer whenever it is possible.Bottom Line
A SQL Server Recovery Pending database is usually recoverable, and the data is usually fine. My safe order is: read the error log, fix the root cause, bring the database online, and restore from backup before I ever run a repair. I save REPAIR_ALLOW_DATA_LOSS for the case where no backup exists and the business accepts the loss.
Most Recovery Pending incidents trace back to storage failures, memory pressure, or unmonitored log growth, problems that managed DBA services catch before a database drops offline. Red9 monitors client databases 24/7/365 and averages a 7.3-minute response when something breaks.
If a production database is down and the data matters, I would not work it alone. Red9's SQL Server consulting team handles emergency recovery, and we have brought databases back that everyone else had written off.
If a production SQL Server database is down and the cause is unclear, contact Red9's SQL Server Emergency Support.



