log buffer(日誌緩衝區)

達芬奇的夢發表於2017-03-28
log buffer(日誌緩衝區)
change vector is a modification applied to something; executing DML statements
generates change vectors applied to data.
日誌緩衝區是一個很小的,短期集結(change vectors)改變數的地方。
日誌檔案用於確保資料庫中的資料不會丟失。應用於資料塊的(change vectors)將會寫
入日誌檔案中。會話產生日誌資訊到日誌緩衝區,日誌資訊是透過後臺程式LGWR寫入日
志檔案的。因為重做日誌資訊幾乎實時的寫入重做日誌檔案中,所以它比一般的oracle
記憶體結構元件小。所以該緩衝區不需要很大,接受推薦的大小就可以了(基於伺服器的
CPU個數的推薦值)。但是不能設定重做日誌緩衝區小於預設的值,如果這樣oracle會自
動的設定為預設的值。調優的時候也是從預設值開始調整。日誌緩衝區的大小在系統運
行期間是不可調整的,除非重啟系統。可能在DML操作的高峰,日誌資訊產生的速度快於
LGWR的速度,這是DML操作會暫停毫秒。DML的操作速度不可能快過LGWR寫重做日誌的速度
(The process of flushing the log buffer to disk is one of the ultimate
bottlenecks in the Oracle architecture.)

If redo generation is the limiting factor in a database’s performance, the only 
option is to go to RAC. In a RAC database, each instance has its own log buffer,
and its own LGWR. This is the only way to parallelize writing redo data to disk.
The size of the log buffer is static, fixed at instance startup. It cannot be 
automatically managed.

檢視日誌緩衝區大小
SQL> show parameter log_buffer;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_buffer                           integer     5603328

注:觸發LGWR寫日誌緩衝區的條件是:
一個會話執行了commit。
日誌資訊達到了日誌緩衝區大小的三分之一,或者日誌資訊達到1mb。
DBWR打算寫資料緩衝區中的髒資料(沒有commit的資料)。

SQL> alter system set log_buffer=5m scope=spfile;
alter system set log_buffer=5m scope=spfile
 
ORA-02095: 無法修改指定的初始化引數

log_buffer是不能動態調整的。最簡單的方法就是在init.ora檔案中新增一句 "log_buffer=value"。 
然後用這個init.ora重啟Oracle(SQL>startup pfile=init.ora)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31444259/viewspace-2136196/,如需轉載,請註明出處,否則將追究法律責任。

相關文章