Redo Write Size

redo writes的大小是变化的,与要写的the amount of redo有关。


8i开始,LGWR试图避免等待向log buffer的不完全拷贝(也就是不等待正向log buffer拷贝redo的完成)。因此,对于后台写(3秒或1/3满),lgwr写到redo thread的末尾,或者到不包含持有redo copy latch redo record的最后一个块。对于COMMIT and DBWn sync writes,如果低于sync RBAredo record依然持有redo copy latch,那么lgwr使用特殊的LGWR wait for redo copy event等待该latchLgwr does not attempt to take the latch, and thus does not wait for it directly under the latch free event.其后,lgwr至少写到需要同步的the highest redo block,并且possibly further subject to the retention of redo copy latches over subsequent redo records.

Lgwr不强迫the size of its writesmaximum physical I/O size.在单次写操作中,他写所有redo,并且如果必要的话,允许操作系统使用multiple physical writes完成写请求。

写出的total number of log blocks累计在system statisticredo blocks writtenThe number of redo writes累计在system statisticredo writes这两个统计能够用来计算average redo write size.统计计算脚本:

set termout off
column log_block_size new_value LogBlockSize
select
  max(lebsz) log_block_size
from
  sys.x_$kccle
where
  inst_id = userenv('Instance')
/
set termout on

column write_size format 99999999999999 heading "Average Log|Write Size"

select
  ceil(max(decode(name, 'redo blocks written', value))
      /max(decode(name, 'redo writes', value, 1)))
  * &LogBlockSize  write_size
from
  sys.v_$sysstat
/

column threshold  format 99999999999999 heading "Background|Write Theshold"

select
  least(ceil(value/&LogBlockSize/3) * &LogBlockSize, 1024*1024)  threshold
from
  sys.v_$parameter
where
  name = 'log_buffer'
/

column sync_cost_ratio format 990.00 heading "Sync Cost Ratio"

select
  (sum(decode(name, 'redo synch time', value)) / sum(decode(name, 'redo synch writes', value)))
  / (sum(decode(name, 'redo write time', value)) / sum(decode(name, 'redo writes', value)))
    sync_cost_ratio
from
  sys.v_$sysstat
where
  name in ('redo synch writes', 'redo synch time', 'redo writes', 'redo write time')
/
请使用浏览器的分享功能分享到微信等