5/18/2023 0 Comments Cleanexit from sqlThe physical file name "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\EmergencyDemo_log.LDF" may be incorrect. I’m assuming there’s a database called EmergencyDemo that’s in the same state as at the end of the second post I link to at the beginning of this post: the database has no log file, is in EMERGENCY mode and the salaries table is corrupt.įirst off I’ll try bringing the database online, just to see what happens:ĪLTER DATABASE SET ONLINE įile activation failure. Let’s walk-through an example of using it. I have seen it fail several times in real customer situations. And if it does? Probably time to update your resume for not having a water-tight backup and disaster-recovery strategies in place. I always advise taking a copy of the database files before doing this in case something goes wrong or there are unrepairable errors. It’s a one-way operation and can’t be rolled back. Run DBCC CHECKDB with the REPAIR_ALLOW_DATA_LOSS option.Rebuild the transaction log – but only if the transaction log is corrupt.So, given that the database is inconsistent and we’re about to rebuild the transaction log, it makes sense to salvage as much transactional information as possible from the log before we throw it away and build a new one. The idea behind this is that the database is already inconsistent because either the transaction log is corrupt or something in the database is corrupt in such a way that recovery cannot complete. You can think of this as ‘recovery with CONTINUE_AFTER_ERROR‘ – see this post for more details on the real CONTINUE_AFTER_ERROR options for BACKUP and RESTORE. Forces recovery to run on the transaction log (if it exists).The only repair option allowed in EMERGENCY mode is REPAIR_ALLOW_DATA_LOSS and it does a lot more than usual: So, when in EMERGENCY mode, you can use DBCC CHECKDB to bring the database back online again.
0 Comments
Leave a Reply. |