This differential backup cannot be restored because the database has not been restored to the correct earlier state

In this article, we are going to discuss how to solve the error which can occur during the restoration of a differential backup. Here is the error message:

Msg 3136, Level 16, State 1, Line 1
This differential backup cannot be restored because the database has not been restored to the correct earlier state.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

To understand why this error has happened and how to avoid this in future, let’s recreate this error message and discuss the solution.

Recreating – This differential backup cannot be restored because the database has not been restored to the correct earlier state

Let’s create database “Adventureworks” and apply the following backup database scenarios –  Full – Differential – Differential – Full – Differential

CREATE DATABASE Adventureworks
GO
USE Adventureworks
GO
CREATE TABLE Tab (i INT)
GO
BACKUP DATABASE Adventureworks TO DISK = 'D:\Adventureworks_Full_1.bak'
GO
INSERT INTO Tab VALUES (1)
GO
BACKUP DATABASE Adventureworks TO DISK = 'D:\Adventureworks_Diff_1.bak' WITH DIFFERENTIAL
GO
INSERT INTO Tab VALUES (2)
GO
BACKUP DATABASE Adventureworks TO DISK = 'D:\Adventureworks_Diff_2.bak' WITH DIFFERENTIAL
GO
INSERT INTO Tab VALUES (3)
GO
BACKUP DATABASE Adventureworks TO DISK = 'D:\Adventureworks_Full_2.bak'
GO
INSERT INTO Tab VALUES (4)
GO
BACKUP DATABASE Adventureworks TO DISK = 'D:\Adventureworks_Diff_3.bak' WITH DIFFERENTIAL
GO

Now we have the backup chain, where backups with the names Adventureworks_Diff_1 and Adventureworks_Diff_2 are valid for Adventureworks_Full_1 and Adventureworks_Diff_3 valid for Adventureworks_Full_2. It’s time to drop database Adventureworks and then restore Adventureworks_Diff_3 on top of Adventureworks_Fullf_1.

USE MASTER
GO
DROP DATABASE Adventureworks
GO
RESTORE DATABASE Adventureworks FROM DISK = 'D:\Adventureworks_Full_1.bak' WITH NORECOVERY
GO
RESTORE DATABASE Adventureworks FROM DISK = 'D:\Adventureworks_Diff_3.bak' WITH NORECOVERY
GO

After we will receive the following Error Message.

Msg 3136, Level 16, State 1, Line 1
This differential backup cannot be restored because the database has not been restored to the correct earlier state.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Solution – This differential backup cannot be restored because the database has not been restored to the correct earlier state

To solve this issue all we need to do is to restore backups without breaking the backup chain. It means that we need to restore the last full backup Adventureworks_Full_2 and then the last differential backup  Adventureworks_Diff_3. Check the command below:

RESTORE DATABASE Adventureworks FROM DISK = 'D:\Adventureworks_Full_2.bak' WITH NORECOVERY
GO
RESTORE DATABASE Adventureworks FROM DISK = 'D:\Adventureworks_Diff_3.bak' WITH NORECOVERY
GO

Here what we received

This differential backup cannot be restored because the database has not been restored to the correct earlier state

To avoid this error message in the future we highly recommend you to use SqlBak tool. SqlBak can create scheduled backup, send them to selected destination place and all restore backups! Here you can find the short tutorial how to create automatical backups and how to restore them.

[Total: 2    Average: 5/5]

2 thoughts on “This differential backup cannot be restored because the database has not been restored to the correct earlier state

  1. I have a two backup files
    1) Demo.bak
    2)DemoDiff.bak

    I want to restore the Base database (Demo.bak) then Differential backup (DemoDiff.bak).
    As I need to restore the differential database then I have to restore my base database with NORECOVERY option. But, when I restore with NORECOVERY option the database state is showing as ‘Restoring’ for a long time (Actually it as only 3519 KB size).

    Can anyone help me out from this?

Leave a Reply

Your email address will not be published. Required fields are marked *