← Redo & Archive Logs
Oracle · Redo & Archive Logs

How to calculate the recommended online redo log size in Oracle

Estimate the ideal Oracle online redo log size from the average log switch period during peak hours over the last 3 days.

Tested on11g12c18c19c21c23ai26ai

Rule of thumb: online redo logs should switch every ~20 minutes under peak load. This measures the average time between switches during your peak window over the last 3 days, then scales the current log size to hit that target. Prompts for peak-hour range in HH24:MI format (e.g. ''09:00'' and ''17:00'').

ACCEPT start_of_peak_hours CHAR PROMPT 'Peak hours start (HH24:MI, e.g. 09:00): '
ACCEPT end_of_peak_hours   CHAR PROMPT 'Peak hours end   (HH24:MI, e.g. 17:00): '

SELECT (SELECT ROUND(AVG(bytes) / 1024 / 1024, 2) FROM v$log) AS "Redo size (MB)",
       ROUND((20 / average_period) * (SELECT AVG(bytes) FROM v$log) / 1024 / 1024, 2)
         AS "Recommended Size (MB)"
FROM (
  SELECT AVG((next_time - first_time) * 24 * 60) AS average_period
  FROM   v$archived_log
  WHERE  first_time > SYSDATE - 3
  AND    TO_CHAR(first_time, 'HH24:MI')
         BETWEEN '&&start_of_peak_hours' AND '&&end_of_peak_hours'
);
redosizingonline redo