Wednesday, 15 July 2015 00:00

How to repair Microsoft SQL database

Rate this item
(0 votes)

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
Last modified on Friday, 17 July 2015 13:17
Data Recovery Expert

Viktor S., Ph.D. (Electrical/Computer Engineering), was hired by DataRecoup, the international data recovery corporation, in 2012. Promoted to Engineering Senior Manager in 2010 and then to his current position, as C.I.O. of DataRecoup, in 2014. Responsible for the management of critical, high-priority RAID data recovery cases and the application of his expert, comprehensive knowledge in database data retrieval. He is also responsible for planning and implementing SEO/SEM and other internet-based marketing strategies. Currently, Viktor S., Ph.D., is focusing on the further development and expansion of DataRecoup’s major internet marketing campaign for their already successful proprietary software application “Data Recovery for Windows” (an application which he developed).

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

Get Help Now

Thank you for contacting us.
Your Private Investigator will call you shortly.