Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Stairway to Transaction Log Management in SQL Server, Level 5: Managing the Log in Full Recovery Mode Expand / Collapse
Author
Message
Posted Monday, January 30, 2012 4:48 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: Administrators
Last Login: Yesterday @ 12:33 PM
Points: 569, Visits: 1,015
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.
Post #1243503
Posted Monday, January 30, 2012 6:50 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 6:46 AM
Points: 1,416, Visits: 2,081
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.
Post #1243565
Posted Monday, January 30, 2012 7:59 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 9:52 AM
Points: 978, Visits: 5,079
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
Post #1243627
Posted Tuesday, January 31, 2012 5:10 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: Administrators
Last Login: Yesterday @ 12:33 PM
Points: 569, Visits: 1,015

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.
Post #1244242
Posted Tuesday, January 31, 2012 5:23 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: Administrators
Last Login: Yesterday @ 12:33 PM
Points: 569, Visits: 1,015
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.
Post #1244251
Posted Tuesday, February 19, 2013 12:19 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 3, 2014 1:11 PM
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
Post #1421801
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse