"An error occurred on a query to database <databasename>.- Cannot apply the backup on device '<database GUID>' to database '<databasename>'. "

Article:TECH37653  |  Created: 2005-01-04  |  Updated: 2014-01-14  |  Article URL http://www.symantec.com/docs/TECH37653
Article Type
Technical Solution

Product(s)

Issue



An error occurred on a query to database <databasename>.- Cannot apply the backup on device '<database GUID>' to database '<databasename>'.


Error



An error occurred on a query to database <databasename>.- Cannot apply the backup on device '<database GUID>' to database '<databasename>'.


Environment



SQL 2000.


Cause



This error will occur during a differential restore of a SQL 2000 Database using the Backup Exec SQL Agent if the Log Sequence Number (LSN) does not match the LSN of the backup set used for the full database restore performed initially. Event ID 57859 will be logged in the Application Event Viewer Log (Figure 1).

The LSN mismatch is caused by another full backup of the same SQL database being performed after the original full backup but before the differential backup occurs.

Example:

Backup Exec is configured to protect SQL Database "A" with a full backup every Friday night and a differential backup every Monday through Thursday night. Simultaneously, SQL is configured to perform full database backups nightly within a SQL Maintenance package. This backup is completely independent of the jobs configured within Backup Exec. Should a restore be required, the full SQL database backup performed in Backup Exec will be able to restore successfully. However, every restore from a differential backup performed in Backup Exec fails with the error above. Because the Backup Exec SQL Agent makes the same API calls that SQL does to back up the databases, the LSN of the Backup Exec differential backup is no longer in sequence with the LSN of the full performed by Backup Exec due to the nightly full backups being performed in SQL Server 2000.

Figure 1
 

 


Solution



Make sure the differential backup is paired up with the most current full backup taken prior to the differential backup.

 

Supplemental Materials

SourceEvent ID
Value57859
Description

An error occurred while executing the following query: "RESTORE DATABASE [Databasename] FROM virtual_device= 'Database_GUID' WITH REPLACE, NORECOVERY".



Legacy ID



275542


Article URL http://www.symantec.com/docs/TECH37653


Terms of use for this information are found in Legal Notices