参考下: --杀掉sleep进程 declare @s nvarchar(100) declare tb cursor local for select N'kill '+rtrim(spid) from master..sysprocesses (NOLOCK) where lastwaittype=N'SLEEP' and spid>=50 open tb fetch tb into @s while @@fetch_status=0 begin exec(@s) fetch tb into @s end close tb
deallocate tb
顺便再问一句,大量的Sleeping 进程 对SQL server 的性能有影响吗?我直接批量杀掉的话 对应用程序 有影响吗?谢谢
--杀掉sleep进程
declare @s nvarchar(100)
declare tb cursor local
for
select N'kill '+rtrim(spid)
from master..sysprocesses (NOLOCK)
where lastwaittype=N'SLEEP'
and spid>=50
open tb
fetch tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch tb into @s
end
close tb
deallocate tb
至于对应用程序的影响,我就不太清楚了,你可以测试看看。