Hi!!
Today we will show how to repair corrupted MS SQL database.
In MS SQL Studio run new query:
1. dbcc checkdb(‘DB-NAME’) with no_infomsgs
DB-NAME is a name of your corrupted database. If this is completed without any errors then the database does not need to be repaired.
2. Alter database DB-NAME set SINGLE_USER
Before we begin repairing the database, the database must be set in single user mode.
3. dbcc checkdb(‘DB-NAME’,REPAIR_REBUILD)
There are number of repair model usually we use first REPAIR_REBUILD. When everything is ok go to step 5.e (multi user mode) If not, go to next step.
4. dbcc checkdb(‘DB-NAME’,REPAIR_ALLOW_DATA_LOSS)
This command may cause data loss. When everything is ok go to step 5.e (multi user mode) If not, go to next step.
5.
a. ALTER DATABASE DB-NAME SET EMERGENCY
b. ALTER DATABASE DB-NAME SET SINGLE_USER
c. DBCC CHECKDB (DB-NAME, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS, ALL_ERRORMSGS
d. ALTER DATABASE DB-NAME SET ONLINE
e. ALTER database DB-NAME set MULTI_USER
Description:
a. Set database to emergency mode
b. Set database to single user mode
c. Check database and repair with allow data loss
d. Back database to online mode from emergency mode
e. Set database to multi user mode for normal use
Best regards
Miroslav Hlavaty
I used all recommended solutions that are mentioned in the above post but unable to repair my corrupt SQL Server database. In last, I tried Third Party SQL Recovery Software as mentioned in the post: http://data-base-recovery.blogspot.in/2012/10/how-to-resolve-sql-server-database.html
& recovered corrupt SQL Server database.
I precisely wished to thank
you very much all over again. I’m not certain what I would’ve used in the absence
of these ways shown by you directly on
such situation. This has been the frustrating
circumstance in my circumstances, but discovering this expert style you
dealt with the issue
forced me to cry with fulfillment. I’m just grateful for your help and then have high hopes
you realize what a
great job you have been providing instructing people thru your blog. Most
likely you’ve never got to know any of us.
thanks man!
Hey. New to SQL, This was a big help. Thank you very much!
many thanks. It saved my day.
Man yor’re awsome.
Thaks a lot…
Oh my gosh – you have saved me! I spent 2 days on my own and 7 hours on the phone with tech support trying to solve a VMWare problem and your document fixed it!! Thank You!!!!!!
Excellent post, In case of failure of above solution you can try free SQL mdf recovery tool http://www.mdfviewer.com/recovery/
thx a lot !