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
SSCertifiable
SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)SSCertifiable (6.8K reputation)

Group: General Forum Members
Points: 6833 Visits: 3050
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
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2400 Visits: 1030
Good Question....
twin.devil
twin.devil
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8312 Visits: 2737
Excellent question, Thanks for sharing
sqldoubleg
sqldoubleg
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1705 Visits: 1363
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
SSCertifiable
SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)SSCertifiable (5.6K reputation)

Group: General Forum Members
Points: 5613 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
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8312 Visits: 2737
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
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1705 Visits: 1363
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 Guru
SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)SSC Guru (98K reputation)

Group: General Forum Members
Points: 98905 Visits: 13320
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 Guru
SSC Guru (93K reputation)SSC Guru (93K reputation)SSC Guru (93K reputation)SSC Guru (93K reputation)SSC Guru (93K reputation)SSC Guru (93K reputation)SSC Guru (93K reputation)SSC Guru (93K reputation)

Group: General Forum Members
Points: 93528 Visits: 11139
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
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24677 Visits: 7501
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