top of page

Oracle Redo Logs, Archived Logs and the FRA: Resize, Monitor and Fix ORA-00257 Step by Step

OmerNarman
Sep 4
6 min read

Updated: Oct 24

Every change in an Oracle database is first written to the online redo logs. If they are too small, the database switches logs constantly and sessions wait on "log file switch (checkpoint incomplete)". If the archived logs have nowhere to go, the whole database freezes with ORA-00257. Both problems are easy to prevent once you understand how the pieces fit together.


In this post we cover redo log sizing, an online resize procedure that needs no downtime, and the monitoring and emergency steps for the fast recovery area (FRA).



How Redo Flows Through the Database

  1. Sessions write change vectors into the redo log buffer in memory.

  2. The LGWR process writes the buffer to the current online redo log group (on commit, and at other times).

  3. When the group is full, a log switch happens and LGWR moves to the next group.

  4. In ARCHIVELOG mode, the ARCn processes copy the filled group to an archived log (usually in the FRA).

  5. A group can only be reused once it is archived and the checkpoint covering it is complete. Until then it is ACTIVE.


Each group should have at least two members on different disks (or disk groups), so losing one disk does not lose redo.



Step 1: Look at the Current Redo Log Configuration

Start with an inventory: how many groups, how big, how many members, and which status each group is in.


SQL

SELECT l.thread#, l.group#, l.sequence#, l.bytes/1024/1024 AS size_mb,

l.members, l.status, l.archived

FROM v$log l

ORDER BY l.thread#, l.group#;

SELECT group#, member, type, status

FROM v$logfile

ORDER BY group#;


What to expect: One row per group in V$LOG. STATUS is CURRENT (being written), ACTIVE (needed for crash recovery), INACTIVE (free to reuse) or UNUSED. On RAC each instance has its own thread with its own groups. V$LOGFILE shows each member file. A member with STATUS INVALID or STALE needs attention.



Step 2: Measure How Often Logs Switch

The right size depends on your redo rate. A common goal is a log switch every 15 to 20 minutes at peak load, or about 3 to 4 per hour. Many more switches than that means the logs are too small.


SQL

SELECT TO_CHAR(first_time,'YYYY-MM-DD HH24') AS hour,

thread#,

COUNT(*) AS switches

FROM v$log_history

WHERE first_time > SYSDATE - 7

GROUP BY TO_CHAR(first_time,'YYYY-MM-DD HH24'), thread#

ORDER BY switches DESC

FETCH FIRST 20 ROWS ONLY;


What to expect: The busiest hours of the last week. If the top hours show 30 or 60 switches, the logs are far too small for peak load.



Step 3: Calculate the Right Size

Now turn the redo rate into a size. Measure how many megabytes of redo the busiest hour produced, then size each log so it holds about 15 to 20 minutes of that.


SQL

SELECT TO_CHAR(first_time,'YYYY-MM-DD HH24') AS hour,

ROUND(SUM(blocks * block_size)/1024/1024) AS redo_mb

FROM v$archived_log

WHERE first_time > SYSDATE - 7

AND dest_id = 1

GROUP BY TO_CHAR(first_time,'YYYY-MM-DD HH24')

ORDER BY redo_mb DESC

FETCH FIRST 5 ROWS ONLY;


How to use the result: If the busiest hour produced 24,000 MB of redo, that is 400 MB per minute. For one switch every 20 minutes, each log needs about 8 GB. Round to a clean number, such as 8 GB. You can also check the advisor value in V$INSTANCE_RECOVERY.OPTIMAL_LOGFILE_SIZE if FAST_START_MTTR_TARGET is set.



Step 4: Add New, Larger Log Groups

You cannot resize an existing redo log. Instead, add new groups at the new size, then drop the old ones. This is done online with no downtime. Keep at least three groups per thread (four or more for busy systems), each with two members.


SQL

-- Single instance, ASM, two members per group

ALTER DATABASE ADD LOGFILE GROUP 11 ('+DATA','+FRA') SIZE 8G;

ALTER DATABASE ADD LOGFILE GROUP 12 ('+DATA','+FRA') SIZE 8G;

ALTER DATABASE ADD LOGFILE GROUP 13 ('+DATA','+FRA') SIZE 8G;

ALTER DATABASE ADD LOGFILE GROUP 14 ('+DATA','+FRA') SIZE 8G;

-- RAC: add groups for each thread

ALTER DATABASE ADD LOGFILE THREAD 2 GROUP 21 ('+DATA','+FRA') SIZE 8G;

-- ...and so on for every thread

-- File system example

ALTER DATABASE ADD LOGFILE GROUP 11

('/u02/oradata/PROD/redo11a.log','/u03/oradata/PROD/redo11b.log') SIZE 8G;


What to expect: The new groups appear in V$LOG with STATUS UNUSED. Group numbers are just identifiers. Using a new range (11, 12 ...) makes it obvious which groups are old and which are new.


Tip: If this is a Data Guard primary, also add standby redo logs of the same new size on both the primary and the standby (one more group per thread than the online logs).


Step 5: Move the Database Onto the New Groups

The old groups can only be dropped once they are INACTIVE. Switch logs until the CURRENT group is one of the new ones, then force a checkpoint so the old groups are no longer needed for crash recovery.


SQL

ALTER SYSTEM SWITCH LOGFILE; -- repeat until a new group is CURRENT

-- On RAC, switch all threads at once:

ALTER SYSTEM ARCHIVE LOG CURRENT;

ALTER SYSTEM CHECKPOINT GLOBAL;

SELECT group#, thread#, bytes/1024/1024 AS size_mb, status FROM v$log ORDER BY group#;


