Independent senior database engineering · Pittsburgh, PAsbajwa@bajwaconsulting.com

Redo and archive log sizer

Logs switching too often, or the FRA filling up? Enter your log switches per hour or the AWR redo rate. Get the redo log size, groups, standby redo logs, daily archive volume and Fast Recovery Area size, with the commands to apply them.

1 How much redo you generate

2 Targets

Where to get the numbers

-- Log switches per hour, last 7 days, per thread (no extra licence)
SELECT thread#, TO_CHAR(first_time, 'YYYY-MM-DD HH24') hour, COUNT(*) switches
FROM   v$log_history
WHERE  first_time > SYSDATE - 7
GROUP  BY thread#, TO_CHAR(first_time, 'YYYY-MM-DD HH24')
ORDER  BY switches DESC FETCH FIRST 10 ROWS ONLY;

-- Current redo log size and groups
SELECT thread#, group#, bytes/1024/1024 mb, members, status FROM v$log ORDER BY 1, 2;

-- Peak and average redo rate per snapshot (AWR: needs the Diagnostics Pack)
SELECT MAX(maxval) peak_bytes_per_sec, AVG(average) avg_bytes_per_sec
FROM   dba_hist_sysmetric_summary
WHERE  metric_name = 'Redo Generated Per Sec' AND end_time > SYSDATE - 7;