SQL Server Log Explorer
SQL Backup & Restore

SQL Server Database Stuck in Restoring State (4 Fixes)

Andrew Jackson Modified: 7 Minutes Reading
On this page

Quick Answer

SQL Server database stuck in restoring state means your last restore used NORECOVERY and SQL Server expects more backups. You get 4 fixes. Apply the remaining log or differential backups first. Execute RESTORE DATABASE WITH RECOVERY when no backup remains. Restart the sequence with REPLACE when the restore went wrong. Check the role of the database before you recover it because a log shipping secondary waits for backups by design. Our test showed WITH RECOVERY ends the sequence and a later RESTORE LOG fails with Msg 3117.

Your database shows Restoring in SSMS and every query fails. It looks like a broken restore but SQL Server is waiting for your next step.

This guide shows how to read the state, which of the 4 fixes fits your backups and what you give up with every fix. We executed the T-SQL on a real database so the errors below are the ones you will see.

Why is Your Database in the Restoring State?

Microsoft states a database in the RESTORING state is unavailable while files are being restored. Microsoft also states NORECOVERY puts the database in the restoring state so more backups can follow.

Cause How to check What to do
Your last restore used NORECOVERY and no backup remains The last row of restorehistory shows recovery as 0 Use Fix #1
Log or differential backups still wait to restore The backup history of the source database lists backups after your full backup Use Fix #2
The restore sequence broke or you restored the wrong full backup An error stopped a RESTORE statement Use Fix #3
The database is a log shipping secondary Your team set it up with NORECOVERY on purpose Use Fix #4
A file restore is in progress Microsoft lists files of the primary filegroup restoring as a RESTORING cause Finish the file restore

Check the state and the last restore with these statements.

SELECT name, state_desc FROM sys.databases WHERE state_desc = N'RESTORING';

SELECT TOP (5) destination_database_name, restore_type, recovery, restore_date, user_name
FROM msdb.dbo.restorehistory
WHERE destination_database_name = N'YourDB'
ORDER BY restore_history_id DESC;

Our test restored a full backup with NORECOVERY. sys.databases showed RESTORING and MULTI_USER. The restorehistory row showed restore_type D and recovery False.

What Errors Show Up on a Restoring Database?

Statement Result on our test server
SELECT from the restoring database Msg 927. The database cannot be opened because it is in the middle of a restore
RESTORE DATABASE WITH RECOVERY after the full backup only The database came ONLINE
SELECT on a table created after the full backup Msg 208. The object name is invalid because the table exists only in the log backup
RESTORE LOG after the WITH RECOVERY statement Msg 3117 because no files are ready to rollforward, followed by Msg 3013
Full backup with NORECOVERY then the log backup with RECOVERY The database came ONLINE with all 3 rows

RECOVERY rolls back uncommitted transactions and closes the sequence. Microsoft states you cannot restore more backups afterwards. Our test confirms it because the table from the log backup was missing until we started the sequence again.

Our SQL Server error 3117 guide covers that message in full.

Permissions and Versions for These Fixes

System Specifications

Component Requirement
Restore permission Microsoft states RESTORE rights default to sysadmin, dbcreator and the database owner. The db_owner role has no RESTORE rights by default. We executed every test as sysadmin
Disk space Free space for a second copy of the database when you restart with REPLACE
Backups The full backup and every log backup after it, in creation order

Software Specifications

Item Requirement
RECOVERY and NORECOVERY options Microsoft documents both on the RESTORE arguments page. We tested on SQL Server 2022 (RTM CU26) Express on Linux
Tools SSMS or any client that sends T-SQL. All fixes below use T-SQL

How do You Fix a Database Stuck in the Restoring State?

Fix #1: Recover the Database When No Backup Remains (Free, Ends the Sequence)

Use this fix after you applied every backup you own. Microsoft states a RESTORE DATABASE WITH RECOVERY statement without a FROM clause restores nothing and only recovers the database.

RESTORE DATABASE [YourDB] WITH RECOVERY;

Our test executed this statement and the database moved from RESTORING to ONLINE. The statement is final. No log backup can follow it.

Heads Up

