Hi Folks,
Hope you can help... I have a database running on Microsoft SQL Server 2008 R2 (SP1) that has been happily log shipping to standby (along with a bunch of others) for 5 years. Occasionally a user or developer will screw up and need the primary to be restored from backup at which point I'll disable the log shipping, do the primary restore and then re-enable the log shipping with a full backup. I've never run into any issues before.
Yesterday I needed to restore a backup from a couple of days previous. When I re-enable the log shipping the database backs up and restores fine, the scheduled backup, copy and restore jobs are created and both the backup and copy jobs work fine. However the tran log restore job is failing. It's skipping old tran log files as expected, then finding one that it verifies, tries to apply, then fails as the tran log is from before this restore. I can manually apply logs from after the restore with no issues, but I can't get the LSrestore/sqllogship.exe job to skip further than this particular old log and start applying logs from the correct point.
Log msgs:
"Error: Could not apply log backup file <old log file name> to secondary database <databasename>"
"This backup set cannot be applied because it is on a recovery path that is inconsistant with the database."
"The log backup file was verified but could not be applied to secondary database <databasename>."
So far I've tried simply renaming the offending log to move it out of the way but then it fails saying it can't find it.
I also tried setting the primary database to simple recovery then back to full recovery, followed by dumping the log then running the re-enable/restore again. No joy.
I've deleted the database at the standby side to remove the history. No joy.
Does anyone have any ideas? I've hunted high and low for information on where the restore is getting the restore sequence from but either I'm not understanding it or not finding it. Yes, I'm looking through BOL... Everything I'm reading suggests that a full backup/restore ought to start the sequence from the correct point.
Any help greatly appreciated!
A bit more info... (I've masked the path/filenames)
This is the old log it's failing on:
restore headeronly from disk ='xxxxxx_20160105101505.trn'
FirstLSN LastLSN ChkptLSN DBBkpLSN
387176000001509900001 387177000000060200001 387176000001503100144 387176000001503100144
this is the new backup and subsequent logs
restore headeronly from disk = 'xxxxxx.bak'
387176000001915300040 387176000001916900001 387176000001915300040 387176000001912700040
restore headeronly from disk ='xxxxxx_20160106151504.trn'
387176000001917700001 387176000001917700001 387176000001915300040 387176000001915300040
restore headeronly from disk ='xxxxxx_20160106153004.trn'
387176000001917700001 387176000001917700001 387176000001915300040 387176000001915300040
restore headeronly from disk ='xxxxxx_20160106154504.trn'
387176000001917700001 387176000001917700001 387176000001915300040 387176000001915300040
After checkpoint on primary...
387176000001918700001 387176000001921700001 387176000001918700070 387176000001915300040