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')
;
相关推荐
一只fish5 小时前
优化器架构对比:Oracle vs PostgreSQL vs MySQL
mysql·postgresql·oracle
测试运维日常笔记7 小时前
Oracle 数据库连接认证方式详解
数据库·oracle
盗理者9 小时前
AI Agent 技能分享|从零实现 MCP Server,让 Agent 安全读取数据库
数据库·oracle
oradh13 小时前
Oracle ADRCI 诊断数据工具总结
数据库·oracle·adrci
xfhuangfu15 小时前
Oracle 19c 本地索引分区变为 UNUSABLE 后的空间占用验证
数据库·oracle
杨云龙UP15 小时前
Oracle ASH 报告详解:与 AWR 的区别、使用场景及生成方法
linux·运维·服务器·数据库·oracle
测试运维日常笔记15 小时前
PostgreSQL 数据库磁盘空间占用排查手顺
数据库·postgresql·oracle
️学习的小王16 小时前
MySQL常用函数知识点总结
数据库·mysql·oracle
东方护航数据恢复(深圳)1 天前
MySQL_Oracle数据库崩溃修复全攻略_东方护航数据恢复深圳店
数据库·mysql·oracle
梓沂2 天前
CentOS 7.9 静默安装 Oracle 11gR2 企业版全记录
linux·oracle·centos