Managing Redo log   «Prev  Next»
Lesson 2 Protecting redo log files
Objective Properly place and multiplex redo log files.

Oracle Database 23ai: Properly Placing and Multiplexing Redo Log Files

Best practices guide for Oracle AI Database (23ai)

1. Proper Placement of Redo Log Files

Key principles:

Example: Creating a New Multiplexed Group in ASM

ALTER DATABASE ADD LOGFILE 
  GROUP 4 ('+DATA', '+RECO') SIZE 1G;

Sizing Guidelines

Target log switches every 15–30 minutes during peak load.

Peak Redo Rate Recommended Log Size
≤ 5 MB/s1–4 GB
5–25 MB/s4–16 GB
25–50 MB/s16–32 GB
> 50 MB/s32 GB+

Number of groups: Minimum 2 (required). Recommended 3–4+ per thread (especially RAC).

2. Multiplexing Redo Log Files

Oracle strongly recommends multiplexing. Each redo log group consists of one or more identical members. LGWR writes concurrently to all members of the current group.

Benefit: Protection against media failure, I/O errors, or corruption. Eliminates a single point of failure for redo.

Best Practices

SQL Examples

Check Current Configuration

-- Groups
SELECT group#, thread#, bytes/1024/1024 AS "Size MB", members, status 
FROM v$log ORDER BY group#;

-- Members
SELECT group#, member, status FROM v$logfile ORDER BY group#;

Add a New Multiplexed Group

ALTER DATABASE ADD LOGFILE 
  GROUP 10 ('+DATA/redo10a.log', '+RECO/redo10b.log') SIZE 1G;

Add a Member to an Existing Group

ALTER DATABASE ADD LOGFILE MEMBER '+RECO/redo01b.log' TO GROUP 1;

Force Log Switches & Cleanup (for resizing)

ALTER SYSTEM SWITCH LOGFILE;
ALTER SYSTEM CHECKPOINT;
ALTER DATABASE DROP LOGFILE GROUP 1;  -- Only when INACTIVE

Overall Best Practices Summary

Aspect Recommendation Reason
Multiplexing≥ 2 members/groupRedundancy
PlacementDifferent disks/failure groupsSurvive hardware failure
StorageFast storage (+DATA)LGWR performance
Groups3–4+ per threadAvailability during archiving
Size15–30 min switchesBalance perf vs recovery
ASM+DATA + +RECOModern standard

Monitoring

-- Recent switches
SELECT TRUNC(first_time, 'HH24') AS hour, COUNT(*) AS switches
FROM v$log_history
WHERE first_time > SYSDATE - 1
GROUP BY TRUNC(first_time, 'HH24')
ORDER BY hour;

Purpose of redo logs

The purpose of a redo log file is to preserve a record of committed transactions for a database. Oracle uses this record for two purposes:
  1. crash recovery and
  2. media recovery.
The record preserved in the redo log allows Oracle to recover committed changes that would otherwise be lost in the event of a system crash. The combination of archived and online redo log files allows you to:
  1. Restore a data file from a backup, and
  2. Replay all the subsequent changes to bring the data file up to date.

Protecting redo logs

If you lose your redo log files, you lose your ability to recover fully from a crash or a drive failure. How then do you protect the redo log files? The answer is that you mirror them. Redo log files need to be mirrored just as control files need to be mirrored. The following multiplex illustrates one possible mirroring scenario:

Four-stage Oracle Database 23ai diagram showing three multiplexed online redo log groups, each with identical members distributed across three independent storage devices, continuing to write as one and then two devices fail.
Multiplexed online redo log members are distributed across independent storage so LGWR can continue writing when a member or storage device fails; failed members should be replaced promptly.


Mirroring: hardware versus software

On some systems, particularly UNIX systems, you may have the choice of using either hardware or software mirroring. The question then becomes which to use? I once posed that question to an Oracle newsgroup, and it induced some amount of debate. There's certainly a performance advantage to mirroring in hardware, but there appears to be a slight theoretical risk of hardware-induced corruption as well. Personally, I'm a bit paranoid, and use both hardware and software mirroring, preferring not to place all my eggs in one basket.
With hardware mirroring, you can have just one redo log member in each group as far as Oracle is concerned, and leave the job of writing a duplicate copy to the hardware RAID controller. When software mirroring is used, it is the Oracle software that writes to each redo log member. In the next lesson, you will learn how to list the redo log files in your database to see how many groups you have and how many members you have in each group.

SEMrush Software 2 SEMrush Banner 2