如何去手動的殺死程序和鎖?最簡單的辦法,重新啟動服務。但是這裡要介紹乙個儲存過程,通過顯式的呼叫,可以殺死程序和鎖。
use master
goif exists (select * from dbo.sysobjects where id = object_id(n'[dbo].[p_killspid]') and objectproperty(id, n'isprocedure') = 1)
drop procedure [dbo].[p_killspid]
gocreate proc p_killspid
@dbname varchar(200) --要關閉程序的資料庫名
as
declare @sql nvarchar(500)
declare @spid nvarchar(20)
declare #tb cursor for
select spid=cast(spid as varchar(20)) from master..sysprocesses where dbid=db_id(@dbname)
open #tb
fetch next from #tb into @spid
while @@fetch_status=0
begin
exec('kill '+@spid)
fetch next from #tb into @spid
end
close #tb
deallocate #tb
go--用法
exec p_killspid 'newdbpy'
殺死Oracle死鎖程序
很多人應該都遇到多oracle程序死鎖的情況,下面是兩個簡單的sql,來殺死死鎖程序 sep27,2008 eleven.xu select locked process select s.username,l.object id,o.name,l.session id,s.serial l.ora...
如何殺死oracle死鎖程序
檢視session操作狀態 select from v session wait where event rdbms ipc message and event sql net message from client and event pmon timer and event on timer 方...
Oracle殺死死鎖程序
oracle殺死死鎖程序 先檢視哪些表被鎖住了 select b.object name,a.session id,c.serial a.locked mode from v locked object a,dba objects b,v session c where b.object id a....