NetBackup for Microsoft SQL Server restore fails with the message "This differential backup cannot be restored because the database has not been restored to the correct earlier state"

NetBackup for Microsoft SQL Server restore fails with the message "This differential backup cannot be restored because the database has not been restored to the correct earlier state"

Article: 100020892
Last Published: 2025-04-16
Ratings: 2 3
Product(s): NetBackup & Alta Data Protection

Problem

When performing an MS SQL database restore of full and differential backups, the differential restore fails with the message referenced below.  

This problem can occur if SQL backups are executed independently of NetBackup.  For example, if native SQL Server backups are initiated by database administrators or if some other backup software is in use.  If those backups are taken without the SQL Server 'COPY_ONLY' option, it will result in what appears to be a break in the log chain from NetBackup's perspective.

For general background, refer to:

SQL Server transaction log architecture and management guide:
https://learn.microsoft.com/en-us/sql/relational-databases/sql-server-transaction-log-architecture-and-management-guide?view=sql-server-ver16

See the section titled 'The log chain'

Error Message:

DBMS MSG - ODBC return code <-x>, SQL State <37000>, SQL Message <3136><[Microsoft][SQL Native Client][SQL Server]This differential backup cannot be restored because the database has not been restored to the correct earlier state.>.

 

Solution

In most cases, the restore can be completed as follows:

Step 1:
The SQL database administrators, working with Microsoft if necessary, should determine an appropriate query to use to view the current log chain of the database in question.

Consider the following example query result:

Note that the first 4 backups are all taken by NetBackup and that the first 3 differentials all "refer back" to the original database first_lsn of 41000000005600064 (blue highlights.)  The 5th backup is done independently of NetBackup using a native SQL backup to disk.  This effectively creates what appears to be a break in the log chain from NetBackup's perspective.  Note that the database first_lsn has changed.  It is now 41000000020000037 (red highlights.)

Step 2:
The SQL database administrators must restore the most recent "non-NetBackup" full using the "WITH NORECOVERY" SQL server option.  In this example, it is the backup on line 5 that went to 'C:\temp\sql_native_full.bak.'

Step 3:
After the restore from step 2 is completed, create a batch file for the differential restore using the NetBackup MS SQL Client GUI on the client as outlined here:

Restore a SQL Server database backup (NetBackup MS SQL Client)
https://www.veritas.com/support/en_US/doc/166028765-166029491-0/id-SF930816958-166029491
 

Modify the batch file by removing the lines corresponding to the full restore and retaining the lines corresponding to the desired differential restore.  For example:

 

Step 4:
Execute the batch file that was created and modified in step 3.

The restore should be successful provided that there has been no other activity which may have adversely affected the log chain.

 

 

Was this content helpful?