本文主要是介绍oracle查看锁表进程,杀死会话,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在Oracle 10g的Enterprise Manager中找了半天没找到锁的管理模块,无奈写了一个锁视图脚本:
select c.owner, c.object_name, c.object_type, b.sid, b.serial#, b.status, b.osuser, b.machine from
v$locked_object a, v$session b, dba_objects c
where b.sid = a.session_id
and a.object_id = c.object_id;
然后可以用下面的语句来杀死会话:
alter system kill session 'sid,serial#' immediate;
查看锁表进程SQL语句1:
select sess.sid,
sess.serial#,
lo.oracle_username,
lo.os_user_name,
ao.object_name,
lo.locked_mode
from v$locked_object lo,
dba_objects ao,
v$session sess
where ao.object_id = lo.object_id and lo.session_id = sess.sid;
查看锁表进程SQL语句2:
select * from v$session t1, v$locked_object t2 where t1.sid = t2.SESSION_ID;
杀掉锁表进程:
如有記錄則表示有lock,記錄下SID和serial# ,將記錄的ID替換下面的738,1429,即可解除LOCK
alter system kill session '738,1429';
这篇关于oracle查看锁表进程,杀死会话的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!