Tuesday 17 April 2012

How to Repair SQL Server 2000/2005 Suspect Database

Dear friends,

One day fine morning the Treasury is not working or the SpeedPost is not working
due to unknown reasons. Please check the data bases of the above , if it is marked as suspect,
run the below quary in quary analiser with suspect database name in place of DBname

If your Database is marked as Suspected, here are the steps to fix it :
EXEC sp_resetstatus 'DBName'
GO
ALTER DATABASE DBName SET EMERGENCY
DBCC checkdb('DBname')
ALTER DATABASE DBName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('DBName', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE DBName SET MULTI_USER
GO
-- Rebuild the index
ALTER INDEX ALL ON [ TableName] REBUILD

No comments:

Post a Comment