select sess.sid ||','||
sess.serial#,
lo.oracle_username,
lo.os_user_name,
ao.object_name,
lo.locked_mode,
SESS.machine
from v$locked_object lo,
dba_objects ao,
v$session sess
where ao.object_id = lo.object_id and lo.session_id = sess.sid ;
解决ORA-00054: resource busy and acquire with NOWAIT specified or timeout expire
-- 查询有锁的sid
select t2.username,t2.sid,t2.serial#,t2.logon_time
from v$locked_object t1,v$session t2
where t1.session_id=t2.sid order by t2.logon_time;
-- 替换什么的sid查询具有sql 例子sid为2149
select sql_text from v$session a,v$sqltext_with_newlines b
where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value
and a.sid=2149 order by piece;
--kill该事务 例子 sid为339,serial#为13545
alter system kill session '339,13545';