Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Problems doing point in time recovery


Problems doing point in time recovery

Author
Message
navtec
navtec
SSC-Enthusiastic
SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)

Group: General Forum Members
Points: 112 Visits: 298
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.
John Mitchell-245523
John Mitchell-245523
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7502 Visits: 15159
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
navtec
navtec
SSC-Enthusiastic
SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)

Group: General Forum Members
Points: 112 Visits: 298
I see.

I'll give it a try, thanks.
navtec
navtec
SSC-Enthusiastic
SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)

Group: General Forum Members
Points: 112 Visits: 298
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?
John Mitchell-245523
John Mitchell-245523
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7502 Visits: 15159
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
navtec
navtec
SSC-Enthusiastic
SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)

Group: General Forum Members
Points: 112 Visits: 298
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.
Grant Fritchey
Grant Fritchey
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17635 Visits: 32268
I wrote an article 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

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
John Mitchell-245523
John Mitchell-245523
SSCertifiable
SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)SSCertifiable (7.5K reputation)

Group: General Forum Members
Points: 7502 Visits: 15159
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
Grant Fritchey
Grant Fritchey
SSCoach
SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)SSCoach (17K reputation)

Group: General Forum Members
Points: 17635 Visits: 32268
Weird. Not sure why that's not coming up. Here's another one from Jonathan Kehayias.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
navtec
navtec
SSC-Enthusiastic
SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)SSC-Enthusiastic (112 reputation)

Group: General Forum Members
Points: 112 Visits: 298
Thanks guys for your answers.

I'll have a read through that article (I can see it).
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search