Quantcast
Viewing all articles
Browse latest Browse all 223

WHAT TO DO WHEN DBCC CHECKDB(REPAIR_ALLOW_DATA_LOSS) FAILS

Hello, our server hard disk crashed due to power failure and all the backups were on the hard disk. Before just before it did we had managed to copy the mdf file but power failed while copying the log file. The mdf can't be attached on a different machine now cos there was a transaction in progress when it was detached. So I created a new database, stopped the service and replaced the new mdf with the corrupt one and started the service again. Its state was Recovery_Pending. So I tried to run emergency mode repair using the following commands:ALTER DATABASE HealthBookDB Set Single_UserGOALTER DATABASE HealthBookDB Set EmergencyGODBCC CHECKDB('HealthBookDB',REPAIR_ALLOW_DATA_LOSS)GOAnd the results were as follows:Msg 5173, Level 16, State 1, Line 1One or more files do not match the primary file of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupted and should be restored from a backup.Log file 'C:\HealthBookDB\HealthBookDB_log.ldf' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.DBCC results for 'HealthBookDB'.CHECKDB found 0 allocation errors and 0 consistency errors in database 'HealthBookDB'.Msg 824, Level 24, State 2, Line 1SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:227761; actual 0:0). It occurred during a read of page (1:227761) in database ID 9 at offset 0x0000006f362000 in file 'C:\HealthBookDB\HealthBookDB.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.Msg 824, Level 24, State 2, Line 1SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:227761; actual 0:0). It occurred during a read of page (1:227761) in database ID 9 at offset 0x0000006f362000 in file 'C:\HealthBookDB\HealthBookDB.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.Msg 824, Level 24, State 2, Line 1SQL Server detected a logical consistency-based I/O error: incorrect pageid (expected 1:227761; actual 0:0). It occurred during a read of page (1:227761) in database ID 9 at offset 0x0000006f362000 in file 'C:\HealthBookDB\HealthBookDB.mdf'. Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.Msg 7909, Level 20, State 1, Line 1The emergency-mode repair failed.You must restore from backup.I'm really at my wits end now can anyone help

Viewing all articles
Browse latest Browse all 223

Trending Articles