修复数据库错误
2024年4月21日
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 XZ_KCMM SET SINGLE_USER
DBCC CheckDB (XZ_KCMM , REPAIR_ALLOW_DATA_LOSS)
DBCC CheckDB (XZ_KCMM , REPAIR_REBUILD)
DBCC CheckDB (XZ_KCMM , REPAIR_FAST)
ALTER DATABASE XZ_KCMM SET MULTI_USER