本文轉自惜分飛的博客,博客原文地址:www.xifenfei.com/1109.html,支持原創,分享知識!
當一個數據塊讀入sga區,相應的buffer header會被放置到hash列表上,我們稱其這hash chains,chain在中文的意為鏈條或串的意思,表達就是關連性.如果一個進程想訪問或修改hash chain上的block,它首先要獲得”cache buffers chains” latch。
原因一:低效率的SQL語句(主要體現在邏輯讀過高)
cache buffers chains latch很大程度與邏輯讀有關,所以要觀注v$sql中BUFFER_GETS/EXECUTIONS大的語句。
同時每一個邏輯讀需要一個latch get 操作及一個cpu操作,這樣的sql也會很耗cpu資源。
原因二:熱塊(訪問過於頻繁)
找出熱點塊方法一:
--找出p1raw
select p1,p1raw from v$session_wait where event='latch: cache buffers chains';
--找到對象
SELECT /*+ RULE */
E.OWNER || '.' || E.SEGMENT_NAME SEGMENT_NAME,
E.PARTITION_NAME,
E.EXTENT_ID EXTENT#,
X.DBABLK - E.BLOCK_ID + 1 BLOCK#,
X.TCH,
L.CHILD#
FROM SYS.V$LATCH_CHILDREN L, SYS.X$BH X, SYS.DBA_EXTENTS E
WHERE X.HLADDR = '00000002576EE018'--p1raw
AND E.FILE_ID = X.FILE#
AND X.HLADDR = L.ADDR
AND X.DBABLK BETWEEN E.BLOCK_ID AND E.BLOCK_ID + E.BLOCKS - 1
ORDER BY X.TCH DESC;
找出熱點塊方法二:
--直接找出熱點塊
SELECT OBJECT_NAME, SUBOBJECT_NAME
FROM DBA_OBJECTS
WHERE DATA_OBJECT_ID IN
(SELECT DATA_OBJECT_ID
FROM (SELECT OBJ DATA_OBJECT_ID, FILE#, DBABLK, CLASS, STATE, TCH
FROM X$BH
WHERE HLADDR IN (SELECT ADDR
FROM (SELECT ADDR
FROM V$LATCH_CHILDREN
ORDER BY (GETS + MISSES + SLEEPS) DESC)
WHERE ROWNUM < 10)
ORDER BY TCH DESC)
WHERE ROWNUM < 10);
pmon長期持有cache buffers chains導致實例hang住一例
www.askmaclean.com/...B.html