awr报告中搜索"Mutex Sleep Summary",定位到Mutex Sleep Summary部分,也能获取一些有价值的东西,如下:
Mutex Type | Location | Sleeps | Wait Time (ms) |
---|---|---|---|
Library Cache | kglpnal2 91 | 532 | 0 |
Library Cache | kglpin1 4 | 147 | 0 |
Library Cache | kglhdgn2 106 | 144 | 0 |
Library Cache | kgllkdl1 85 | 141 | 0 |
Library Cache | kglhdgn1 62 | 129 | 0 |
Library Cache | kgllkc1 57 | 95 | 0 |
Library Cache | kglpndl1 95 | 83 | 0 |
Library Cache | kglget2 2 | 72 | 0 |
Library Cache | kglpnal1 90 | 61 | 0 |
Library Cache | kgllkal1 80 | 44 | 0 |
Cursor Pin | kkslce [KKSCHLPIN2] | 41 | 0 |
Library Cache | kglget1 1 | 22 | 0 |
Cursor Pin | kksLockDelete [KKSCHLPIN6] | 17 | 0 |
Cursor Pin | kksfbc [KKSCHLPIN1] | 15 | 0 |
Cursor Pin | kksfbc [KKSCHLFSP2] | 13 | 0 |
Library Cache | kglhdgh1 64 | 12 | 0 |
Library Cache | kgldtin1 42 | 11 | 0 |
Library Cache | kglrfcl1 79 | 9 | 0 |
Library Cache | kglobpn1 71 | 7 | 0 |
Cursor Parent | kkscsAddChildNode [KKSPRTLOC34] | 3 | 0 |
Cursor Parent | kkscsPruneChild [KKSPRTLOC35] | 3 | 0 |
hash table | kkscsSearchChildList [KKSHBKLOC2] | 1 | 0 |
hash table | kkshGetNextChild [KKSHBKLOC1] | 1 | 0 |
找到blocker:
SELECT SQL_ID, ACTION, BLOCKING_SESSION, BLOCKING_SESSION_STATUS
FROM v$session
WHERE SID=&SID_OF_WAITING_SESSION;
BLOCKING_SESSION列就是mutex x的持有者session
10g版本:
SELECT decode(trunc(&&P2/4294967296),
0,trunc(&&P2/65536),
trunc(&&P2/4294967296)) SID_HOLDING_MUTEX
FROM dual;
另外 的参考文章:
Troubleshooting Databases Hang Due to Heavy Contention for 'library cache: mutex X' Waits (Oracle 11.2 and Later) (Doc ID 2051456.1)