SQL一致性錯誤修復SQL

zping發表於2016-12-14
USE master;

DECLARE @databasename VARCHAR(255);

SET @databasename = 'BenlaiTask';
 
ALTER DATABASE BenlaiTask SET   SINGLE_USER  WITH ROLLBACK IMMEDIATE;
DBCC CHECKDB(@databasename,REPAIR_ALLOW_DATA_LOSS);

DBCC CHECKDB(@databasename,REPAIR_REBUILD);

ALTER DATABASE BenlaiTask SET  MULTI_USER WITH ROLLBACK IMMEDIATE;

 

相關文章