Hi there,
I have two Maintenance Plans:
1) FullBackup
daily at 0:00, once
containing a Cleanup Task, that deletes files older than 3 days (.bak)
2) TransactionlogBackup
daily at 02:00, every 5 minutes
containing a Cleanup Task, that deletes files older than 28hours (.trn)
We tried to restore the database with a script that restores the latest backup and all transactionlogbackups after the latest full backup (based on file names - created by maintenance plans)
RESTORE DATABASE myDB
FROM DISK = 'myDB_backup_2013_02_25_020650_0593957.bak'
WITH NORECOVERY, REPLACE
RESTORE LOG myDB FROM DISK = 'myDB_backup_2013_02_25_020701_7750708.trn' WITH NORECOVERY
RESTORE LOG myDB FROM DISK = 'myDB_backup_2013_02_25_021200_9225884.trn' WITH NORECOVERY
RESTORE LOG myDB FROM DISK = 'myDB_backup_2013_02_25_021701_0217121.trn' WITH NORECOVERY
RESTORE LOG myDB FROM DISK = 'myDB_backup_2013_02_25_022201_2144364.trn' WITH NORECOVERY
RESTORE LOG myDB FROM DISK = 'myDB_backup_2013_02_25_022701_3603604.trn' WITH NORECOVERY
The error message we got was:
Msg 4326, Level 16, State 1, Line 2
The log in this backup set terminates at LSN 1240260000002439200001, which is too early to apply to the database. A more recent log backup that includes LSN 1240260000002500200001 can be restored.
Msg 3013, Level 16, State 1, Line 2
RESTORE LOG is terminating abnormally.
when I went to "SSMS, SAPBPC-database>Tasks>Backup>Restore Backup" I got a different order for restoring:
RESTORE LOG [myDB] FROM DISK = N'myDB_backup_2013_02_25_021200_9225884.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10 GO RESTORE LOG [myDB] FROM DISK = N'myDB_backup_2013_02_25_021701_0217121.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10 GO RESTORE LOG [myDB] FROM DISK = N'myDB_backup_2013_02_25_022201_2144364.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10 GO RESTORE DATABASE [myDB] FROM DISK = N'myDB_backup_2013_02_25_020650_0593957.bak' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10 GO RESTORE LOG [myDB] FROM DISK = N'myDB_backup_2013_02_25_022701_3603604.trn' WITH FILE = 1, NORECOVERY, NOUNLOAD, STATS = 10
This happened again the day after.
I have tried to reproduce that in my local machine(2 maint plans), but the script works fine (first .bak then .trn files based on filenames) - regardless whether transactionlog backup plan starts before a full backup and regardless of multiple fullbackups and regardless of whether a transaction runs while fullbackup starts (letting transactionlog, its backup and start of full backup overlap).
Could it be that the cleanup task is destroying anything in the log chain? Could it be that using the script based on filenames is no good idea?!
Should the transactionlog backup and the full backup rather be in one maintenance plan than split into two (with different cleanup tasks)?
I haven't tried the restore with GUI ( I may not...)
thanks,
lightning
-------------------------
Version used:
Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)
Jun 28 2012 08:36:30
Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64>
(Build 7601: Service Pack 1)