编程点滴.技巧小记.处理"可疑"数据库
今天"SQL SERVER 2005"中某数据库状态变成"可疑"了.随之无法工作了.采用一下代码处理后正常了.
USE MASTER
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
ALTER DATABASE dbName SET EMERGENCY
GO
sp_dboption 'dbName', 'single user', 'true'
GO
DBCC CHECKDB('dbName','REPAIR_ALLOW_DATA_LOSS')
GO
ALTER DATABASE dbName SET ONLINE
GO
sp_configure 'allow updates', 0 reconfigure with override
GO
sp_dboption 'dbName', 'single user', 'false'
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
ALTER DATABASE dbName SET EMERGENCY
GO
sp_dboption 'dbName', 'single user', 'true'
GO
DBCC CHECKDB('dbName','REPAIR_ALLOW_DATA_LOSS')
GO
ALTER DATABASE dbName SET ONLINE
GO
sp_configure 'allow updates', 0 reconfigure with override
GO
sp_dboption 'dbName', 'single user', 'false'
GO