Wednesday, 8 July 2015

Query For Suspected Database in SQL 2000/2005/2008

SQL 2005 AND 2008

ALTER DATABASE yourDBname
SET EMERGENCY DBCC checkdb('yourDBname')
ALTER DATABASE yourDBname
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('yourDBname', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname

SET MULTI_USER


 SQL 2000


SP_DBOPTION 'yourDBName', 'SINGLE USER', 'TRUE'
DBCC CHECKDB ('yourDBName', REPAIR_ALLOW_DATA_LOSS)
SP_DBOPTION 'yourDBname', 'SINGLE USER', 'FALSE'

0 comments:

Post a Comment