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')
;
相关推荐
ClouGence5 天前
Oracle 数据同步为什么会出现数据不一致?长事务是常被忽略的原因
数据库·后端·oracle
ClouGence11 天前
Oracle CDC 架构优化:从主库直连到 DataGuard 备库同步
数据库·后端·oracle
曹牧12 天前
Oracle EXPLAIN PLAN
数据库·oracle
贤时间12 天前
codex 助力oracle ebs 开发
数据库·oracle
秉承初心12 天前
PostgreSQL 数据性能瓶颈突破实战
数据库·postgresql·oracle
Curvatureflight12 天前
MySQL 深分页越来越慢?从 LIMIT OFFSET 改成游标分页
数据库·oracle
XZ-07000112 天前
MySQL事务
数据库·mysql·oracle
tiancaijiben12 天前
阿里云函数计算FC如何实现网站的定时任务与自动化
数据库·oracle·dba
xfhuangfu12 天前
Oracle 19c 多租户体系架构介绍
数据库·oracle·架构
杨云龙UP12 天前
Spotlight 接入 Oracle 数据库监控操作指南 2026-06-16
数据库·oracle·性能监控·预警·阈值·spotlight·瓶颈分析