redo的等待log file sync和log file parallel write和redo size設定

dotaddjj發表於2011-11-10

今早上pub,看到pub的一篇帖子中提到了如何設定redo log的大小,利用檢視v$log_history可以檢視redo的切換的具體資訊來判斷。

Select roundfirst_time,’DD’,thead#,count(sequence#) from v$Log_history

group round(first_time,’DD’),thread#

order by 1,2

主要是透過每天的日誌切換量來判斷。

select a.recid,a.first_time,b.first_time last_time,(b.first_time-a.first_time)*24 redo_replace

from v$log_history a,v$log_history b

where a.recid=b.recid-1

order by a.first_time desc

這個sql可以查出兩個日誌切換時間間隔,單位時間間隔為小時,然後還可以參考alter trace等。在設計階段真的要好好考慮!

聯想到跟redo相關的兩個等待事件:log file parallel writelog file sync

Log file parallel write

log bufferretriesredo log檔案,當達到閥值還沒有完成會出現此等待事件。

log file sync

當使用者commit或者rollback時,此時會觸發lgwrredo retries寫入redo log,而使用者程式將通知lgwr寫出操作,lgwr完成任務以後會通知使用者程式,此時達到閥值時就會出現log file sync,這個等待事件是用於程式等待lgwr完成的通知。如果log file parallel writelog file sync出現頻率相同,很有可能log file sync在等待log file parallel write的完成,此時可以判斷磁碟的I/O存在瓶頸。

1 提高lgwr效能,主要從硬體著手。

2 批次提交

以下計算方法和分析摘自eygleblog中計算平均redo寫大小

avg.redo write size = (Redo block written/redo writes)*512 bytes

如果此資料偏小,系統的提交過於頻繁,而過渡頻繁的redo writinglatch競爭.

[@more@]

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

相關文章