oracle查锁及解锁命令

--查询行锁语句

select sql_text from v$sql a,v$session b
where a.sql_id=b.sql_id and b.event='enq: TX - row lock contention';

--找到被锁定的表

SELECT object_name, machine, s.sid, s.serial#
FROM gv$locked_object l, dba_objects o, gv$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid;

 --解锁命令

ALTER SYSTEM KILL SESSION '11,48547';
 

 或者用以下命令查出来后执行ALTER SYSTEM KILL SESSION '''||s.sid||', '||s.serial#||

select     s.sid,s.machine,o.object_name,l.oracle_username,l.locked_mode,       
'ALTER     SYSTEM     KILL     SESSION     '''||s.sid||', '||s.serial#||''';' Command       
from     v$locked_object     l,v$session     s,all_objects     o       
where     l.session_id=s.sid     and     l.object_id=o.object_id; 

 

 

posted @ 2018-05-25 17:38  西门运维  阅读(9453)  评论(0编辑  收藏  举报