Confirm that no log or differential backup exists after your full backup before you execute Fix #1.

Fix #2: Apply the Remaining Backups First (Free, No Data Loss)

Use this fix when backups exist after your full backup. List them from the backup history of the source server.

SELECT bs.backup_finish_date,
 CASE bs.type WHEN 'D' THEN 'Full' WHEN 'I' THEN 'Differential' WHEN 'L' THEN 'Log' END AS backup_type,
 bmf.physical_device_name
FROM msdb.dbo.backupset bs
JOIN msdb.dbo.backupmediafamily bmf ON bs.media_set_id = bmf.media_set_id
WHERE bs.database_name = N'YourDB'
ORDER BY bs.backup_finish_date DESC;

Our test returned a full and a log backup with their file paths. Restore every log backup in order with NORECOVERY and finish with RECOVERY. Microsoft recommends NORECOVERY on every statement and a separate RECOVERY statement at the end.

RESTORE LOG [YourDB] FROM DISK = N'D:\Backups\YourDB_log1.trn' WITH NORECOVERY;
RESTORE LOG [YourDB] FROM DISK = N'D:\Backups\YourDB_log2.trn' WITH NORECOVERY;
RESTORE DATABASE [YourDB] WITH RECOVERY;

Our NORECOVERY option guide shows the full sequence with a differential backup.

Fix #3: Restart the Restore With REPLACE (Free, Overwrites the Copy)

Use this fix when an error broke the sequence or you restored the wrong full backup. REPLACE overwrites the database that already exists under that name.

RESTORE DATABASE [YourDB] FROM DISK = N'D:\Backups\YourDB_full.bak'
WITH NORECOVERY, REPLACE,
MOVE N'YourDB' TO N'D:\Data\YourDB.mdf',
MOVE N'YourDB_log' TO N'D:\Data\YourDB.ldf';

Our test executed this statement over an existing copy and finished with a log restore WITH RECOVERY. The copy returned all 3 rows.

Heads Up

Use REPLACE only on a copy or on a database you can lose. Take a tail log backup first if the live database contains data you still need.

Fix #4: Check Whether the State Is Intended (Free, No Change)

A log shipping secondary restored with NORECOVERY waits for the next log backup by design. Microsoft names NORECOVERY as the way to apply more backups later. Recovering that database breaks the chain and the secondary needs a fresh restore.

Ask your team before you recover a database that you did not restore yourself. Our log shipping guide shows how the secondary works.

How do You Avoid the Restoring State Next Time?

  • Use NORECOVERY only when another backup follows. Microsoft recommends a separate RECOVERY statement to finish the sequence.
  • Check state_desc after the restore. A restored database must show ONLINE before you tell your users.
  • Write down the backup chain. The msdb query above lists it in seconds.
  • Test the restore on a copy. Use MOVE for both files and check the row counts.

Our database in recovery state guide covers the different RECOVERING state.

FAQs

How do You Check if a Database is Stuck in the Restoring State?

Query sys.databases for state_desc equal to RESTORING. Then read the last rows of msdb.dbo.restorehistory for that database. A recovery value of 0 means the last restore used NORECOVERY.

Can You Query a Database in the Restoring State?

No. Our SELECT returned Msg 927. Microsoft states the STANDBY option leaves the database readable between restores.

Is RESTORE DATABASE WITH RECOVERY Safe?

Yes when you applied every backup. No when more log backups exist because the database accepts no backup afterwards. Our later RESTORE LOG returned Msg 3117.

Why Does RESTORE LOG Fail With Msg 3117 After WITH RECOVERY?

RECOVERY closes the sequence so no restore is ready to roll forward. Restart from the full backup with NORECOVERY and apply the log backups again.

Which Permission do You Need to Fix a Restoring Database?

You need RESTORE rights. Microsoft states they default to sysadmin, dbcreator and the database owner.

About this guide

We checked this guide against Microsoft documentation on 1 Dec 2026. We executed the statements of Fixes #1 to #3 on SQL Server 2022 (RTM CU26) Express on Linux.

Microsoft documents the options on its RESTORE arguments page and the states on its database states page.