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


The first thing to do with a damaged off-line database


The first thing to do with a damaged off-line database

Author
Message
Phil Factor
Phil Factor
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2714 Visits: 2984
Comments posted to this topic are about the item The first thing to do with a damaged off-line database


Best wishes,

Phil Factor
Simple Talk
PRAMANA.DBA
PRAMANA.DBA
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1190 Visits: 1030
Good Question....
twin.devil
twin.devil
Hall of Fame
Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)

Group: General Forum Members
Points: 3027 Visits: 2682
Excellent question, Thanks for sharing
sqldoubleg
sqldoubleg
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1237 Visits: 1362
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.
Hany Helmy
Hany Helmy
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3483 Visits: 1117
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 Cool
twin.devil
twin.devil
Hall of Fame
Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)

Group: General Forum Members
Points: 3027 Visits: 2682
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)
sqldoubleg
sqldoubleg
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1237 Visits: 1362
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!
Koen Verbeeck
Koen Verbeeck
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34121 Visits: 13270
Nice question, thanks.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Ed Wagner
Ed Wagner
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21583 Visits: 10288
Thanks for the question.


Tally Tables - Performance Personified
String Splitting with True Performance
Best practices on how to ask questions
Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10911 Visits: 7320
Good question, thanks
Have had to, unfortunately, do this a few times in my tenure as a DBA

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
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