| Lesson 9 | Tune the common redo log operations |
| Objective | Change parameters to relieve redo log contention. |
log file sync waits (sessions waiting for commit to be hardened)log file parallel write waits (LGWR write latency)log buffer space waits (foreground cannot allocate redo in memory)utlbstat/utlestat era is long over. In Oracle 23ai, you typically diagnose redo contention with:
Start with the system-wide wait profile for redo-related events:
SELECT event, total_waits, time_waited
FROM v$system_event
WHERE event IN ('log file sync',
'log file parallel write',
'log buffer space',
'log file switch (checkpoint incomplete)',
'log file switch completion')
ORDER BY time_waited DESC;
Next, confirm whether the database is switching logs too frequently. A widely used guideline is to avoid excessive switching and target a reasonable interval (for many OLTP systems, on the order of tens of minutes rather than every few minutes). Oracle’s Performance Tuning Guide includes a rough guide of switching at most once every ~20 minutes.
-- Hourly switch counts (adjust interval granularity as needed)
SELECT TRUNC(first_time, 'HH24') AS hour_start,
COUNT(*) AS switches
FROM v$log_history
GROUP BY TRUNC(first_time, 'HH24')
ORDER BY hour_start;
Reference views commonly used for log groups and switch history include V$LOG and V$LOG_HISTORY.
log file parallel write is high, the most effective “tuning” is usually not a parameter tweak:
DB_RECOVERY_FILE_DEST_SIZE to your redo generation rate and retention/backup strategy.SELECT name, space_limit, space_used, space_reclaimable, number_of_files
FROM v$recovery_file_dest;
log file sync is high and LGWR write latency is not the bottleneck, the workload may be committing too frequently:
LOG_SIMULTANEOUS_COPIES and LOG_SMALL_ENTRY_MAX_SIZE appear in older documentation and have long been treated as obsolete/legacy in modern tuning practice.
init.ora/spfile with unusual redo-related settings, validate them against current Oracle documentation and remove unnecessary overrides so the database can use modern defaults and algorithms.
V$SYSSTAT by sampling at two points in time and computing deltas (or by using AWR). For a quick manual sample:
-- Sample 1 (note timestamp)
SELECT name, value
FROM v$sysstat
WHERE name IN ('redo size',
'redo entries',
'redo buffer allocation retries',
'redo log space requests');
After a few minutes, run it again and compute:
log buffer space waits and redo generation bursts.