oracle bug 6825287導致DX鎖等待
1 概述
問題簡述:scdb資料庫鎖阻塞
2 問題描述
scdb資料庫某日上午發生DX鎖阻塞現象,影響部分業務操作。當時監控到的鎖阻塞情況如下:
HOLD_SID H_USER H_LOCKWAIT H_STATUS H_MODULE H_OBJ H_ROW WAIT_SID W_USER W_LOCKWAIT W_STATUS W_MODULE W_OBJ W_ROW H_TYPE H_ID1 H_ID2 H_LMODE H_REQUEST H_CTIME H_BLOCK R_TYPE R_ID1 R_ID2 R_LMODE R_REQUEST R_CTIME R_BLOCK KILLHOLD HSQL WSQL
1 2321 DB_SC ACTIVE 81912 0 91 DB_YW 0700000866676D18 ACTIVE -1 0 DX 38 0 6 0 1975 1 DX 38 0 0 4 1210 0 alter system kill session '2321,64240'; -- kill -9, 7131170 INSERT INTO DB_YW.T_TEMP_SC..... SELECT formatid, globalid, branchid FROM SYS.DBA_PENDING_TRANSACTIONS
3 問題分析
從監控結果看,阻塞鎖型別是DX鎖(Distributed transaction entry),等待鎖的SQL語句是SELECT formatid, globalid, branchid FROM SYS.DBA_PENDING_TRANSACTIONS ,持有鎖的SQL是一條INSERT語句。鎖持有方式是6 - exclusive (X) ,鎖申請方式4 - share (S) 。
DBA_PENDING_TRANSACTIONS是系統資料字典,DBA_PENDING_TRANSACTIONS describes unresolved transactions (either due to failure or if the coordinator has not sent a commit/rollback). DBA_PENDING_TRANSACTIONS is a view which is basically a table @imposed on the structure representing in-memory state of distributed txns.
The DX-enqueue serves as a serialization primitive to prevent concurrency among various tightly-coupled branches of a distributed transaction on any database. It also provides for serialization of 2PC operations like abort and forward going changes.
在一個高負載、高併發、並使用了分散式事務的資料庫環境中,可能會產生DX鎖等待(may present a problem in a high activity system where the application logic performs work in short bursts i.e. work is performed in several client -> server roundtrips. Each trip into the database server, would request the DX-enqueue if the session has a distributed txn attached to it. Additionally, 2PC operations on detached branches also require the DX-enqueue.)
具體描述請查閱Oracle metalink 文件[ID 762412.1]
這是Oracle一個Unpublished Bug(querying DBA_PENDING_TRANSACTIONS in a high concurrency environment and to resolve the potential issue of acquisition of the DX-enqueue with infinite timeout. The fix for this issue is to request the enqueue/lock with a timeout and handle the enqueue/lock acquisition timeouts appropriately. Thus relieving the contention issue.)
4 結論
從鎖阻塞現場情況看,很可能是遇到ORACLE Bug 6825287,這個bug在9i 10g 11.1版本都存在,需要安裝補丁patch 8354686才可能解決,但這個補丁是Oracle停止oracle9i標準服務之後才釋出,所以在Oracle9i版本下屬於“擴充套件支援”範圍,需要與Oracle簽訂Oracle9i“擴充套件支援”服務合同才能獲取該補丁。
5 附Oracle metalink DOC [ID 762412.1]
Select From Dba_pending_transaction or GV$GLOBAL_TRANSACTION Takes A Long Time (very slow) [ID 762412.1] |
||
|
||
|
修改時間 08-FEB-2010 型別 PROBLEM 狀態 PUBLISHED
|
|
In this Document
5.1 Applies to:
Oracle Server - Enterprise Edition - Version: 9.2.0.8 to 11.1.0.6 - Release: 9.2
Information in this document applies to any platform.
Oracle Server Enterprise Edition - Version: 9.2.0.8 to 11.1.0.6
5.2 Symptoms
SELECT FROM DBA_PENDING_TRANSACTION TAKES A LONG TIME,
The investigation shows the session waiting for 'DX' lock .
This issue may also be observed with XA transactions running :
MSDTC / OraMTS / ODBC
- Microsoft Distributed Transaction Coordinator service
- Oracle Services for Microsoft Transaction Server (MTS)
In this case, the issue will fire in the Client Applications which are periodically encountering :
ORA-02049: timeout: distributed transaction waiting for lock
Contention is observed :
gv$session_wait shows session waiting "enq: DX - contention"
The Key points which relate to the DX enqueue under the circumstances here are as follows.
- The DX-enqueue serves as a serialization primitive to prevent concurrency among various tightly-coupled branches of a distributed transaction on any database. It also provides for serialization of 2PC operations like abort and forward going changes (e.g. out-of-band abort requests sent in by Transaction
Monitors like MSDTC on expiration of application transaction time-to-live).
- OraMTS runs a periodic recovery job as a scheduled job via the jobq infrastructure. This purpose of this job is to query
DBA_PENDING_TRANSACTIONS looking for any MSDTC-initiated and coordinated transactions that go in-doubt on the database.
- DBA_PENDING_TRANSACTIONS is a view which is a union of a fixed table and a persistent table.
which is basically a table @imposed on the structure representing in-memory state of distributed txns.
Iterating over this table requires acquisition of the for each entry in the table. In 9.2 and 10gR1 and 10gR2,this lock is acquired with an infinite wait time in .
- The above may present a problem in a high activity system where the application logic performs work in short bursts i.e. work is performed in several client -> server roundtrips. Each trip into the database server, would request the DX-enqueue if the session has a distributed txn attached to it.
Additionally, 2PC operations on detached branches also require the DX-enqueue.
The above contributes to DX contention and the ORA-2049 errors reported.
5.3 Cause
The symptoms seem to match , this bug was closed a duplicate of unpublished bug 5843814, following is the problem description from the developers:
Problem description:
XA_RECOVER is blocked by a Fore Ground process holding DX in 'X' mode
REDISCOVERY INFORMATION:
XA_RECOVER is very slow or query on GV$GLOBAL_TRANSACTION is very slow.
Unpublished Bug 5843814 was filed to address performance issues that were encountered when
querying DBA_PENDING_TRANSACTIONS in a high concurrency environment and to resolve the potential issue of acquisition of the DX-enqueue with infinite timeout.
The fix for this issue is to request the enqueue/lock with a timeout and handle the enqueue/lock acquisition timeouts appropriately. Thus relieving the contention issue.
5.4 Solution
is reported on version 9.2 . The base unpublished bug 5843814 was reported and reproduced on both 10.2 and 11.1 and it leads us to believe that the same problem can occur on 9i, 10g or 11g.
To fix the problem, please follow the steps outlined below:
The Original patch created for this issue was patch 5843814 , but then the developers has created new Patch 8354686 to solve some regression and conflict issues reported from the original patch, also the new patch contains also the fix of . the plan to solve this issue then is :
1. Connect to metalink and search for the and make sure to select the correct platform and RDBMS version.
2. If the patch is not available for your system, please open new service request, and ask the assigned analyst to file a new one off request for your platform.
3. please make sure that you are already on the latest patchset before requesting the patch.
4. Apply the patch on testing environment and after verifying the fix ,apply it to the production system.
In addition as per , and the document: Oracle Whitepaper ??????Oracle SOA Suite XA and RAC Database Configuration Guide?????? [XA], on OTN:
There also the same recommendation to apply Patch number : 5843814 which has now been replaced by so I thoght it will be good to mention this as well. .
5.5 References
- QUERY ON DBA_PENDING_TRANSACTIONS HANGS
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29468144/viewspace-1078421/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 由drop datafile導致的oracle bugOracle
- sysbench花式踩坑之三:自增值導致的鎖等待
- enq: TX - allocate ITL entry等待過多導致全域性死鎖ENQ
- ORACLE DML語句鎖機制導致事務等待示例Oracle
- MySQL Flush導致的等待問題MySql
- Oracle阻塞(鎖等待)查詢Oracle
- 一次oracle行級鎖導致的問題Oracle
- 消除 enq: DX - contention 等待事件ENQ事件
- ORACLE鎖等待的處理方法Oracle
- Oracle使用者密碼被鎖定導致的故障Oracle密碼
- oracle BUG 5890312導致表空間瞬間暴漲Oracle
- GoldenGate導致的Streams miscellaneous event等待事件Go事件
- Oracle死鎖一例(ORA-00060),鎖表導致的業務死鎖問題Oracle
- 萬萬沒想到,一個 MongoDB.Driver 的 bug 導致 .NET5 程式死鎖!MongoDB
- 批量解決oracle鎖等待的方法Oracle
- MySQL For Update導致全表排他鎖MySql
- oracle僵死會話鎖住buffer,導致資料庫hang住Oracle會話資料庫
- Oracle 11.2.0.3 Database for AIX bug導致ORA-04030的報錯OracleDatabaseAI
- ORACLE資料庫dataguard配置,rman移機,dx鎖處Oracle資料庫
- @Transactional 中使用執行緒鎖導致了鎖失效執行緒
- Alter system suspend/resume 導致的bug和特性
- ORACLE 11g新特性-允許DDL鎖等待DML鎖Oracle
- MySQL 死鎖和鎖等待MySql
- Oracle 12.2 BUG :分割槽維護導致的 ORA-600 KKPOFPCD3Oracle
- 當心ORACLE 12.2 RAC新特性引入的BUG導致ORA-4031Oracle
- 【OCR】Oracle CRS 10.2.0.1版本Bug導致映象OCR時報PROT-22錯誤Oracle
- 查詢並刪除Oracle中等待的鎖Oracle
- 分散式鎖導致的超賣問題分散式
- 11.2使用KEEP池導致ENQ: KO - Fast Object Checkpoint等待ENQASTObject
- Containerd 的 Bug 導致容器被重建!如何避免?AI
- MySQL Bug導致異常當機的分析流程MySql
- oracle 使用者user鎖定lock如何知道是什麼原因導致的Oracle
- Oracle 12c因bug導致ORA-04031問題處理過程Oracle
- RDSforMySQLInnoDB行鎖等待和鎖等待超時的處理ORMMySql
- 模擬RI鎖定導致阻塞的場景
- 歸檔空間不足導致例項死鎖
- 系統出現cursor: mutex X等待導致例項HANG死Mutex
- 異常等待事件Resmgr:Cpu Quantum導致CPU利用率高事件