加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

关于Oracle 数据库等待事件library cache: mutex X

发布时间:2020-12-12 14:42:46 所属栏目:百科 来源:网络整理
导读:参考自: WAITEVENT: "library cache: mutex X" (Doc ID 727400.1) The library cache mutex is acquired for similar purposes that the library cache latches were acquired in prior versions of Oracle. In 10g,mutexes were introduced for certain oper
Library Cache kglpnal2 91 532 0 Library Cache kglpin1 4 147 0 kglhdgn2 106 144 kgllkdl1 85 141 kglhdgn1 62 129 kgllkc1 57 95 kglpndl1 95 83 kglget2 2 72 kglpnal1 90 61 kgllkal1 80 44 Cursor Pin kkslce [KKSCHLPIN2] 41 kglget1 1 22 kksLockDelete [KKSCHLPIN6] 17 Cursor Pin kksfbc [KKSCHLPIN1] 15 kksfbc [KKSCHLFSP2] 13 kglhdgh1 64 12 kgldtin1 42 11 kglrfcl1 79 9 kglobpn1 71 7 Cursor Parent kkscsAddChildNode [KKSPRTLOC34] 3 Cursor Parent kkscsPruneChild [KKSPRTLOC35] 3 hash table kkscsSearchChildList [KKSHBKLOC2] 1 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
 

11g及其更高的版本:
10g版本:
 SELECT decode(trunc(&&P2/4294967296),trunc(&&P2/65536),trunc(&&P2/4294967296)) SID_HOLDING_MUTEX
 FROM dual;

若是用以上找不到blocker,那就有可能是bug,
请参考:WAITEVENT: "library cache: mutex X" (Doc ID 727400.1)文档中的"Known Bugs"部分.


另外 的参考文章:

Troubleshooting Databases Hang Due to Heavy Contention for 'library cache: mutex X' Waits (Oracle 11.2 and Later) (Doc ID 2051456.1)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

参考自:
WAITEVENT: "library cache: mutex X" (Doc ID 727400.1)

The library cache mutex is acquired for similar purposes that the library cache latches were acquired in prior versions of Oracle.
In 10g,mutexes were introduced for certain operations in the library cache.
Starting with 11g,the library cache latches were replaced by mutexes,hence this new wait event.

Mutexes are a lighter-weight and more granular concurrency mechanism than latches.
Mutexes take advantage of CPU architectures that offer the compare and swap instructions (or similar).
The reason for obtaining a mutex in the first place,is to ensure that certain operations are properly managed for concurrency.
E.g.,if one session is changing a data structure in memory,
then another session must wait to acquire the mutex before it can make a similar change - this prevents unintended changes that would lead to corruptions or crashes if not serialized.

This wait event is present whenever a library cache mutex is held in exclusive mode by a session and other sessions need to wait for it to be released.
There are many different operations in the library cache that will require a mutex,
so its important to recognize which "location" (in Oracle's code) is involved in the wait.
"Location" is useful to Oracle Support engineers for diagnosing the cause for this wait event

awr报告中搜索"Mutex Sleep Summary",定位到Mutex Sleep Summary部分,也能获取一些有价值的东西,如下:

Mutex Sleep Summary

  • ordered by number of sleeps desc
Mutex Type Location Sleeps Wait Time (ms)
    推荐文章
      热点阅读