SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Stairway to Transaction Log Management in SQL Server, Level 5: Managing the Log in Full Recovery...


Stairway to Transaction Log Management in SQL Server, Level 5: Managing the Log in Full Recovery Mode

Author
Message
Tony Davis
Tony Davis
SSC Eights!
SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)

Group: Administrators
Points: 943 Visits: 1160
Hi Megistal,

I'd be interested to learn why you'd like another way to force log truncation, other than temporarily switch the database to SIMPLE? It's true that the techniques you suggest are now deprecated.

If you surf around you'll probably find reference to an alternative, which is BACKUP LOG TO DISK='NUL'. However, it's a very bad practice. It basically takes a log backup and just discards the contents, without SQL Server being aware of the fact. You can continue to take normal log backups after this but they will be useless as the log chain is broken. Jonathan Kehayais covers this well in Chapter 8 of his "Troublshooting SQL Server book" (the eBook is currently a free download).

Cheers,
Tony.
Megistal
Megistal
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1944 Visits: 2555
Tony Davis (1/30/2012)

If you surf around you'll probably find reference to an alternative, which is BACKUP LOG TO DISK='NUL'.


Wasn't aware of this one, could be handy one day or another, more knowledge is always appreciate!

Tony Davis (1/30/2012)

Jonathan Kehayais covers this well in Chapter 8 of his "Troublshooting SQL Server book" (the eBook is currently a free download).


Thank you for the book reference, I'll take a look.

Tony Davis (1/30/2012)
Hi Megistal,
I'd be interested to learn why you'd like another way to force log truncation, other than temporarily switch the database to SIMPLE? It's true that the techniques you suggest are now deprecated.


Altering the database that way (FULL -> SIMPLE -> FULL) flush the plan cache and this is quite a problem. Therefore if I can find something similar to the switch recovery model (which has proved to be the best option so far, unfortunately) I'll be glad to avoid that plan cache flush.
jasona.work
jasona.work
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4221 Visits: 11749
Tony Davis (1/30/2012)
My understanding is that the log chain starts at the last full DB backup. So if someone runs a full backup of the DB in the middle of your backup cycle, then deletes that full backup, your log chain is broken.


Hi Jasona,

If someone deleted the full backup, you could still go back to the backup before that, and then restore your chain of log files, since each log backup contains all the records generated since the last log backup. However, if you take differential backups, then any that rely on the deleted base full backup will be unusable.

Copy only backups allow you to take a full backup outside of your scheduled backup routine, and without disrupting your diff backups. Gail Shaw has a nice article on this: http://sqlinthewild.co.za/index.php/2011/03/08/full-backups-the-log-chain-and-the-copy_only-option/

Cheers,
Tony.



Tony, after the first reply to my comment, I remembered that at some point, this had been explained to me once before (I can't find the original though) And here I thought I was *SO* smart...
;-)

Thanks,
Jason
Tony Davis
Tony Davis
SSC Eights!
SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)

Group: Administrators
Points: 943 Visits: 1160

One question though: when having to restore to a specific point in time using STOPAT can I trust the "BackupStartDate" column returned by the following code?
That would be an easier way to identify which log backup I really need to stop at before performing the actions?


Hi Andre,
Yes, this is quite a tricky area. That query might at least help you identify that this was the log backup taken right after whatever the "unfortunate event" happened to be. The degree of difficulty of a p-i-t restore rather depnds though on how accurately you know the exact time the problem occurred. The best discussion of an alternative that I've found, if you're really unsure of the time, is based on restoring to an LSN instead: http://janiceclee.com/2010/07/25/alternative-to-restoring-to-a-point-in-time/.

Cheers,
Tony.
Tony Davis
Tony Davis
SSC Eights!
SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)SSC Eights! (943 reputation)

Group: Administrators
Points: 943 Visits: 1160
Andre,

Just stumbled across this post: http://stanleyjohns.wordpress.com/2012/01/09/reading-the-transaction-log-using-fn_dblog-and-fn_dump_dblog/

Talks about how to peek inside a log backup using fn_dump_dblog, which can show you what times are contained within. Completely unsupported and undocumeted function, so use entirely at your own risk etc. etc. ;-)

But it was new to me, and seemed useful, so thought I'd share.

Cheers,
Tony.
kartar67
kartar67
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 99
The stopat recovery that is shown here in Listing 5.5 shows how to recover at 12:00am and not 02:30am. Is it a typo or am i missing something here?
Under the article: Stairway to Transaction Log Management in SQL Server, Level 5: Managing the Log in Full Recovery Mode
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