latch: cache buffers chains-熱塊的簡單模擬實驗
1.建立測試資料.
2.建立兩個儲存過程.
3.簡單模擬幾個併發
session 1:exec pselect2;
session 2:exec pselect2;
session 3:exec pselect2;
session 4:exec pupdate2;
session 5:exec pupdate2;
session 6:exec pupdate2;
...
4.查詢等待事件
5.查詢等待事件引數定義
5.查詢對應熱塊
9 rows selected.
至此模擬出索引熱塊場景.
- create table t1 as select rownum id from dba_objects;
- CREATE INDEX T1_IDX ON T1(ID) ;
2.建立兩個儲存過程.
- create or replace
- PROCEDURE pselect2
- AS
- l_num number;
- BEGIN
- FOR i IN 1..1000000
- LOOP
- SELECT count(*) into l_num FROM T1 where t1.id between 20000 and 30000;
- END LOOP;
- END;
- create or replace
- procedure pupdate2
- AS
- BEGIN
- FOR i IN 1..1000000
- LOOP
- UPDATE t1 SET id = rownum where t1.id between 20000 and 30000;
- COMMIT;
- END LOOP;
- END;
3.簡單模擬幾個併發
session 1:exec pselect2;
session 2:exec pselect2;
session 3:exec pselect2;
session 4:exec pupdate2;
session 5:exec pupdate2;
session 6:exec pupdate2;
...
4.查詢等待事件
- SELECT EVENT,
- P1,
- P1RAW,
- P2,
- P2RAW,
- state
- FROM v$session_wait
- WHERE sid IN
- (SELECT SID FROM V$SESSION WHERE USERNAME='KIN'
- );
- EVENT P1 P1RAW P2 P2RAW STATE
- ------------------------------ ---------- ---------------- ---------- ---------------- --------------------
- latch: cache buffers chains 8468531136 00000001F8C387C0 150 0000000000000096 WAITED SHORT TIME
- latch: cache buffers chains 8066496552 00000001E0CCF828 150 0000000000000096 WAITED SHORT TIME
- latch: cache buffers chains 8064062352 00000001E0A7D390 150 0000000000000096 WAITED SHORT TIME
- SQL*Net message from client 1413697536 0000000054435000 1 0000000000000001 WAITING
- latch: cache buffers chains 8467468736 00000001F8B351C0 150 0000000000000096 WAITED SHORT TIME
- latch: cache buffers chains 8468531136 00000001F8C387C0 150 0000000000000096 WAITED SHORT TIME
- latch: cache buffers chains 8064654952 00000001E0B0DE68 150 0000000000000096 WAITED SHORT TIME
5.查詢等待事件引數定義
- SELECT name,
- PARAMETER1,
- PARAMETER2,
- PARAMETER3
- FROM V$EVENT_NAME
- WHERE name='latch: cache buffers chains';
- NAME PARAMETER1 PARAMETER2 PARAMETER3
- ------------------------------ ------------------------------ ------------------------------ ------------------------------
- latch: cache buffers chains address number tries
5.查詢對應熱塊
- 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='00000001F8C387C0'
- 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;
- SEGMENT_NAME PARTITION_NAME EXTENT# BLOCK# TCH CHILD#
- ------------------------------ ------------------------------ ---------- ---------- ---------- ----------
- SYS.I_OBJ4 17 67 1 30264
- SYS.WRH$_SYSMETRIC_HISTORY_INDEX 20 117 1 30264
- KIN.T1_IDX 7 2 0 30264
- KIN.T1_IDX 7 2 93 30264
- KIN.T1_IDX 7 2 1 30264
- KIN.T1_IDX 7 2 1 30264
- KIN.T1_IDX 7 2 1 30264
- KIN.T1_IDX 7 2 1 30264
- KIN.T1_IDX 7 2 1 30264
9 rows selected.
至此模擬出索引熱塊場景.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22990797/viewspace-754844/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- buffer cache實驗5-latch:cache buffers chainAI
- buffer cache實驗6-latch:cache buffers lru chainsAI
- cache buffers LRU chain latchAI
- latch: cache buffers chainsAI
- latch free(cache buffers chain)AI
- latch:cache buffers chains案例AI
- latch: cache buffers chains---AWR實戰分析AI
- latch:cache buffers chains的優化思路AI優化
- 深入理解latch: cache buffers chainsAI
- Trouble shooting latch: cache buffers chainsAI
- ORACLE等待事件latch: cache buffers chainsOracle事件AI
- 等待事件_cache_buffers_chains_latch事件AI
- 等待事件_cache_buffers_lru_chain_latch事件AI
- 模擬cache buffers chains與library cache pin等待事件AI事件
- 熱點塊競爭和解決--cache buffers chainsAI
- latch:cache buffers chains的最佳化思路AI
- latch:cache buffers chains解決步驟AI
- 一次latch cache buffers chains問題的處理AI
- latch: cache buffers chains故障處理總結(轉載)AI
- 解決一例latch:cache buffers chains小記AI
- cr塊和latch buffer cache chainAI
- 處理 latch_cache_buffers_chains等待事件一例AI事件
- cache buffers chains vs cache buffers lru chainAI
- cache buffers chains and cache buffers lru chainsAI
- 簡單的string類的模擬實現
- buffer busy waits, latch cache buffers chains, read by other session區別AISession
- Spring 架構的簡單模擬實現Spring架構
- oracle實驗記錄 (buffer_cache分析(2)cbc latch)Oracle
- Bug 3797171 cache buffers chains latch contention increased in 10g-3797171.8AI
- 簡單實現.NET Hook與事件模擬Hook事件
- cache buffers lru chainAI
- 模擬簡單的動態代理
- oracle實用sql(13)--併發簡單模擬OracleSQL
- Proteus實現簡單51程式的設計與模擬
- oracle實驗記錄(buffer_cache分析(3)cbc lru chain latch)OracleAI
- 簡單易用的前端模擬資料前端
- 等待模擬-cache buffer chainAI
- LRU Cache 的簡單 C++ 實現C++