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
- enq:TM-contention事件等待ENQ事件
- zt_Oracle enq: TX contention 和 enq: TM contention 等待事件OracleENQ事件
- enq: TM - contention TM 等待事件的原因及模擬ENQ事件
- oracle等待事件之enq: CF – contentionOracle事件ENQ
- enq: WF - contention等待事件ENQ事件
- enq: CF - contention 等待事件ENQ事件
- enq: TS - contention 等待事件ENQ事件
- enq: TM - contentionENQ
- enq:TM contentionENQ
- 等待事件之enq: HW - contention事件ENQ
- 消除 enq: DX - contention 等待事件ENQ事件
- 等待事件enq: TX - row lock contention事件ENQ
- 【等待事件】-enq: TX - row lock contention事件ENQ
- 故障排除 | enq:TX - index contention等待事件ENQIndex事件
- 等待事件enq TX row lock contention分析事件ENQ
- 如何診斷等待事件 enq: HW - contention事件ENQ
- 【效能調整】等待事件 enq: SQ - contention事件ENQ
- 事務上的等待事件 —— enq: UL - contention事件ENQ
- enq: SQ - contention 等待事件處理辦法ENQ事件
- enq: TX - row lock contention等待事件處理ENQ事件
- enq: TX - index contention等待ENQIndex
- [20161208]等待事件enq: HW - contention事件ENQ
- [20140311]等待事件enq HW - contention事件ENQ
- [20220518]enq FU - contention等待事件.txtENQ事件
- enq: SQ - contention" waits in RACENQAI
- awr報告中顯示enq: TM - contention 處理方法ENQ
- 大量insert引起的enq: HW - contention等待ENQ
- RAC中的enq: TS等待ENQ
- Oracle Linux 6.7中 Oracle 11.2.0.4 RAC叢集CRS異常處理OracleLinux
- 故障處理】佇列等待之enq: US - contention案例佇列ENQ
- 【故障處理】佇列等待之enq: US - contention案例佇列ENQ
- 資料庫出現很高的enq: DX - contention 等待資料庫ENQ
- 【故障處理】佇列等待之enq IV - contention案例佇列ENQ
- ORACLE RAC 11.2.0.4 FOR RHEL6叢集無法啟動的處理Oracle
- enq: US - contentionENQ
- enq: HW - contentionENQ
- enq: DX - contentionENQ