Tuesday 19 January 2016

REPAIR SUSPECT OR CORRUPTED SQL DATABASE IN SIMPLE WAY..

Due to some reason SQL Database to go in a suspect mode. When we connect to the database device going into offline. don't worry follow the following steps to recover your database.

for example your database name is ABC

1. Reset the flag of suspect database
2. Set the database to emergency mode so that it become read only and not accessible to other user.
3. Set the database to Single User Mode.
4. Repair the erros.
5. Set the database to multi user mode so that it can be accessed by other user.

CONSIDER ABC IS USER DATABASE NAME.

first of all execute the following store procedure to reset the flag.

1. exec sp_resetstatus 'ABC'

Then execute the following SQL COMMAND  to set EMERGENCY MODE.

2. ALTER DATABASE ABC SET EMERGENCY\

SQL COMMAND FOR SET SINGLE USER MODE.

3. ALTER DATABASE ABC SET SINGLE_USER WITH ROLLBACK IMMEDIATE

REPAIR THE ERROR WITH FOLLOWING COMMAND.

4. DBCC CHECKDB ('ABC',REPAIR_ALLOW_DATA_LOSS)

SET THE DATABASE TO MULTI USER MODE.

5. ALTER DATABASE ABC SET MULTI_USER.

ABOVE IS THE SIMPLE METHOD TO REPAIR SUSPECT OR CORRUPTED DATABASE.


ANY QUERY THEN MAIL ME.



No comments:

Post a Comment