June 25, 2014 at 4:45 am
Hi,
I have a database which has one full back and 3 transaction log backups which were taken straight after the full backup.
As a test, before taking each transaction log backup I made a slight change to my data.
I then go onto my second SQL Server instance and do a restore of the full back and with no recovery.
This works fine.
Then I do a restore using a transaction log.
If I restore using the first transaction log out of the 3 (i.e. - the T log which was backed up straight after the full backup) then it restores my database successfully with the data.
If I try to restore using the 2nd or 3rd transaction log files it shows the message:-
System.Data.SqlClient.SqlError: The log in this backup set terminates at LSN 30000000010700001, which is too early to apply to the database. A more recent log backup that includes LSN 30000000013400001 can be restored.
So how can I get around this problem and restore my database using the 2nd or 3rd transaction log files?
My database has a Recovery Model of FULL.
Thanks.
June 25, 2014 at 4:52 am
You have to restore all log backups in the chain, not just the most recent. So if you want to bring the database to the latest point possible using the backups you have, you need to restore the full backup with norecovery, then the first log backup with norecovery, then the second, then the third. You can run RESTORE DATABASE MyDB WITH RECOVERY at the very end.
John
June 25, 2014 at 4:59 am
I see.
I'll give it a try, thanks.
June 25, 2014 at 5:06 am
Was just wondering, is there no way for me to specify a specific date and time while doing the restore.
If for example I had 40 transaction log backups and wanted the latest log to be restored does this mean I would have to restore 39 transaction logs with norecovery (which were backed up previously) before I could reach the one I want?
Is there not a quicker way of doing this instead of going through and restoring one at a time?
June 25, 2014 at 5:10 am
Yes, it does mean that. If that's going to be a problem for you, consider taking differential backups. These backup every page (or maybe extent) that has been altered since the last full backup. So your recovery plan would then be: restore full with norecovery, restore latest diff with no recovery, restore all log backups since latest diff with no recovery, recover database.
John
June 25, 2014 at 5:30 am
Apologies for all the questions but what if the transaction logs backups were not generating a new file each time the backup takes place.
But instead appending the existing .trn file.
This would mean I would only have one file containing all of my T log backups in it.
Would I then be able to backup all of the transaction logs in one restore using this method?
Also on this note how can I change the settings to either generate a new log file each time the backup takes place or to keep the same file?
Thanks.
June 25, 2014 at 5:33 am
I wrote an article [/url]a while back here on SQL Server Central that covers a lot of the questions here.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
June 25, 2014 at 5:40 am
Grant's link doesn't work (for me, anyway), so I'll attempt to answer your questions briefly (although you probably could answer them yourself with a bit of search engine magic).
First, no, you still have to restore them one by one. Check out the RESTORE documentation for the syntax for multiple backup sets on one device.
Second, it depends how you're doing your backups in the first place. Check out the BACKUP documentation, use maintenance plans or try Ola Hallengren's universally acclaimed scripts.
John
June 25, 2014 at 5:59 am
Weird. Not sure why that's not coming up. Here's another one from Jonathan Kehayias[/url].
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
June 25, 2014 at 6:54 am
Thanks guys for your answers.
I'll have a read through that article (I can see it).
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply