oracle 11.2.0.4 rac叢集等待事件enq: TM - contention
近期,一金融客戶oracle 11.2.0.4 rac叢集delete不當導致等待事件enq: TM - contention嚴重引起大範圍會話堆積,記錄的相關分析工作如下。
1、登入叢集任意節點,檢視叢集全域性等待事件
SQL> select event,count(*) from gv$session where wait_class<>'Idle' group by event;
EVENT COUNT(*)
---------------------------------------------------------------- ----------
enq: TM - contention 24
2、檢視等待事件在兩個節點的分佈
節點1:
EVENT COUNT(*)
---------------------------------------------------------------- ----------
SQL*Net message from client 79
rdbms ipc message 64
enq: TM - contention 22
gcs remote message 10
Space Manager: slave idle wait 5
wait for unread message on broadcast channel 4
DIAG idle wait 4
class slave wait 3
Streams AQ: waiting for time management or cleanup tasks 2
Streams AQ: qmn coordinator idle wait 2
PX Deq: Execution Msg 2
VKTM Logical Idle Wait 2
GCR sleep 2
Streams AQ: qmn slave idle wait 2
smon timer 2
pmon timer 2
ges remote message 2
ASM background timer 2
PING 2
PX Deq: Execute Reply 1
節點2:
EVENT COUNT(*)
---------------------------------------------------------------- ----------
SQL*Net message from client 49
rdbms ipc message 32
gcs remote message 5
wait for unread message on broadcast channel 2
class slave wait 2
DIAG idle wait 2
Space Manager: slave idle wait 2
enq: TM - contention 2
smon timer 1
PING 1
Streams AQ: qmn slave idle wait 1
SQL*Net message to client 1
GCR sleep 1
ges remote message 1
VKTM Logical Idle Wait 1
Streams AQ: qmn coordinator idle wait 1
ASM background timer 1
pmon timer 1
Streams AQ: waiting for time management or cleanup tasks 1
19 rows selected.
3、檢視引起enq: TM - contention等待事件的會話資訊
SID USERNAME SQL_ID MODULE MACHINE PROGRAM
---------- ---------- ------------- ---------- ---------------------------------------------------------------- ------------------------------------------------
363 MW_SYS 74j1zd36h4n96 localhost.localdomain
387 MW_SYS 74j1zd36h4n96 localhost.localdomain
602 MW_SYS 74j1zd36h4n96 localhost.localdomain
626 MW_SYS 74j1zd36h4n96 localhost.localdomain
674 MW_SYS 74j1zd36h4n96 localhost.localdomain
1106 MW_SYS 74j1zd36h4n96 localhost.localdomain
1441 MW_SYS 74j1zd36h4n96 localhost.localdomain
1730 MW_SYS 74j1zd36h4n96 localhost.localdomain
1946 MW_SYS 74j1zd36h4n96 localhost.localdomain
1969 MW_SYS 74j1zd36h4n96 localhost.localdomain
1993 MW_SYS 74j1zd36h4n96 localhost.localdomain
1994 MW_SYS 74j1zd36h4n96 localhost.localdomain
2041 MW_SYS 74j1zd36h4n96 localhost.localdomain
2042 MW_SYS 74j1zd36h4n96 localhost.localdomain
2066 MW_SYS 74j1zd36h4n96 localhost.localdomain
2067 MW_SYS 74j1zd36h4n96 localhost.localdomain
2091 MW_SYS 74j1zd36h4n96 localhost.localdomain
2114 MW_SYS 74j1zd36h4n96 localhost.localdomain
2137 MW_SYS 74j1zd36h4n96 localhost.localdomain
2138 MW_SYS 74j1zd36h4n96 localhost.localdomain
2161 MW_SYS 74j1zd36h4n96 localhost.localdomain
2162 MW_SYS 74j1zd36h4n96 localhost.localdomain
2209 MW_SYS 74j1zd36h4n96 localhost.localdomain
2233 MW_SYS 74j1zd36h4n96 localhost.localdomain
24 rows selected.
4、檢視SQL語句74j1zd36h4n96文字資訊
SQL_FULLTEXT
--------------------------------------------------------------------------------
delete from mw_sys.mwt_is_user m where m.user_id not in('0D3C0ACD-C95B-42DA-A5DE
-70F019DAB52B','8697D72E-C77B-4C70-A434-ED7D488ADC36');
5、檢視SQL語句74j1zd36h4n96的執行計劃
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------
SQL_ID 74j1zd36h4n96, child number 0
-------------------------------------
delete from mw_sys.mwt_is_user m where m.user_id not
in('0D3C0ACD-C95B-42DA-A5DE-70F019DAB52B','8697D72E-C77B-4C70-A434-ED7D4
88ADC36')
Plan hash value: 3271715000
----------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------
| 0 | DELETE STATEMENT | | | | 210 (100)| |
| 1 | DELETE | MWT_IS_USER | | | | |
|* 2 | TABLE ACCESS FULL| MWT_IS_USER | 18739 | 951K| 210 (1)| 00:00:03 |
----------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - DEL$1
2 - DEL$1 / M@DEL$1
Outline Data
-------------
/*+
BEGIN_OUTLINE_DATA
IGNORE_OPTIM_EMBEDDED_HINTS
OPTIMIZER_FEATURES_ENABLE('11.2.0.4')
DB_VERSION('11.2.0.4')
OPT_PARAM('_bloom_filter_enabled' 'false')
OPT_PARAM('_optimizer_extended_cursor_sharing' 'none')
OPT_PARAM('_bloom_pruning_enabled' 'false')
OPT_PARAM('_optimizer_extended_cursor_sharing_rel' 'none')
OPT_PARAM('_optimizer_adaptive_cursor_sharing' 'false')
OPT_PARAM('_optimizer_use_feedback' 'false')
ALL_ROWS
OUTLINE_LEAF(@"DEL$1")
FULL(@"DEL$1" "M"@"DEL$1")
END_OUTLINE_DATA
*/
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(("M"."USER_ID"<>'0D3C0ACD-C95B-42DA-A5DE-70F019DAB52B' AND
"M"."USER_ID"<>'8697D72E-C77B-4C70-A434-ED7D488ADC36'))
Column Projection Information (identified by operation id):
-----------------------------------------------------------
2 - (cmp=2; cpy=2,3) "M".ROWID[ROWID,10], "M"."USER_ID"[CHARACTER,36],
"M"."USER_NAME"[VARCHAR2,64], "USER_ISSYSTEM"[CHARACTER,1],
"USER_STATUS"[CHARACTER,1]
55 rows selected.
6、查詢SQL語句74j1zd36h4n96要保留的資料量
SQL> select count(*) from mw_sys.mwt_is_user where user_id ='0D3C0ACD-C95B-42DA-A5DE-70F019DAB52B';
COUNT(*)
----------
1
SQL>
SQL> select count(*) from mw_sys.mwt_is_user where user_id ='8697D72E-C77B-4C70-A434-ED7D488ADC36';
COUNT(*)
----------
1
7、檢視SQL語句74j1zd36h4n96要刪除的資料量
SQL> select count(*) from mw_sys.mwt_is_user m where m.user_id not in('0D3C0ACD-C95B-42DA-A5DE
-70F019DAB52B','8697D72E-C77B-4C70-A434-ED7D488ADC36'); 2
COUNT(*)
----------
18740
8、問題
由以上資訊可知,24個會話分佈在兩個節點上通知對同一張表執行相同的delete操作,而且刪除的資料量是大範圍的,只保留2條記錄,
因此導致嚴重的enq:TM鎖。
9、建議
delete操作分批執行,且控制會話間執行的delete語句刪除的資料沒有交集。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29357786/viewspace-2215381/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle等待事件之enq: TM – contentionOracle事件ENQ
- oracle等待事件之enq: CF – contentionOracle事件ENQ
- 等待事件enq: TX - row lock contention事件ENQ
- [20220518]enq FU - contention等待事件.txtENQ事件
- 故障排除 | enq:TX - index contention等待事件ENQIndex事件
- Oracle Linux 6.7中 Oracle 11.2.0.4 RAC叢集CRS異常處理OracleLinux
- RAC中的enq: TS等待ENQ
- ORACLE RAC 11.2.0.4 FOR RHEL6叢集無法啟動的處理Oracle
- 故障處理】佇列等待之enq: US - contention案例佇列ENQ
- 【故障處理】佇列等待之enq: US - contention案例佇列ENQ
- Oracle Enqueues Wait Events 三 enq: TX - row lock contentionOracleENQAI
- enq: TM - contention解決之道——外來鍵無索引導致鎖爭用ENQ索引
- enq: TX - allocate ITL entry等待事件分析ENQ事件
- enq: TX - row lock contentionENQ
- ORACLE 如何診斷高水位爭用(enq: HW – contention)OracleENQ
- 紅色警報 ORACLE RAC 11.2.0.4 FOR SOLARIS 10 ASM 和DB因叢集心跳丟失重啟OracleASM
- ORACLE RAC 11.2.0.4 ASM加盤導致叢集重啟之ASM sga設定過小OracleASM
- 關於enq: TX - allocate ITL entry等待事件ENQ事件
- oracle rac 11.2.0.3 升級到11.2.0.4Oracle
- oracle RAC 診斷叢集狀態命令Oracle
- [20200120]oracle wait event "enq: SQ – contention" and DBA_DB_LINK_SOURCES.txtOracleAIENQ
- Oracle:Oracle RAC 11.2.0.4 升級為 19cOracle
- Solaris下Oracle RAC 11.2.0.4 安裝方法Oracle
- Oracle叢集(RAC)時間同步(ntp和CTSS)Oracle
- 【TUNE_ORACLE】等待事件之等待事件類別Oracle事件
- 奇異的enq: TX - row lock contentionENQ
- enq: TX - index contention基礎理論ENQIndex
- Oracle RAC日常運維-NetworkManager導致叢集故障Oracle運維
- 【ASK_ORACLE】Relink RAC叢集詳細步驟Oracle
- ORACLE 常見等待事件Oracle事件
- 效能問題,AWR High Event enq: US - contentionENQ
- Oracle優化案例-系統切換引起的enq: SQ - contention(二十八)Oracle優化ENQ
- 11g rac 等待事件resmgr:cpu quantum事件
- 沃趣微講堂 | Oracle叢集技術(二):GI與Oracle RACOracle
- Oracle常見UNDO等待事件Oracle事件
- enq: TX - index contention故障修復一例ENQIndex
- ORACLE 11.2.0.4 RAC RMAN異機恢復之ORA-15001Oracle
- 【TUNE_ORACLE】等待事件之日誌等待“log file sync”Oracle事件