Oracle Study之--Oracle等待事件(7)
創(chuàng)新互聯(lián)公司2013年開創(chuàng)至今,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站建設(shè)、
成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元陳倉做網(wǎng)站,已為上家服務(wù),為陳倉各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
Free buffer waits
當(dāng)一個(gè)會(huì)話將數(shù)據(jù)塊從磁盤讀到內(nèi)存中時(shí),它需要到內(nèi)存中找到空閑的內(nèi)存空間來存放這些數(shù)據(jù)塊,當(dāng)內(nèi)存中沒有空閑的空間時(shí),就會(huì)產(chǎn)生這個(gè)等待;除此之外,還有一種情況就是會(huì)話在做一致性讀時(shí),需要構(gòu)造數(shù)據(jù)塊在某個(gè)時(shí)刻的前映像(p_w_picpath),此時(shí)需要申請(qǐng)內(nèi)存來存放這些新構(gòu)造的數(shù)據(jù)塊,如果內(nèi)存中無法找到這樣的內(nèi)存塊,也會(huì)發(fā)生這個(gè)等待事件。
當(dāng)數(shù)據(jù)庫中出現(xiàn)比較嚴(yán)重的free buffer waits等待事件時(shí),可能的原因是:
(1)data buffer 太小,導(dǎo)致空閑空間不夠
(2)內(nèi)存中的臟數(shù)據(jù)太多,DBWR無法及時(shí)將這些臟數(shù)據(jù)寫到磁盤中以釋放空間
這個(gè)等待事件包含2個(gè)參數(shù):
File#: 需要讀取的數(shù)據(jù)塊所在的數(shù)據(jù)文件的文件號(hào)。
Block#: 需要讀取的數(shù)據(jù)塊塊號(hào)。
案例分析:
11:14:33 SYS@ prod>show parameter cache
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_16k_cache_size big integer 24M
db_cache_advice string ON
db_cache_size big integer 16M
db_keep_cache_size big integer 0
db_recycle_cache_size big integer 12M11:21:17 SYS@ prod>conn scott/tiger
Connected.
11:23:16 SCOTT@ prod>begin
11:25:04 2 for i in 1..100000 loop
11:25:04 3 insert into t1 values (i);
11:25:04 4 end loop;
11:25:04 5 end;
11:25:04 6 /
PL/SQL procedure successfully completed.
11:23:29 SYS@ prod>conn tom/tom
Connected.
11:23:38 TOM@ prod>create table t1 as select * from scott.t1;
Table created.
Elapsed: 00:00:02.19
11:23:52 TOM@ prod>begin
11:24:59 2 for i in 1..100000 loop
11:24:59 3 insert into t1 values (i);
11:24:59 4 end loop;
11:24:59 5 end;
11:24:59 6 /
PL/SQL procedure successfully completed.
11:25:12 SYS@ prod>select event,TOTAL_WAITS,AVERAGE_WAIT,EVENT_ID from v$system_event
2* where event like '%buffer%'
EVENT TOTAL_WAITS AVERAGE_WAIT EVENT_ID
---------------------------------------------------------------- ----------- ------------ ----------
latch: cache buffers chains 3 .2 2779959231
free buffer waits 14 .86 2701153470
buffer busy waits 2 .23 2161531084
log buffer space 7 40.42 3357856061
latch: cache buffers lru chain 17 .32 3401628503
buffer deadlock 11 .03 218992928
6 rows selected.
Latch free
在10g之前的版本里,latch free 等待事件代表了所有的latch等待,在10g以后,一些常用的latch事件已經(jīng)被獨(dú)立了出來:
11:25:2name1 SYS@ prod>select name from v$event_name where name like 'latch%' order by 1;
NAME
----------------------------------------------------------------
latch activity
latch free
latch: Change Notification Hash table latch
latch: In memory undo latch
latch: MQL Tracking Latch
latch: PX hash array latch
latch: Undo Hint Latch
latch: WCR: processes HT
latch: WCR: sync
latch: cache buffer handles
latch: cache buffers chains
latch: cache buffers lru chain
latch: call allocation
latch: change notification client cache latch
latch: checkpoint queue latch
latch: enqueue hash chains
latch: gc element
NAME
----------------------------------------------------------------
latch: gcs resource hash
latch: ges resource hash list
latch: lob segment dispenser latch
latch: lob segment hash table latch
latch: lob segment query latch
latch: messages
latch: object queue header operation
latch: parallel query alloc buffer
latch: redo allocation
latch: redo copy
latch: redo writing
latch: row cache objects
latch: session allocation
latch: shared pool
latch: undo global data
latch: virtual circuit queues
33 rows selected.
11:39:21 SYS@ prod>select EVENT#,EVENT_ID,NAME,PARAMETER1,PARAMETER2,PARAMETER3 from v$event_name
2* where name like '%latch free%'
EVENT# EVENT_ID NAME PARAMETER1 PARAMETER2 PARAMETER3
---------- ---------- ------------------------------ ---------- -------------------- ------------------------------
402 3474287957 latch free address number tries
409 2530878290 wait list latch free address number tries
11:32:33 SYS@ prod>desc v$latchname
Name Null? Type
----------------------------------------------------------------- -------- --------------------------------------------
LATCH# NUMBER
NAME VARCHAR2(64)
HASH NUMBER
所以latch free 等待事件在10g以后的版本中并不常見,而是以具體的Latch 等待事件出現(xiàn)。這個(gè)等待事件有三個(gè)參數(shù):Address: 會(huì)話等待的latch 地址。Number: latch號(hào),通過這個(gè)號(hào),可以從v$latchname 視圖中找到這個(gè)latch 的相關(guān)的信息,Tries: 會(huì)話嘗試獲取Latch 的次數(shù)。
11:34:25 SYS@ prod>select * from v$latchname
11:34:36 2 where name like '%buffer%';
LATCH# NAME HASH
---------- ---------------------------------------------------------------- ----------
33 SGA IO buffer pool latch 2719726273
63 IPC stats buffer allocation latch 1449990452
106 KJC global post event buffer 3098969798
145 cache buffers lru chain 3559635447
146 buffer pool 510014793
150 cache buffers chains 3563305585
151 cache buffer handles 892398878
196 media recovery process out of buffers 2731251867
197 mapped buffers lru chain 93631960
208 lock DBA buffer during media recovery 3620457631
350 virtual circuit buffers 1577520421
378 parallel query alloc buffer 291345605
416 p_w_picpath handles of buffered messages latch 3223585260
476 buffer pin latch 3925519355
14 rows selected.
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
分享題目:OracleStudy之--Oracle等待事件(7)-創(chuàng)新互聯(lián)
本文來源:
http://weahome.cn/article/cdcoho.html