[Complete Guide] Oracle Archived Redo Log Backup and Operational Management

English

In an Oracle Database, managing Archived Redo Logs is the lifeline for achieving “Complete Recovery,” ensuring zero data loss in the event of a failure. A DBA’s essential duty is to save the online redo logs as files before they are overwritten and to obtain backups using RMAN.

This article provides a comprehensive guide covering everything from confirming the archivelog mode to specific backup procedures, automation, and deletion strategies.


1. What is an Archived Redo Log? (Basic Concepts)

“Online Redo Logs,” which record transaction change history, are cycled (reused) once they become full. If a disk failure occurs after a log has been reused, the history is lost, and recovery to that point becomes impossible.

  • Role of Archived Redo Logs: Copies and saves online redo logs to a separate area before they are overwritten, making the history permanent.
  • Benefits:
    • Complete recovery during failures (minimizing data loss).
    • Building and operating standby databases (Data Guard).
    • Enabling online backups (backups without stopping the database).

2. Confirming and Setting the Mode (ARCHIVELOG Mode)

Here are the steps to confirm if your database is running in “ARCHIVELOG mode” and how to enable it.

2.1 Confirm Current Mode

SELECT LOG_MODE FROM V$DATABASE;
-- 'ARCHIVELOG' means it is enabled.

2.2 Steps to Enable the Mode

Enabling this requires a database restart.

-- 1. Shutdown the DB and start in MOUNT mode
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;

-- 2. Enable the mode
ALTER DATABASE ARCHIVELOG;

-- 3. Open and confirm
ALTER DATABASE OPEN;
SELECT LOG_MODE FROM V$DATABASE;

3. Configuring the Archivelog Destination

Decide the output destination and file naming convention for the logs.

-- Specify the output location
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/archivelog' SCOPE=SPFILE;

-- Specify the file naming convention
ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='arch_%t_%s_%r.log' SCOPE=SPFILE;

-- Restart the DB to apply settings
SHUTDOWN IMMEDIATE;
STARTUP;

4. Backup Procedure Using RMAN

Using RMAN is the standard method for backing up archivelogs.

4.1 Backup Patterns

  • Backup everything: BACKUP ARCHIVELOG ALL;
  • Specify period: BACKUP ARCHIVELOG FROM TIME 'SYSDATE-1'; (Past 24 hours)
  • Specify SCN: BACKUP ARCHIVELOG FROM SCN 10000 UNTIL SCN 20000;
  • Specify sequence: BACKUP ARCHIVELOG UNTIL SEQUENCE 100;

5. Deletion Strategy After Backup

A standard operational practice is to delete files after a successful backup to avoid compressing disk capacity.

5.1 Delete After Successful Backup (Recommended)

The safest method is to instruct deletion at the same time as the backup.

RMAN> BACKUP ARCHIVELOG ALL DELETE INPUT;
  • Benefit: Since deletion occurs only after confirming the backup finished normally, you avoid the risk of data loss.

5.2 Force Delete All Logs (Caution)

RMAN> DELETE ARCHIVELOG ALL;
  • Warning: This deletes files regardless of whether they were backed up, so use with extreme care in production.

6. Automation via FRA (Fast Recovery Area)

If you want to automate storage management, setting up the Fast Recovery Area (FRA) is the most effective solution.

-- Specify size and location for the FRA
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 20G SCOPE=BOTH;
ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '/u01/app/oracle/fast_recovery_area' SCOPE=BOTH;
  • Benefit of FRA: When capacity is near exhaustion, RMAN automatically deletes old backups and archivelogs based on retention policies to reclaim space.

7. Restore and Recovery

Restoration can be easily performed via RMAN.

# Restore all archivelogs
RMAN> RESTORE ARCHIVELOG ALL;

# Restore from a specific SCN
RMAN> RESTORE ARCHIVELOG FROM SCN 10000;

# Recover DB after restoration
RMAN> RECOVER DATABASE;

Operational Considerations

  • Monitoring: If the archivelog destination becomes full, the database will stop. Always automate regular backups using cron or utilize the FRA.
  • Reverting: If you accidentally delete logs that were still required, you will suffer data loss. Maintain a generous retention period.

FAQ: Frequently Asked Questions

Q: Why is NOARCHIVELOG operation not recommended? A: Because in the event of a failure, all updated data since the last backup is lost. From a business continuity perspective, it is unacceptable in production environments.

Q: If I set up FRA, is a backup unnecessary? A: No. The FRA is a temporary storage area. If the FRA storage itself fails, the logs will be lost. Always obtain backups to external media or as separate backup pieces.


Summary

  • Enable ARCHIVELOG mode to guarantee data integrity.
  • Use RMAN with the DELETE INPUT option for safe backup and deletion.
  • Configure the FRA (Fast Recovery Area) to balance automation with space protection.
  • Automate operations using tools like cron to prevent human error.

This article is based on Oracle Database 19c (screens and default values may differ in other versions).

[reference]
Oracle Database Backup and Recovery Reference, 19c

コメント

Copied title and URL