修复数据库错误
2024年6月28日
declare @sql varchar(100)
while 1=1
begin
select top 1 @sql = ‘kill ‘+cast(spid as varchar(3))
from master..sysprocesses
where spid > 50 and spid <> @@spid
if @@rowcount = 0
break
exec(@sql)
endALTER DATABASE SX_RCMM SET SINGLE_USER
DBCC CheckDB (SX_RCMM , REPAIR_ALLOW_DATA_LOSS)
DBCC CheckDB (SX_RCMM , REPAIR_REBUILD)
DBCC CheckDB (SX_RCMM , REPAIR_FAST)
ALTER DATABASE SX_RCMM SET MULTI_USER