What
You attempt to restore a transaction log and you receive an
error similar to the following:
Server: Msg 4305, Level 16, State 1, Line 1
The log in this backup set begins at LSN 188000000107200001,
which is too late to apply to the database. An earlier log backup
that includes LSN 188000000105900001 can be restored.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally. |
How
There are one or more transaction log backups that need to be
restored before the current transaction log backup. In the
example above, you will need to first restore a transaction log
backup that contains LSN 188000000105900001.
If you have access to the server where the backup was made, and
assuming that the backup and restore history tables still contain the
data, you can run the following query to list out the transaction
log backups that need to be restored in sequence (replace the
database name with your database name):
SELECT b.physical_device_name, a.backup_start_date
FROM msdb..backupset a
INNER JOIN msdb..backupmediafamily b ON a.media_set_id =
b.media_set_id
WHERE a.database_name = 'pubs'
AND a.type = 'L'
AND a.first_lsn <= 188000000105900001
AND a.last_lsn >= 188000000105900001
UNION ALL
SELECT b.physical_device_name, a.backup_start_date
FROM msdb..backupset a
INNER JOIN msdb..backupmediafamily b ON a.media_set_id =
b.media_set_id
WHERE a.database_name = 'pubs'
AND a.type = 'L'
AND a.first_lsn > 188000000105900001
ORDER BY 2
|
If you do not have access to the backup history tables, or if
the data has been purged, you'll need to inspect the header of each
backup file in find out the LSNs that are contained therein
e.g.
RESTORE HEADERONLY FROM DISK =
'g:\backups\pubs_log_20080521 1020.bak' |
You will need to start restoring from the backup set where LSN
188000000105900001is backed up in. You use the FirstLsn and
LastLsn values for reference.
Document history
7/24/2008 | Initial release. |