【效能調整】等待事件(五)log相關等待
9i和10g中的log file相關的等待事件
版本9.2.0.8
SQL> select a.EVENT#,
2 a.NAME name,
3 a.PARAMETER1 p1,
4 a.PARAMETER2 p2,
5 a.PARAMETER3 p3
6 from v$event_name a
7 where a.NAME like '%log%file%' or a.name ='log buffer space';
EVENT# NAME P1 P2 P3
---------- ---------------------------------------- --------------- --------------- ---------------
195 log file sequential read log# block# blocks
196 log file single write log# block# blocks
197 log file parallel write files blocks requests
199 log buffer space
200 log file switch (checkpoint incomplete)
201 log file switch (archiving needed)
202 log file switch (clearing log file)
203 switch logfile command
204 log file switch completion
205 log file sync buffer#
10 rows selected.
SQL>
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
SQL>
版本10.2.0.4
SQL> select a.EVENT#,
2 a.NAME name,
3 a.PARAMETER1 p1,
4 a.PARAMETER2 p2,
5 a.PARAMETER3 p3
6 from v$event_name a
7 where a.NAME like '%log%file%' or a.name ='log buffer space';
EVENT# NAME P1 P2 P3
---------- -------------------------------------------------- --------------- --------------- ---------------
104 log file sequential read log# block# blocks
105 log file single write log# block# blocks
106 log file parallel write files blocks requests
109 log buffer space
110 log file switch (checkpoint incomplete)
111 log file switch (private strand flush incomplete)
112 log file switch (archiving needed)
113 switch logfile command
114 log file switch completion
115 log file sync buffer#
491 log file switch (clearing log file)
11 rows selected.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
5 rows selected.
SQL>
log file sequential read
當程式等待從online redo log中讀取塊時發生,arch程式在讀取redo log的時候會遇到這個等待。
引數:
P1: redo log group內的redo log file的相對序列號
P2: 讀取的起始塊號
P3: 塊數(OS塊數)
大致看看具體情況,歸檔過程前後的total_waits的增長。
SQL> set serveroutput on;
SQL>
SQL> declare
2 v_total_waits v$system_event.TOTAL_WAITS%type;
3 v_TIME_WAITED v$system_event.TIME_WAITED%type;
4 v_WAIT_CLASS v$system_event.WAIT_CLASS%type;
5 begin
6 select a.TOTAL_WAITS,a.TIME_WAITED,a.WAIT_CLASS into
7 v_total_waits,v_TIME_WAITED,v_WAIT_CLASS
8 from v$system_event a where a.EVENT = 'log file sequential read' ;
9 dbms_output.put_line(v_total_waits||','||v_TIME_WAITED||','||v_WAIT_CLASS);
10 execute immediate 'alter system switch logfile';
11 select a.TOTAL_WAITS,a.TIME_WAITED,a.WAIT_CLASS into
12 v_total_waits,v_TIME_WAITED,v_WAIT_CLASS
13 from v$system_event a where a.EVENT = 'log file sequential read' ;
14 dbms_output.put_line(v_total_waits||','||v_TIME_WAITED||','||v_WAIT_CLASS);
15 end;
16 /
15401,11132,System I/O
15403,11132,System I/O
PL/SQL procedure successfully completed
SQL>
log file single write
等待寫logfile寫完成,在更新logfile頭部時發生,在增加一個log file 成員的時候增加序列號時發生。
等待時間:物理io完成時間計時
P1: session當前寫的日誌(組)號
P2: block號
P3: 寫的blocks數
log file parallel write
當session等待LGWR程式從redo buffer中寫redo到所有redo log 組的成員中時發生,一般由LGWR發出。只有當使用非同步IO的時候,LGWR寫active log file member使用parallel,否則將順序寫每個redo log file member。
通常,這個事件意味著緩慢的磁碟,或者redo logs所在磁碟存在io競爭
(LGWR寫入時機:
每三秒寫入一次
在提交或者回滾時寫入
在滿足_LOG_IO_SIZE閥值時
在日誌緩衝區有1m的redo時
dbwr提交時)
引數:
P1: 寫的log file 序列號
P2: os的blocks數
P3: io請求的數量
log buffer space
session等待可用的log buffer 空間時發生。LGWR程式週期性的將log buffer寫入redo log file,以清空log buffer,這個等待意味著應用產生了大量的redo,而LGWR來不及寫日redo files,當然這個大量的只是相對來說的,要麼是因為log buffer太小,要麼是因為redo log file所在磁碟有io競爭。
這個等待時間沒有p1,p2,p3引數
-- 會話級統計必須等待日誌緩衝區的次數。
SELECT s.SID , s.VALUE
FROM v$sesstat s
WHERE s.statistic# =
(SELECT t.statistic#
FROM v$statname t
WHERE t.NAME = 'redo buffer allocation retries')
;
-- 系統級統計必須等待日誌緩衝區的次數
SELECT s.STATISTIC#, s.CLASS, s.NAME , s.VALUE
FROM v$sysstat s
WHERE s.statistic# =
(SELECT t.statistic#
FROM v$statname t
WHERE t.NAME = 'redo buffer allocation retries')
;
log file switch (checkpoint incomplete)
程式等待log file 切換完成,但是 由於這個log file的check point程式沒有完成,使得log file switch不能完成。當redo log file 的大小設定的太小時可能發生。
等待時間:1秒,沒有等待引數
log file switch (archiving needed)
這個等待意味著ARCH程式跟不上LGWR程式寫refo log file的速度,在歸檔模式下,LGWR程式不能覆蓋或者切換redo log file,直到ARCH程式將redo log歸檔到歸檔日誌的目標位置。對歸檔日誌檔案的寫入失敗,可能會終止歸檔程式,並在alert log中報告。
等待時間:1秒,無引數
log file switch (clearing log file)
當log正在使用CLEAR LOGFILE命令清除時,或者恢復執行時清除logfile時等待一個log switch。
等待時間:1秒,無引數
log file switch completion
等待log switch完成
等待時間1秒,無引數
log file sync
當一個使用者session完成一個事務(提交或回滾),在繼續這個session的操作之前,session的redo資訊必須由LGWR寫入redo log,程式將在這個事件上等待直到LGWR程式完全寫redo log file的io。調整LGWR程式使其得到良好的磁碟吞吐量。如:不要將重做日誌放在RAID5陣列;如果有大量的短週期的事務,則看能否批處理這些事務,使COMMIT次數減少。
主要從三個方面來考慮這個等待事件:
1, 是否有高提交率,可以使用10046事件進行追蹤或者使用log miner對日誌分析。
2, Io子系統的速率如何,可以從v$system_event中獲得LGWR的平均等待時間。
3, 日誌緩衝區是否太大,過大的緩衝區,使得LGWR一次寫入量變大,寫入頻率變慢
引數:
P1: log buffer中需要被同步的buffer數量
等待時間1秒
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16179598/viewspace-675768/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- log file sync等待事件事件
- 【等待事件】log file sync事件
- 【TUNE_ORACLE】等待事件之日誌等待“log file sync”Oracle事件
- [20201204]關於等待事件Log File Sync.txt事件
- 【TUNE_ORACLE】等待事件之日誌等待“log file parallel write”Oracle事件Parallel
- 【WAIT】 log file sync等待事件說明AI事件
- log file sync等待事件處理思路事件
- Solidity事件,等待事件Solid事件
- 【TUNE_ORACLE】等待事件之等待事件類別Oracle事件
- 基於等待事件的效能診斷(轉)事件
- Selenium等待事件Waits事件AI
- 關於enq: TX - allocate ITL entry等待事件ENQ事件
- 【TUNE_ORACLE】等待事件之IO等待“read by other session”Oracle事件Session
- 【TUNE_ORACLE】等待事件之IO等待“direct path read”Oracle事件
- 【TUNE_ORACLE】等待事件之IO等待“direct path write”Oracle事件
- read by other session等待事件Session事件
- ORACLE 常見等待事件Oracle事件
- latch等待事件彙總事件
- Latch free等待事件(轉)事件
- gc cr request等待事件GC事件
- 【等待事件】library cache pin事件
- 【TUNE_ORACLE】等待事件之IO等待“db file scattered read”Oracle事件
- 【TUNE_ORACLE】等待事件之IO等待“direct path write temp”Oracle事件
- 【TUNE_ORACLE】等待事件之IO等待“db file sequential read”Oracle事件
- 【TUNE_ORACLE】等待事件之IO等待“db file parallel write”Oracle事件Parallel
- Latch free等待事件四(轉)事件
- Latch free等待事件三(轉)事件
- db file scattered read等待事件事件
- db file sequential read等待事件事件
- latch:library cache lock等待事件事件
- Oracle常見UNDO等待事件Oracle事件
- Latch free等待事件二(轉)事件
- LightDB/PostgreSQL等待事件 Lock transactionidSQL事件
- openGauss/MOGDB與PG等待事件事件
- Cell smart table scan等待事件事件
- read by other session 等待事件分析Session事件
- 【等待事件】db file sequential read事件
- 【等待事件】db file scattered read事件
- 【等待事件】virtual circuit next request事件UI