July 17, 2014 at 8:20 pm
Comments posted to this topic are about the item The first thing to do with a damaged off-line database
Best wishes,
Phil Factor
July 18, 2014 at 1:10 am
Good Question....
July 18, 2014 at 1:24 am
Excellent question, Thanks for sharing
July 18, 2014 at 1:29 am
obviously the first thing should be to backup the log, but what is the point when the database is offline and you will get an error?
BACKUP LOG [QODTest] TO DISK = 'c:\QODTest_20140718.trn' WITH CONTINUE_AFTER_ERROR
returns
Msg 942, Level 14, State 3, Line 2
Database 'QODTest' cannot be opened because it is offline.
Msg 3013, Level 16, State 1, Line 2
BACKUP LOG is terminating abnormally.
From BOL
But if the database is in the OFFLINE or EMERGENCY state, BACKUP is not allowed even with NO_TRUNCATE.
Best practice is to backup the log, but in this case the first thing you should do (imho) is to restore the last full backup (WITH REPLACE), otherwise you're wasting your time executing something that will fail.
July 18, 2014 at 1:55 am
raulggonzalez (7/18/2014)
obviously the first thing should be to backup the log, but what is the point when the database is offline and you will get an error?
BACKUP LOG [QODTest] TO DISK = 'c:\QODTest_20140718.trn' WITH CONTINUE_AFTER_ERROR
returns
Msg 942, Level 14, State 3, Line 2
Database 'QODTest' cannot be opened because it is offline.
Msg 3013, Level 16, State 1, Line 2
BACKUP LOG is terminating abnormally.
From BOL
But if the database is in the OFFLINE or EMERGENCY state, BACKUP is not allowed even with NO_TRUNCATE.
Best practice is to backup the log, but in this case the first thing you should do (imho) is to restore the last full backup (WITH REPLACE), otherwise you're wasting your time executing something that will fail.
That`s why it was mentioned "Try to take a tail-log backup", anyway you made your point clear enough 😎
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
July 18, 2014 at 1:59 am
Tail log backup WITH CONTINUE_AFTER_ERROR works only if the database goes offline in case during the start up of the database is fail to come online due to some reasons or damaged due to some reason, in case if we did purpose fully then that will not work (i,e the database didnt have any issues at all)
July 18, 2014 at 3:10 am
twin.devil (7/18/2014)
Tail log backup WITH CONTINUE_AFTER_ERROR works only if the database goes offline in case during the start up of the database is fail to come online due to some reasons or damaged due to some reason, in case if we did purpose fully then that will not work (i,e the database didnt have any issues at all)
True, now I took the time to manually "corrupt" one of my test databases (not only take it offline) and I was able to do a tail-log backup WITH CONTINUE_AFTER_ERROR and also to restore the database to that transaction log backup.
Definitely I learned something today. Good question!
July 18, 2014 at 4:52 am
Nice question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 18, 2014 at 5:38 am
July 18, 2014 at 5:58 am
This was removed by the editor as SPAM
July 18, 2014 at 7:31 am
Paul Randal has a blog post about doing a tail backup of the log for a database that can't/won't come on-line.
He does a bit fo shuffling to back it up using NO_TRUNCATE.
http://www.sqlskills.com/blogs/paul/disaster-recovery-101-backing-up-the-tail-of-the-log/
Is WITH CONTINUE_AFTER_ERROR new with 2012 and avoid some of the shuffling he needed to to?
July 18, 2014 at 8:11 am
Straight up question. It is nice to have questions about important topics such as recovery. Too many people will forget to perform that very essential first step.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 18, 2014 at 8:41 am
raulggonzalez (7/18/2014)
twin.devil (7/18/2014)
Tail log backup WITH CONTINUE_AFTER_ERROR works only if the database goes offline in case during the start up of the database is fail to come online due to some reasons or damaged due to some reason, in case if we did purpose fully then that will not work (i,e the database didnt have any issues at all)True, now I took the time to manually "corrupt" one of my test databases (not only take it offline) and I was able to do a tail-log backup WITH CONTINUE_AFTER_ERROR and also to restore the database to that transaction log backup.
Definitely I learned something today. Good question!
+100000000
Thank you, raul and twin;
your script and the twin's extended explanation is really really really ... really extraordinary information in this section.
(had a vague idea..... after reading the question and then the raul's script- I started to think like this "server putting database offline" and/or "putting database manually offline"..... and then I jumped "well offline is an offline" ended with a absolute wrong conclusion, thank you twin for really good insight on this. this makes so much sense to me now...)
To author: very interesting question, thank you for the post.
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
July 18, 2014 at 12:35 pm
For me this was an UBER important question. I have never had to do this but am in charge of DR at our company for the databases.
July 21, 2014 at 6:17 am
Good question.
Thanks!
---------------
Mel. 😎
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply