Oracle 根据等待事件 enq: TX - index contention 查找对象

当前会话查询

bash 复制代码
with tmp_table_index as (
  select di.owner||'.'||di.index_name as index_name_with_owner,
         di.table_owner||'.'||di.table_name as table_name_with_owner
    from dba_indexes di
)
select sysdate,dh.sql_id,dh.ROW_WAIT_OBJ#,
       (select t0.table_name_with_owner 
         from dba_objects do ,tmp_table_index t0 
         where do.object_id=dh.ROW_WAIT_OBJ# and do.owner||'.'||do.object_name =  t0.index_name_with_owner) as table_name_with_owner,
       (select t0.index_name_with_owner 
         from dba_objects do ,tmp_table_index t0 
         where do.object_id=dh.ROW_WAIT_OBJ# and do.owner||'.'||do.object_name =  t0.index_name_with_owner) as index_name_with_owner,
       dh.event,dh.program,dh.machine
from gv$session dh
where 1=1
and dh.event in ('enq: TX - index contention')
;

历史信息查询

bash 复制代码
with tmp_table_index as (
  select di.owner||'.'||di.index_name as index_name_with_owner,
         di.table_owner||'.'||di.table_name as table_name_with_owner
    from dba_indexes di
)
select dh.sample_time,dh.sql_opname,dh.sql_id,dh.current_obj#,
       (select t0.table_name_with_owner 
         from dba_objects do ,tmp_table_index t0 
         where do.object_id=dh.current_obj# and  do.owner||'.'||do.object_name =  t0.index_name_with_owner) as table_name_with_owner,
       (select t0.index_name_with_owner 
         from dba_objects do ,tmp_table_index t0 
         where do.object_id=dh.current_obj# and  do.owner||'.'||do.object_name =  t0.index_name_with_owner) as index_name_with_owner, 
       dh.event,dh.program,dh.machine
from gv$active_session_history dh
     --dba_hist_active_sess_history dh
where 1=1
and dh.event in ('enq: TX - index contention')
and dh.sample_time between to_date('2026-03-25 00:00:00','yyyy-mm-dd hh24:mi:ss')
                       and to_date('2026-03-25 23:59:59','yyyy-mm-dd hh24:mi:ss')
;
相关推荐
xcLeigh2 小时前
Oracle 迁移深度复盘:多数据库选型决策全解析
大数据·数据库·sql·oracle·数据迁移·数据管理
是桃萌萌鸭~3 小时前
oracle中的 CDB 和 PDB 详解
数据库·oracle
huohuopro3 小时前
Hbase学习
学习·oracle·hbase
云边有个稻草人4 小时前
Oracle替换工程实践:迁移落地实操与成本全解析
数据库·oracle
BullSmall4 小时前
接口测试-- SQL 注入测试(安全合规版)
数据库·sql·oracle·安全性测试
stuartevil13 小时前
【MySQL】SQL菜鸟教程(一)
sql·mysql·oracle
一个天蝎座 白勺 程序猿21 小时前
Oracle替换工程实践深度解析:从迁移挑战到金仓“零改造”实践
数据库·学习·oracle·kingbasees