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')
;
相关推荐
袋鼠云数栈7 小时前
整库迁移与分库分表同步:批量数据搬迁的配置简化思路
jvm·数据库·oracle
cfm_29148 小时前
Spring事务
数据库·spring·oracle
倔强的石头10612 小时前
连接数失控排查:从数据库会话、应用线程池到连接池泄漏
数据库·oracle
betazhou1 天前
Apache Seatunnel 抽取Oracle数据库测试
数据库·oracle·apache·seatunnel
devilnumber1 天前
Oracle 与 MySQL substr 函数差异总结
java·数据库·mysql·oracle
疯狂打码的少年1 天前
【数据库技术】SQL数据查询(SELECT基本语法)
数据库·笔记·sql·oracle
Broccoli523026651 天前
FastAPI + SQLAlchemy 异步会话(AsyncSession)核心方法
数据库·oracle·fastapi
oradh2 天前
Oracle TM 锁 Mode 4(Share)问题排查总结
数据库·oracle·oracle tm 锁·tm 锁 mode 4
CodeStats2 天前
MySQL与Oracle数据类型底层设计原理对比(下)
数据库·mysql·oracle
oradh2 天前
Oracle TX 锁 Mode 4(Share)问题排查总结
数据库·oracle·tx 锁 mode 4·oracle tx 锁