Read time 3 min
Backup is the key to perform recovery of database objects after the corruption of the database file. SQL Server provides you with a number, Log Sequence Number (LSN), which during the process of database restoration is used as a recovery point.
LSN also helps you perform a differential backup. When you perform a differential backup, a bitmap corresponding to that backup is generated. All changes made during the backup are marked in that bitmap, otherwise, database errors are generated.
With the help of this differential backup, one can easily recover database objects from the damaged database. However, sometimes during the restoration process, you may receive the following error message:
Server: Msg 2515, Level 16, State 1
Page P_ID, object ID O_ID, index ID I_ID have been modified but are not marked modified in the differential backup bitmap.
It has a symbolic name DBDC_DIFF__MAP__OUT_OF_SYNC
Explanation of SQL error 2515
The error specifies that the page has a higher LSN compared to the differential reference LSN or the differential base LSN. But in the differential backup bitmap, the page is not shown as modified.
Solutions for SQL error 2515
This error is displayed when the change in LSN and differential base LSN in FCB or differential reference LSN in Backup Manager is not marked in the bitmap. It is not easy to restore the database which has been corrupted. The following steps can help you recover the database:
Check for hardware faults
If the issue arises due to some hardware-related reasons, it can easily be resolved by changing the hardware. You can check the system, application logs, and SQL error logs to find the exact issue. Then try changing the faulty hardware components or the entire hardware.
Restore from backup
If the SQL server notifies the error even after changing the hardware, then try to restore the database from a good backup available.
Run DBDC CHECKDB
If no useful backup available, run DBDC CHECHDB without a repair clause. It will help you assess the error situation and its magnitude. Later you can run the DBDC CHECKDB with this REPAIR clause to fix the issue. However, you should expect the possibility of data loss in this case.
Try SQL Recovery tools
Running the DBDC CHECKDB tool can cause data loss which is not desirable. To avoid such situations, there is an effective data recovery tool named Kernel for SQL Database Repair. It can repair corrupted MDF/NDF files of all sizes. It can perform a smooth recovery with the database files of all SQL versions.
We have discussed the SQL Server error with code “2515” which occurs during the restoration process via Log Sequence Number due to the absence of marking of differences between LSN and differential base LSN in the bitmap. Solutions for such conditions are provided like using backups, checking hardware faults, running DBBC CHECKDB commands, and lastly, using third-party SQL Server recovery tools. A reliable SQL Server Database Repair tool is recommended to all.