oracle查鎖及解鎖命令

--查詢行鎖語句python

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';

--找到被鎖定的表sql

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;

 --解鎖命令 bash

ALTER SYSTEM KILL SESSION '11,48547';
 

 或者用如下命令查出來後執行ALTER SYSTEM KILL SESSION '''||s.sid||', '||s.serial#||session

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;

 

相關文章
相關標籤/搜索