Last Tuesday, we have faced a scary situation when my friend's hard drive has crashed and he has not maintain any backup for the database then he has used data recovery services offered by stellar data recovery and retrieve his database and log files. After retrieving database and log files, he came to me and ask how to fix error 5173 and 824.
After retrieving database and log files from the crashed server, he had tried to attach the SQL server database but got error messages 5173 & 824 and unable to access his database. He can't recover SQL database from backup because i have mentioned above he has not maintain any backup.
How to Fix: We have followed below steps to fix the errors.
- We have created a database with same name and same SQL data files (MDF & NDF).
- Make the file size identical as original SQL server database
- Stop the SQL server database services.
- Rename the old MDF to new one and copy the old MDF to new MDF location
- Delete the LDF files.
- Start SQL server database services
- Our database has gone in suspect mode.
- Update the sysdatabases to update to Emergency mode. This will not use LOG files in start up Sp_configure “allow updates”, 1
go
Reconfigure with override
go
Update sysdatabases set status = 32768 where name = “corruptDBName”
go
Sp_configure “allow updates”, 0
go
Reconfigure with override
go - Now restart SQL server database.
- Our database is in emergency mode.
- Run DBCC CHECKDB on our database with repair_allow_data_loss, that will rebuild the log files and full repair.
- Again restart SQL server database and now our database is online.
No comments:
Post a Comment