How to repair suspected mssql database

How to repair suspected mssql database-

When  you connect your MSSQL server you may notice some database(s) in ’suspected’ mode and it doesn’t let you do anything. This is happening because of database corruption, server not properly shut down, etc..  To repair the ’suspected’ database you may need to run the following query in your Query Analyzer(for SQL 2000) or Management Studio (for SQL 2005 and 2008)-

EXEC sp_resetstatus databasenamehere;
ALTER DATABASE databasenamehere SET EMERGENCY
DBCC checkdb(databasenamehere)
ALTER DATABASE databasenamehere SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (databasenamehere, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE databasenamehere SET MULTI_USER

Note: Before running the query please make sure you have taken the copy of data and transaction log files to another location.

Your database is repaired now

“`*“`arun
VN:F [1.6.7_924]
Rating: 0.0/5 (0 votes cast)
VN:F [1.6.7_924]
Rating: 0 (from 0 votes)
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>