1.0 oracle中表被锁,处理方法
select t4.object_name, t3.spid, t1.oracle_username, t1.os_user_name
from v$process t3, v$session t2, v$locked_object t1, dba_objects t4
where t3.addr in (t2.paddr)
and t2.sid in (t1.session_id)
and t1.object_id = t4.object_id and t4.object_name=xxx;
然后使用以下命令 杀掉
orakill oracle_sid spid
select t4.object_name, t3.spid, t1.oracle_username, t1.os_user_name
from v$process t3, v$session t2, v$locked_object t1, dba_objects t4
where t3.addr in (t2.paddr)
and t2.sid in (t1.session_id)
and t1.object_id = t4.object_id and t4.object_name=xxx;
然后使用以下命令 杀掉
orakill oracle_sid spid
2.0 oracle的 procedure、package被锁,处理方法
select oc.type obj_type,oc.name obj_name,spid from v$db_object_cache oc, v$object_dependency od, dba_kgllock w, v$session s, v$process p
where od.to_owner = oc.owner and od.to_name = oc.name and od.to_address = w.kgllkhdl and w.kgllkuse = s.saddr and p.addr = s.paddr --and oc.name = 'upper(123)'
order by s.logon_time asc
--AND OC.NAME = 'upper(&obj_name)'
这一块 注释了。 OC.NAME 就是 package、procdure的名字了
这个sql,我取了会话的登录时间 从早到晚排序了
操作系统层面执行如下命令
orakill ORACLE_SID spid