Fix SQL Server Database in RECOVERY PENDING State
Your SQL Server has started but cannot begin the database recovery process. This guide walks you through every diagnostic step — from reading the error log to running emergency-mode repair — so you can get your data back online fast.
What Does RECOVERY PENDING Mean?
When SQL Server restarts — whether after a planned shutdown, a power failure, or a server crash — it must run a process called database recovery for every database. Recovery replays committed transactions from the transaction log and rolls back uncommitted ones, ensuring the database reaches a consistent, trustworthy state before it is made available to users.
The RECOVERY PENDING state means SQL Server has acknowledged the database exists and has begun to prepare for recovery, but it has hit an obstacle that prevents recovery from even starting. This is a pre-recovery failure, not a mid-recovery failure. The engine knows the database is there — it just cannot open or process the files needed to begin the recovery sequence.
The database is completely inaccessible in this state. Any attempt to query it or access it through SSMS will return an error such as: Msg 945, Level 14, State 2 — Database cannot be opened due to inaccessible files or insufficient memory or disk space.
Common Causes of RECOVERY PENDING
Understanding the root cause is essential before attempting any repair. RECOVERY PENDING is triggered by one or more of the following conditions:
Log File (.LDF) Is Missing or Has Been Moved
The most common cause. If the transaction log file has been deleted, moved to a different drive, or renamed while SQL Server was offline, the engine cannot find it at the registered path and immediately places the database in RECOVERY PENDING. The same applies to the primary data file (.MDF) if it is unavailable.
Zero Disk Space on the Log File Drive
SQL Server needs to write log records even during the recovery process itself. If the volume hosting the .LDF file has no free space, SQL Server cannot create or extend the log file and will refuse to begin recovery, leaving the database in RECOVERY PENDING until space is freed.
NTFS Permissions on MDF/LDF Files
If the SQL Server service account loses read/write permission on the data or log files — often after an OS upgrade, domain policy change, or manual permission reset — it cannot open those files and the database enters RECOVERY PENDING. This is a silent killer: the files are physically intact, but inaccessible to the service.
SQL Server Service Account Change
When the SQL Server service account is changed without properly granting the new account access to the database files and directories, SQL Server starts successfully but cannot open the specific database files owned by the old account. This results in RECOVERY PENDING for affected databases.
RECOVERY PENDING means recovery has not yet started due to a resource problem (missing file, no disk space, bad permissions). SUSPECT means recovery started but failed mid-way, usually due to a corrupt log file or torn data page. The fixes are different — never apply a SUSPECT fix to a RECOVERY PENDING database without first identifying the actual cause.
Step-by-Step Fix for RECOVERY PENDING
Work through these steps in order. Steps 1–4 address the most common non-corrupt causes. Steps 5–6 are for situations where the files are physically damaged.
Step A — Check the SQL Server Error Log
The SQL Server Error Log is your single most valuable diagnostic tool. It will tell you exactly why recovery cannot start. Open SSMS, navigate to Management → SQL Server Logs → Current, or run the following T-SQL:
-- Read the SQL Server Error Log (most recent 200 entries) EXEC xp_readerrorlog 0, 1, N'RECOVERY PENDING'; EXEC xp_readerrorlog 0, 1, N'Error'; EXEC xp_readerrorlog 0, 1, N'cannot be opened';
Look for messages mentioning your database name, file paths, access denied errors, or disk full warnings. This message will guide everything that follows.
Step B — Verify File Paths in sys.master_files
Confirm what file paths SQL Server has registered for the affected database and then manually verify those files exist on disk at exactly those paths:
-- Check registered file paths for all databases SELECT DB_NAME(database_id) AS DatabaseName, name AS LogicalName, physical_name AS PhysicalPath, type_desc AS FileType, state_desc AS [State] FROM sys.master_files WHERE state_desc = N'RECOVERY_PENDING' ORDER BY database_id;
Open Windows Explorer and navigate to each path shown in PhysicalPath. If a file is missing, restore it from backup or use Data Repair Pro to attach with only the MDF. If the path is simply wrong (file was moved), update it with ALTER DATABASE … MODIFY FILE while the database is offline.
Step C — Fix NTFS Permissions on Data and Log Files
If the error log reports an access denied error, grant the SQL Server service account full control. Open a Command Prompt as Administrator and run:
-- Replace paths and service account as needed icacls "D:\SQLData\YourDatabase.mdf" /grant "NT SERVICE\MSSQLSERVER:(F)" icacls "D:\SQLLogs\YourDatabase_log.ldf" /grant "NT SERVICE\MSSQLSERVER:(F)" -- If you use a named instance, replace MSSQLSERVER with the instance name: icacls "D:\SQLData\YourDatabase.mdf" /grant "NT SERVICE\MSSQL$INSTANCENAME:(F)"
After granting permissions, restart the SQL Server service via SSMS or Services.msc. The database should come ONLINE automatically if permissions were the only cause.
Step D — Free Disk Space on the Log File Volume
If the drive hosting the .LDF file is full, use Windows Disk Cleanup, delete unnecessary files, or move the transaction log to a volume with sufficient free space. As a minimum, the log volume needs at least 10–20% free space of the current log file size, plus room to grow. After freeing space, restart SQL Server. You do not need to run any T-SQL — SQL Server will automatically retry recovery on restart.
Step E — Set to EMERGENCY Mode (If Files Are Corrupt)
If steps A–D did not resolve the issue and the error log indicates file corruption, you can force the database into EMERGENCY mode. This bypasses the normal recovery sequence and opens the database in a read-only, restricted state, allowing you to extract data:
-- Force EMERGENCY mode (run in master context) ALTER DATABASE [YourDatabaseName] SET EMERGENCY; GO -- Verify state SELECT name, state_desc FROM sys.databases WHERE name = N'YourDatabaseName';
Warning: EMERGENCY mode should only be used when the database files are present but damaged, and only after all non-corrupt remedies have been exhausted. Do not attempt writes in this mode.
Step F — Run DBCC CHECKDB Repair
Once in EMERGENCY mode, set the database to SINGLE_USER and run DBCC CHECKDB. Use REPAIR_REBUILD first; escalate to REPAIR_ALLOW_DATA_LOSS only if necessary, as it may discard some data:
-- Step 1: Switch to single-user mode ALTER DATABASE [YourDatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; GO -- Step 2: Try non-destructive repair first DBCC CHECKDB (N'YourDatabaseName', REPAIR_REBUILD) WITH NO_INFOMSGS; GO -- Step 3: If errors remain, allow data loss repair (LAST RESORT) DBCC CHECKDB (N'YourDatabaseName', REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS; GO -- Step 4: Bring back to MULTI_USER ALTER DATABASE [YourDatabaseName] SET MULTI_USER; GO
Skip the T-SQL — Use Data Repair Pro
Data Repair Pro automates every step above through a point-and-click wizard. Connect to your SQL Server, select the RECOVERY PENDING database, and let the tool diagnose the cause, apply the correct fix, and bring the database back online — without writing a single line of T-SQL.
Free Download — Windows~12 MB · Windows 10/11 (64-bit) · SQL Server 2012–2025
FAQ: RECOVERY PENDING vs. SUSPECT vs. OFFLINE
These three database states are often confused with each other. Here is a precise comparison to help you understand what each state means and how to respond:
| State | When It Occurs | Recovery Started? | Typical Cause | First Action |
|---|---|---|---|---|
| RECOVERY PENDING | SQL Server can't begin recovery at all | No | Missing file, no disk space, bad permissions | Check error log, fix resource issue |
| SUSPECT | Recovery started but failed partway through | Yes, but failed | Corrupt log or data pages, torn pages | EMERGENCY mode + DBCC CHECKDB |
| OFFLINE | Database was taken offline intentionally or by admin | N/A | ALTER DATABASE SET OFFLINE or SQL Agent job | ALTER DATABASE SET ONLINE |
Can RECOVERY PENDING cause data loss?
If the root cause is a missing or moved file, and you locate and restore that file correctly, there should be zero data loss. Data loss only occurs if you use REPAIR_ALLOW_DATA_LOSS during DBCC CHECKDB on a genuinely corrupt database. Always exhaust non-destructive options first.
What if the .LDF file is completely missing and I have no backup?
This is where Data Repair Pro shines. It can attach an MDF file without a corresponding LDF file, reconstructing a minimal log automatically so the database can be brought online. Alternatively, use SSMS's "Attach Database" wizard and remove the LDF file from the file list — SQL Server will create a new log file, but this only works if the MDF is consistent.
How long does RECOVERY PENDING last?
RECOVERY PENDING is a permanent state — it does not resolve automatically. SQL Server will not retry recovery without either a service restart (after the resource problem is fixed) or an explicit ALTER DATABASE command. The database will remain in RECOVERY PENDING indefinitely until you intervene.
Can I use EMERGENCY mode on a RECOVERY PENDING database?
Yes. If the underlying files are present and the issue is internal corruption rather than a missing resource, you can run ALTER DATABASE SET EMERGENCY even while the database is in RECOVERY PENDING state. This forces the engine past the recovery block and gives you read access for data extraction.
Data Repair Pro includes a dedicated RECOVERY PENDING Wizard that automatically reads your error log, identifies the root cause, applies the correct fix (permissions, disk space alert, emergency mode, or DBCC repair), and documents each action taken — so you have a full audit trail. Download it free today.