Oracle数据库出现锁表情况分析
Oracle数据库出现锁表情况分析:
-- 查询所有会话的状态、等待类型及当前正在执行的SQL脚本
select se.SID, se.SERIAL#, se.Status, se.Event, se.BLOCKING_SESSION, se.BLOCKING_SESSION_STATUS
, se.USERNAME, se.MACHINE, se.PROGRAM, se.sql_exec_start, se.seconds_in_wait
, NVL(s1.SQL_TEXT, s2.SQL_TEXT) AS sql_text
from v$session se
left join v$sql s1 on se.SQL_ID = s1.SQL_ID and se.sql_child_number = s1.child_number
left join v$sql s2 on se.PREV_SQL_ID = s2.SQL_ID and se.prev_child_number = s2.child_number
order by se.Event,se.PROGRAM,se.SID