您好,登錄后才能下訂單哦!
Oracle Study之--Oracle等待事件(7)
Free buffer waits
當一個會話將數據塊從磁盤讀到內存中時,它需要到內存中找到空閑的內存空間來存放這些數據塊,當內存中沒有空閑的空間時,就會產生這個等待;除此之外,還有一種情況就是會話在做一致性讀時,需要構造數據塊在某個時刻的前映像(p_w_picpath),此時需要申請內存來存放這些新構造的數據塊,如果內存中無法找到這樣的內存塊,也會發生這個等待事件。
當數據庫中出現比較嚴重的free buffer waits等待事件時,可能的原因是:
(1)data buffer 太小,導致空閑空間不夠
(2)內存中的臟數據太多,DBWR無法及時將這些臟數據寫到磁盤中以釋放空間
這個等待事件包含2個參數:
File#: 需要讀取的數據塊所在的數據文件的文件號。
Block#: 需要讀取的數據塊塊號。
案例分析:
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 12M
11: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事件已經被獨立了出來:
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 等待事件出現。這個等待事件有三個參數:Address: 會話等待的latch 地址。Number: latch號,通過這個號,可以從v$latchname 視圖中找到這個latch 的相關的信息,Tries: 會話嘗試獲取Latch 的次數。 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.
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。