Technology Yogi

Microsoft SQL Server Monitoring, Administration, Optimization, Tips & Tricks

Special Search Engine
Gomeez Peer

I have already sign-up and running it on my PC and I belive it is safe.
SQL 2008
SQL Server 2008 Datasheet
SQL Server 2008 Product Overview
SQL Server 2008 What’s New Learning Clinic
SQL Server 2008 Webcasts
SQL Server 2008 White Papers
Links To Other Services
Currently I am Reading..
Delivering business intelligence with Microsoft SQL Server 2008 - By Larson, Brian

Data mining with Microsoft SQL Server 2008 - By MacLennan Jamie, Tang ZhaoHui, Crivat Bogdan.

How to Back Up the Transaction Log When the Database Is Damaged
Sunday, March 29, 2009




This is one of the best and most frequently asked question in the SQL DBA interview especially if you are being interview for "Production Support DBA" role.



"How to Back Up the Transaction Log When the Database Is Damaged" aka "how to perform tail log backup" - you will face this kind of issues when your database which get corrupted and goes in suspect most while in use or when you recover from a server crash mostly in cases like disk failures. When such failures occur your best method to recover the data is to restore your backup (full/diff/t.logs), so when do we need the tail log backups ?



Assume a case like this one - you take a full backup every night and differentials every 4 hrs. and t.log backups every 15 minutes, which most of us do. Suppose your t.log backup was about to start at 11:15 AM and crash happens at 11:13 AM. So, we are left with a gap of 11:00 AM to 11:13 AM transaction - how do we recover from this gap, yes we depend on tail log. There is no gurantee that you will recover best all of the data, but is a "best effort" strategy as a responsible DBA.



Here is the T-SQL command,




BACKUP LOG TestDB TO TestDB_FullRM_log1 WITH NO_TRUNCATE
GO




Notice the keyword "NO_TRUNCATE", why we need it ? - NO_TRUNCATE clause allows the active part of the t.log to be backed up even if the database is inaccessible/offline, provided the transaction log file is accessible and undamaged, this is very important so keep it in mind :) - for interview as well as for real case where you are required to recover the database from a failure.Why it's called tail log ? - because this is the last backup taken from the failed database in order to recover from failures.


Labels:

posted by TechnologyYogi @ 8:19 PM   0 comments
About Me

Name: TechnologyYogi
Home: Seattle, Washington, United States
About Me: By profession I am a DBA (MS-SQL) with total 10 yrs of experience in IT, out of that 7 yrs as SQL DBA. I have handled Developer, plus production support roles. Apart from that I am an avid investor. With small investments in India and United States in the form of Equity holdings in common stocks.
View Girish Patil's complete profile on LinkedIn
Previous Post
Archives
Site Meter
Powered by

BLOGGER

© 2007-08 Technology Yogi Template by Isnaini Dot Com