等待模擬-cache buffer chain
出現CACHE BUFFER CHAIN 後首先檢視V$SESSION_WAIT 找到P1raw的值,此P1對應了v$latch_children addr和 x$bh 的HLADDR
然後檢視v$latch_children 找到GET最高的LATCH ADDR
select * from v$latch_children where name='cache buffers chains' order by gets desc;
select * from v$latch_children where name='cache buffers chains' order by sleeps desc;
最後和X$BH連線找到物件
檢視當前等待的,注意本語句只能查詢本例項,RAC需要每個例項都進行。
select hladdr,
obj,
b.sid,
b.sql_id,
(select object_name
from dba_objects
where (data_object_id is null and object_id = x.obj)
or data_object_id = x.obj
and rownum = 1) as object_name,
dbarfil,
dbablk,
tch,
TIM
from x$bh x,
(select P1RAW,sql_id,sid from v$session where wait_class<>'Idle' and event='latch: cache buffers chains') b
where HLADDR in (select P1RAW from v$session where wait_class<>'Idle' and event='latch: cache buffers chains')
and x.hladdr=b.P1RAW(+)
order by tch desc;
檢視系統中最為嚴重的
select hladdr,
obj,
(select object_name
from dba_objects
where (data_object_id is null and object_id = x.obj)
or data_object_id = x.obj
and rownum = 1) as object_name,
dbarfil,
dbablk,
tch,
TIM
from x$bh x
where HLADDR in (select addr
from (select *
from (select *
from v$latch_children
where name = 'cache buffers chains'
order by gets desc)
where rownum < 10))
order by tch desc;
測試:
1、建立測試表
create table cbc_test(id number,name char(100));
2、插入資料
insert into cbc_test(id,name)
select rownum,object_name from dba_objects;
insert into cbc_test
select * from cbc_test;
多執行幾次
SQL> select count(*) from cbc_test;
COUNT(*)
----------
401336
3、建立索引
create index cbc_test_idx on cbc_test(id);
4、建立儲存過程進行大量的掃描
create or replace procedure cbc_do_select is
begin
for x in (select /*+ INDEX(cbc_test cbc_test_idx) */ * from cbc_test where id >=0) loop
null;
end loop;
end;
5、模擬足夠多的JOB
var job_no number;
begin
sys.dbms_job.submit(job => :job,
what => 'cbc_do_select;',
next_date => to_date('13-06-2013 10:16:04', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'sysdate+1/2880');
commit;
end;
6、觀察
HLADDR OBJ SID SQL_ID OBJECT_NAME DBARFIL DBABLK TCH TIM
---------------- ---------- ---------- ------------- -------------------------------------------------------------------------------- ---------- ---------- ---------- ----------
000007FF1C0FCBC0 53216 CBC_TEST 1 72322 534 1371092084
000007FF1C7D72E8 53216 CBC_TEST 1 71538 529 1371092084
000007FF1C784708 53216 138 3uakn4vk92jf8 CBC_TEST 1 75337 517 1371092080
000007FF1C0FCBC0 53216 CBC_TEST 1 72089 491 1371092080
000007FF1C7D72E8 53216 CBC_TEST 1 71305 487 1371092080
000007FF1C0FCBC0 53216 CBC_TEST 1 76660 469 1371092080
000007FF1C7D72E8 53216 CBC_TEST 1 75876 466 1371092080
000007FF1CBDB268 53216 CBC_TEST 1 74975 429 1371092082
000007FF1C784708 53216 138 3uakn4vk92jf8 CBC_TEST 1 70999 422 1371092082
000007FF1C784708 53216 138 3uakn4vk92jf8 CBC_TEST 1 75570 421 1371092082
000007FF1C784708 4294967295 138 3uakn4vk92jf8 2 193 26 1371091585
000007FF1C784708 9091 138 3uakn4vk92jf8 WRH$_SGA_TARGET_ADVICE 3 3599 6 1371088807
000007FF1CBDB268 8999 WRH$_SQL_SUMMARY 3 3004 4 1371045615
000007FF1C784708 4226 138 3uakn4vk92jf8 I_WRI$_OPTSTAT_H_OBJ#_ICOL#_ST 3 34198 4 1371045618
000007FF1C7D72E8 8995 WRH$_SQLTEXT 3 34504 3 1371045618
000007FF1C7D72E8 181 C_TOID_VERSION# 1 58291 3 1371086393
000007FF1C784708 93 138 3uakn4vk92jf8 ACCESS$ 1 27386 3 1371014071
000007FF1C0FCBC0 181 C_TOID_VERSION# 1 50399 3 1371086393
000007FF1C784708 181 138 3uakn4vk92jf8 C_TOID_VERSION# 1 14372 3 1371086393
000007FF1CBDB268 101 I_SYN1 1 763 2 1371045607
HLADDR OBJ SID SQL_ID OBJECT_NAME DBARFIL DBABLK TCH TIM
---------------- ---------- ---------- ------------- -------------------------------------------------------------------------------- ---------- ---------- ---------- ----------
000007FF1CBDB268 53100 WRH$_SERVICE_STAT_PK 3 37941 2 1371045619
000007FF1C784708 53090 138 3uakn4vk92jf8 WRH$_PARAMETER 3 38536 2 1371045620
000007FF1C7D72E8 4294967295 2 499 1 1371089114
000007FF1C0FCBC0 52856 WRH$_SQLSTAT_INDEX 3 35288 1 1371045613
000007FF1C0FCBC0 73 IDL_UB1$ 1 11124 1 1371014072
000007FF1C7D72E8 75 IDL_UB2$ 1 6002 1 1370999208
26 rows selected
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-764952/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 33、buffer_cache_3(redo的產生、LRBA、buffer cache裡的等待事件)事件
- IO之核心buffer----"buffer cache"
- Oracle Cache Buffer ChainsOracleAI
- Buffer Cache以及buffer busy waits/gc相關事件AIGC事件
- 【BUFFER】Oracle buffer cache之 latch 學習記錄Oracle
- 【等待事件】library cache pin事件
- 【Cache】將常用的“小表”快取到Buffer Cache快取
- [20220531]模擬inactive session等待事件.txtSession事件
- Linux Buffer/Cache 的區別Linux
- buffer與cache的區別
- 利用cache特性檢測Android模擬器Android
- latch:library cache lock等待事件事件
- 清理buffer/cache/swap的方法梳理
- PostgreSQL DBA(89) - Linux(Buffer vs Cache)SQLLinux
- Linux記憶體、Swap、Cache、BufferLinux記憶體
- DB BUFFER LRU 列表的latch等待
- Cache 和 Buffer 的區別在哪裡?
- Cache 和 Buffer 有什麼區別?
- buffer busy wait 等待事件說明(轉)AI事件
- oracle buffer busy waits等待的含義OracleAI
- buffer cache深度分析及效能調整(五)
- buffer cache深度分析及效能調整(四)
- buffer cache深度分析及效能調整(六)
- 【TUNE_ORACLE】等待事件之“buffer busy waits”Oracle事件AI
- 【TUNE_ORACLE】等待事件之“library cache lock”Oracle事件
- 【TUNE_ORACLE】等待事件之“library cache pins”Oracle事件
- Linux工具效能調優系列二:buffer和cacheLinux
- Linux如何手動釋放Swap、Buffer和CacheLinux
- 如何理解模組化鏈(Modular Chain)?AI
- [20231023]備庫與alter system flush buffer_cache.txt
- 手動釋放Linux上的Swap、Buffer和CacheLinux
- 模擬主執行緒等待子執行緒的過程執行緒
- Cache和Buffer都是快取,有什麼區別?Linux快取Linux
- [20211031]18c row cache mutext等待事件探究.txtMutex事件
- [重慶思莊每日技術分享]-free buffer waits 等待事件AI事件
- XTTS全備開啟BCT後等待事件 block change tracking buffer spaceTTS事件BloC
- node 核心模組學習之 Buffer
- 調整緩衝區快取記憶體(Buffer Cache)的效能(轉)快取記憶體
- [20180305]手工模擬buffer busy wait.txtAI