Uploaded by vasanth.gowtham83

SQl Express 2008 Repair

advertisement
3. When a database is in SUSPECT mode you will not be able to get connected to the
database. Hence you need to bring the database first in EMERGENCY mode to repair the
database. Execute the below mentioned TSQL code to bring the database in EMERGENCY
mode.
USE
master
GO
ALTER DATABASE BPO SET EMERGENCY
GO
Once the database is in EMERGENCY mode you will be able to query the database.
4. Execute the DBCC CHECKDB command which will check the logical and physical integrity
of all the objects within the specified database.
DBCC CHECKDB (BPO)
GO
5. Next step will be to bring the user database in SINGLE_USER mode by executing the
below mentioned TSQL code.
ALTER DATABASE BPO SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
6. Once the database is in SINGLE_USER mode execute the below TSQL code to repair the
database. When you repair your database using REPAIR_ALLOW_DATA_LOSS option of DBCC
CHECKDB command there can be some loss of data. Once the database is successfully
repaired using REPAIR_ALLOW_DATA_LOSS option of DBCC CHECKDB command then there
is no way to go back to the previous state.
DBCC CHECKDB (BPO, REPAIR_ALLOW_DATA_LOSS)
GO
7. Finally, execute the below mentioned TSQL command to allow MULTI_USER access to the
database.
ALTER DATABASE BPO SET MULTI_USER
GO
Download