`

enq: TX - row lock contention

阅读更多

Article by Rampant Author Brian Carr

This is indicative of a session waiting for a row lock held by another session; the amount of wait time associated with this wait event is excessive and can be responsible for performance issues observed in the application. TX enqueue are acquired exclusive when a transaction initiates its first change and held until the transaction does a COMMIT or ROLLBACK.

There are several situations of TX enqueue:

Waits for TX in mode 6 occurs when a session is waiting for a row level lock that is already held by another session. This occurs when one user is updating or deleting a row, which another session wishes to update or delete. This type of TX enqueue wait corresponds to the wait event enq: TX - row lock contention.

To solve this you would have the first session already holding the lock perform a COMMIT or ROLLBACK.

Waits for TX in mode 4 can occur if a session is waiting due to potential duplicates in UNIQUE index. If two sessions try to insert the same key value the second session has to wait to see if an ORA-0001 should be raised or not. This type of TX enqueue wait corresponds to the wait event enq: TX - row lock contention.

To solve this again you have the first session already holding the lock perform a COMMIT or ROLLBACK.

Waits for TX in mode 4 is also possible if the session is waiting due to shared bitmap index fragment. Bitmap indexes index key values and a range of ROWIDs. Each ‘entry’ in a bitmap index can cover many rows in the actual table. If two sessions want to update rows covered by the same bitmap index fragment, then the second session waits for the first transaction to either COMMIT or ROLLBACK by waiting for the TX lock in mode 4. This type of TX enqueue wait corresponds to the wait event enq: TX - row lock contention.

Troubleshooting:

For which SQL currently is waiting on:

select sid, sql_text from v$session s, v$sql q where sid in (select sid from v$session where state in ('WAITING') and wait_class != 'Idle' and event='enq: TX - row lock contention' and (q.sql_id = s.sql_id or q.sql_id = s.prev_sql_id));

The blocking session is:

select blocking_session, sid, serial#, wait_class, seconds_in_wait from v$session where blocking_session is not NULL order by blocking_session;

Recommendation: Evaluate the application to look for these situations via the SQL outlined above to determine where the code can be modified to eliminate possible row lock contention items.

分享到:
评论

相关推荐

    BLOG_【故障处理】Oracle_lhr_队列等待之TX - row lock contention

    ### 故障处理:Oracle_lhr_队列等待之TX - row lock contention #### 一、概述 在Oracle数据库管理中,“enq:TX-rowlockcontention”是一种常见的队列等待事件,通常与行级别的锁定冲突有关。这种冲突可能会导致...

    orcale死锁查杀PB版

    - 使用`v$session_wait`视图查找等待类型的`ENQ: TX - row lock contention`或`ENQ: TX - deadlock`。 - 查询`v$deadlock`和`v$deadlock_monitor`视图获取死锁信息。 - 执行`DBMS_LOCK.MONITOR`过程来监控死锁...

    oracledb-exporter.0.2.9-ora18.5.linux-amd64.tar.gz

    - 锁等待情况(如ENQ: TX - ROW LOCK contention) Prometheus会定期抓取oracledb-exporter提供的这些指标,并根据预设的规则进行报警和可视化展示。你可以利用Prometheus的Alertmanager设置告警规则,当特定指标...

    EBS服务器升级PPT课件.pptx

    数据库性能分析显示,主要的性能瓶颈在于用户I/O,尤其是db file sequential read和db file scattered read事件,以及enq: TX - row lock contention,这些都可能导致新Session无法启动或需要更多内存来处理更多的...

    Oracle10g数据库最佳新特性:等待界面 (1)

    例如,对于"enq:TX - row lock contention"这类等待事件,可能需要考虑事务的并发控制策略或锁的粒度。 总之,Oracle 10g的等待界面改进极大地增强了DBAs在性能监控和问题诊断方面的能力。结合ADDM的自动化分析和...

    中国银行ORACLE优化培训方案

    - **enq:TX-rowlock contention**:行级锁争用,表示两个或多个会话尝试在同一行上执行不兼容的操作。 - **latch free**:闩锁等待,表示进程正在等待一个当前被其他进程占用的闩锁。 #### 三、使用与查看数据库...

    oraclev$sessionv$session_wait用途详解

    1. **等待事件类型**:`EVENT`字段列出了具体的等待事件名称,如“db file sequential read”表示顺序读取数据库文件,“enq: TX - row lock contention”表示行级锁竞争。 2. **等待时长**:`TIME_WAITED`字段提供...

    oracle DBA 例行维护内容

    WHERE event LIKE 'enq: TX - row lock contention' OR event LIKE '%wait%'; -- 杀死会话 ALTER SYSTEM KILL SESSION 'sid,serial#'; ``` ##### 2.4 检查系统空间占用 - **工具选择**:使用操作系统自带的...

    Oracle10g数据库最佳新特性:等待界面 (2)

    以SID为269的会话为例,如果它正等待enq:TX — row lock contention事件,意味着它在等待另一个会话释放锁。在Oracle 10g之前,找出阻塞会话可能需要编写资源密集型查询,但在10g中,只需简单查询v$session就能找到...

    People soft on exadata

    - **行锁争用(enq:TX – row lock contention)**:在并发事务处理中,行锁争用是常见的问题之一。当多个事务尝试同时修改同一数据行时,就可能发生此类等待事件。 - **用户I/O**: - 单块读取(single block read...

Global site tag (gtag.js) - Google Analytics