SQL Server Error 921: Database Not Recovered Yet
In this article
SQL Server error 921 means the database exists but is still in the recovery phase and cannot be opened yet. The fix is to wait for recovery to finish, then check that the database comes online; if it does not, investigate why recovery is stuck. In most cases the database is simply replaying the transaction log after a restart or restore, and the error clears on its own once that completes. The steps below show how to confirm that recovery is running, how to check its progress, and what to do if it never finishes.
What You'll Need
- Access to SQL Server Management Studio (SSMS) or another client that can run T-SQL queries.
- An account with permission to view server state (for example, a member of the sysadmin or serveradmin role, or VIEW SERVER STATE).
- Permission to read the SQL Server error log and, if needed, to restart the SQL Server service.
- Enough free disk space on the drive that holds the database files and the transaction log.
Step-by-Step
- Confirm the error is 921 and not a different state. Connect to the instance and run
SELECT name, state_desc FROM sys.databases WHERE name = 'YourDatabase';. If state_desc shows RECOVERY_PENDING or RECOVERING, the database is still rolling forward or rolling back transactions. That is the normal cause of error 921. If the state is something else, such as SUSPECT or OFFLINE, you have a different problem and should follow the guidance for that state instead. - Wait before doing anything else. Recovery time depends on how much log has to be replayed. A small database may recover in seconds; a large one with a long-running transaction open at the time of the restart can take minutes or longer. Do not detach, restore over, or force the database online during this window. Give it time and re-run the query from step 1 periodically.
- Check the SQL Server error log for progress. In SSMS, expand Management > SQL Server Logs and open the current log, or run
EXEC sp_readerrorlog;. Look for messages about recovery of the database, such as "Starting up database" and "Recovery is completed". If you see the start message but no completion message, recovery is still running. - Watch for blocking or long transactions. Run
SELECT session_id, command, wait_type, blocking_session_id FROM sys.dm_exec_requests WHERE command IN ('KILLED/ROLLBACK','ROLLBACK','RECOVERY');. A ROLLBACK that has been running a long time, especially one marked KILLED/ROLLBACK, will hold the database in recovery until it finishes. The only safe option is to let it complete; killing it again does not speed it up. - Verify disk space and I/O health. Recovery writes to the transaction log and the data files. If the log drive is full or the storage is responding slowly, recovery can stall. Check free space on the relevant volumes and confirm the storage subsystem is healthy before assuming SQL Server itself is at fault.
- Let recovery finish, then test the connection. Once the error log shows recovery completed, run the state query again. state_desc should read ONLINE. Try connecting to the database with the application that reported error 921. If it connects, no further action is needed.
- If recovery never completes, restart the SQL Server service once. A clean service restart gives the instance a fresh chance to finish recovery. Before restarting, note that any in-flight transactions will be rolled back and users will be disconnected. Use SQL Server Configuration Manager or the Services console, restart the SQL Server (MSSQLSERVER) service, then repeat steps 1 to 3.
- If the database remains stuck, restore from a known-good backup. This is destructive: the current database files will be replaced and any changes since the backup will be lost. Take a copy of the existing data and log files first if you may need them for investigation. Restore the most recent full backup, then any differential and log backups in sequence, and confirm the database comes online before returning it to users.
Common Mistakes
- Forcing the database online too early. Running EMERGENCY mode or similar recovery shortcuts while normal recovery is still in progress can leave the database in a worse state. Use those options only when you have confirmed recovery cannot complete and you understand the risk.
- Detaching or dropping the database to "clear" the error. This does not fix anything and can make the files harder to attach later, especially if the log is in an inconsistent state.
- Killing a rollback repeatedly. A session already in KILLED/ROLLBACK cannot be killed faster by issuing the command again. It must finish on its own.
- Ignoring disk space. A full transaction log drive is a common reason recovery appears to hang. Check space before assuming corruption.
- Restarting the service in a loop. Each restart begins recovery again. Repeated restarts can delay completion rather than help it.
Tips
- Record how long recovery takes on your system so you can tell the difference between "slow" and "stuck" next time.
- Keep transaction logs sized sensibly and back them up regularly; smaller logs mean shorter recovery after a restart.
- Avoid leaving long-running transactions open during maintenance windows or restarts.
- Monitor the error log after any unexpected shutdown so you notice recovery problems early.
- If the database is part of an Always On availability group, check the availability group dashboard as well; recovery behaviour can differ for secondary replicas.
Troubleshooting
If the database is still not online after waiting and one clean service restart, work through these checks in order. First, confirm the state with the sys.databases query and read the latest error log entries around the database name. Second, check for a long-running rollback using the sys.dm_exec_requests query; if one is present, let it finish. Third, verify free space on the log and data drives and check that the storage is responding normally. Fourth, confirm the SQL Server service account still has full control over the database and log folders; permission changes can prevent recovery from completing. Fifth, if the database is marked SUSPECT rather than RECOVERY_PENDING, treat it as a corruption issue and follow the standard suspect-database procedure, which usually ends in a restore. When in doubt, restore from backup rather than experimenting on the live files, and keep a copy of the original files for support or a specialist to examine.
Frequently Asked Questions
How long does error 921 usually last?
It lasts as long as recovery takes. That can be seconds for a small database with little log to replay, or much longer for a large database or one with a long transaction to roll back. There is no fixed time.
Can I force the database online to clear error 921?
You can, using emergency-mode recovery, but it is a last resort. It may leave the database in an inconsistent state and should only be used when normal recovery has failed and you have a recovery plan.
Does restarting SQL Server help?
Sometimes a single clean restart lets recovery complete. Repeated restarts do not help and can prolong the problem, because each restart begins recovery again.
Will error 921 fix itself?
In most cases, yes. Once recovery finishes, the database moves to ONLINE and the error stops. If it does not finish, the cause is usually a long rollback, low disk space or a storage problem.
Is error 921 the same as a suspect database?
No. Error 921 means recovery is still in progress. A suspect database is a different state that usually points to corruption or a failed recovery, and it needs a different response.
What should I check first?
Check the database state with the sys.databases query and read the SQL Server error log. Those two checks tell you whether recovery is running normally or has stalled.