步骤一:查询试图,找出sid
Select Distinct a.session_id From Dba_Ddl_Locks a
Where a.name=upper('t_sqlload_tmp');
如果不知道被锁的对象,可以用如下语句查找:
SELECT b.owner,b.object_name,b.object_type,b.object_id
FROM
dba_Objects b
WHERE b.OBJECT_ID IN ( SELECT DISTINCT a.object_id FROM v$locked_object a);
从中发现有个自己在用的对象被锁了,根据object_id执行如下的sql语句:
SELECT S.SID SESSION_ID,S.SERIAL#
FROM V$LOCK L/*,SYS.DBA_OBJECTS O*/,V$SESSION S
WHERE L.SID = S.SID
AND L.ID1 =874582
然后执行如下的sql语句:
ALTER SYSTEM KILL SESSION 'SID,SERIAL#';
这样就可以在pl/sql上杀掉oracle进程,如果不能成功释放,可以用下面的杀手简:
步骤二:找出spid,在linux上杀掉该操作系统进程号:
SELECT SPID
FROM V$PROCESS
WHERE ADDR = (SELECT PADDR FROM V$SESSION WHERE SID = &ORASID);
或者这个语句
Select a.Status, a.Sid, a.Serial#, a.Saddr, a.Paddr, b.Spid, b.Addr, a.Machine
From V$session a, V$process b
Where b.Addr = a.Paddr And a.Sid In (10,14,36);
步骤三:登陆ORALCE系统执行命令;
kill -9 SPID;
如此方法即可解除死锁的进程;
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8109090/viewspace-879204/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8109090/viewspace-879204/