What to expect: The old groups show INACTIVE and the database is writing to a new group. If an old group is still ACTIVE, wait a few seconds and repeat the checkpoint.



Step 6: Drop the Old Groups

Drop each old group once it is INACTIVE and archived. Dropping a group only removes it from the control file; with ASM or Oracle Managed Files the files are deleted automatically, while on a file system you remove them yourself.


SQL

ALTER DATABASE DROP LOGFILE GROUP 1;

ALTER DATABASE DROP LOGFILE GROUP 2;

ALTER DATABASE DROP LOGFILE GROUP 3;

SELECT group#, thread#, bytes/1024/1024 AS size_mb, members, status FROM v$log;


Shell

# File system only: remove the old member files after the drop

ls -l /u02/oradata/PROD/redo0*.log

rm /u02/oradata/PROD/redo01a.log /u02/oradata/PROD/redo01b.log


What to expect: ORA-01623 means you tried to drop the CURRENT group, and ORA-01624 means it is still needed for crash recovery. Switch and checkpoint again, then retry. When finished, V$LOG lists only the new 8 GB groups.



Step 7: Monitor the Fast Recovery Area

Archived logs normally go to the FRA. If the FRA fills up and Oracle cannot free any space, the archiver stops, the online logs cannot be reused, and every session that makes a change hangs. Watch the FRA closely.


SQL

SELECT name,

ROUND(space_limit/1024/1024/1024) AS limit_gb,

ROUND(space_used/1024/1024/1024) AS used_gb,

ROUND(space_reclaimable/1024/1024/1024) AS reclaimable_gb,

ROUND((space_used - space_reclaimable)/space_limit*100,1) AS real_used_pct

FROM v$recovery_file_dest;

SELECT file_type, percent_space_used, percent_space_reclaimable, number_of_files

FROM v$recovery_area_usage

ORDER BY percent_space_used DESC;


What to expect: REAL_USED_PCT is the space Oracle cannot free by itself. Alert above 80%. V$RECOVERY_AREA_USAGE shows which file type uses the space: ARCHIVED LOG, BACKUP PIECE, FLASHBACK LOG and so on. Reclaimable space is released automatically when needed, based on your RMAN retention and deletion policies.



Step 8: Recognise an Archiver Stuck Situation

When the FRA is full you will see the following symptoms. Recognising them quickly saves a lot of time during an incident.


Shell

# Alert log

tail -100 $ORACLE_BASE/diag/rdbms/prod/PROD/trace/alert_PROD.log | grep -E "ORA-19809|ORA-19804|ORA-00257|ORA-16038"


SQL

-- Sessions waiting on the archiver

SELECT event, COUNT(*) FROM v$session

WHERE event LIKE 'log file switch%' OR event LIKE 'log archive%'

GROUP BY event;


What to expect: ORA-19809 (limit exceeded for recovery files) and ORA-19804 in the alert log, ORA-00257 (archiver error, connect AS SYSDBA only until resolved) for new connections, and sessions waiting on "log file switch (archiving needed)".



Step 9: Fix an Archiver Stuck Situation

The fastest safe fix is to give the FRA more room immediately, then remove what is no longer needed with RMAN, so the repository stays accurate. Never delete archived logs with rm while the database is running, unless you then crosscheck them in RMAN.


SQL

-- 1. Immediate relief: raise the quota (if the disk group has free space)

ALTER SYSTEM SET db_recovery_file_dest_size = 800G SCOPE=BOTH SID='*';


RMAN

-- 2. Back up archived logs that have no backup yet, then delete them

RMAN> BACKUP ARCHIVELOG ALL NOT BACKED UP 1 TIMES DELETE INPUT;

-- 3. Remove obsolete backups and expired records

RMAN> DELETE NOPROMPT OBSOLETE;

RMAN> CROSSCHECK ARCHIVELOG ALL;

RMAN> DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;


SQL

-- 4. Confirm the archiver is working again

ALTER SYSTEM ARCHIVE LOG CURRENT;

SELECT dest_id, status, error FROM v$archive_dest_status WHERE dest_id = 1;


What this does: Raising DB_RECOVERY_FILE_DEST_SIZE lets the archiver continue within seconds. The RMAN backup with DELETE INPUT moves the archived logs to backup storage (ideally tape or a different disk) and frees space. Once V$ARCHIVE_DEST_STATUS shows VALID with no error, sessions continue on their own.


Tip: If flashback logs are using most of the FRA, check DB_FLASHBACK_RETENTION_TARGET and any guaranteed restore points (V$RESTORE_POINT). A forgotten guaranteed restore point keeps all flashback logs forever.


Step 10: Prevent It from Happening Again

Most FRA incidents have one of three causes: the archived log backup job failed for days, the FRA quota is too small for the redo rate, or a restore point was left behind. Add these checks to your daily monitoring.


SQL

-- When was the last archived log backup?

SELECT MAX(completion_time) AS last_arch_backup

FROM v$backup_set

WHERE backup_type = 'L';

-- Any forgotten guaranteed restore points?

SELECT name, time, guarantee_flashback_database, storage_size/1024/1024/1024 AS gb

FROM v$restore_point;



Summary

Size online redo logs so they switch every 15 to 20 minutes at peak load, keep at least two members per group, and resize them online by adding new groups, switching, checkpointing and dropping the old ones. Monitor the FRA with V$RECOVERY_FILE_DEST and V$RECOVERY_AREA_USAGE, make sure archived log backups run and alert on failure, and keep a short, tested procedure for an archiver stuck situation.

Recent Posts

See All

Comments


bottom of page