What is archive log mode?

What is archive log mode?

In the Oracle world, your database can run in one of two modes: NOARCHIVELOG or ARCHIVELOG. Choosing between them is the difference between having a "Delete" button or a "Save" button for your business history.

Archive Log Mode is the setting that ensures every single change made to your database is preserved in a permanent file. It is the mandatory foundation for any production environment.


1. The Basics: Redo vs. Archive

To understand Archive Log Mode, you have to understand the Online Redo Logs.

  • Online Redo Logs: These are a small set of files (usually 3 or 4) that record every transaction as it happens. They work in a circular fashion. When the last file is full, Oracle circles back and starts overwriting the first one.

  • Archived Redo Logs: When you enable ARCHIVELOG mode, Oracle doesn't just overwrite the old logs. Before it clears an Online Redo Log, a background process (ARCn) makes a copy of it and saves it to a permanent location.


2. Why is this mandatory for Production?

A. Point-in-Time Recovery (PITR)

In NOARCHIVELOG mode, you can only restore the database to the exact moment your last backup finished. If your backup finished at midnight and the database crashes at 4:00 PM, you lose 16 hours of data. In ARCHIVELOG mode, you can restore that midnight backup and then "replay" the archived logs to recover the database to the exact second before the crash.

B. Online Backups (Hot Backups)

If you aren't in Archive Log Mode, you have to shut the database down to take a backup (Cold Backup). In Archive Log Mode, you can back up the database while users are actively reading and writing to it.

C. The Requirement for HA

You cannot use Data Guard or GoldenGate effectively without Archive Log Mode. These technologies rely on those archived streams of data to keep the standby databases in sync.


3. How the Process Works

  1. A user commits a transaction.

  2. The change is written to the Online Redo Log.

  3. The log file fills up (a Log Switch occurs).

  4. The ARCn process wakes up and copies the full log to the Archive Destination.

  5. Only after the copy is successful is the Online Redo Log cleared for new data.


4. Side-by-Side: The Modes

FeatureNOARCHIVELOGARCHIVELOG
Data Loss RiskHigh (Lose everything since last backup).Zero (Recover to the last committed second).
BackupsMust be offline (Offline/Cold).Can be online (Online/Hot).
Storage NeedsLow.Higher (Requires space for logs).
Ideal ForTest/Development (disposable data).Production / Mission Critical.

5. How to Enable It

Switching to Archive Log Mode requires a brief moment of downtime because the database must be in a MOUNT state:

SQL
-- 1. Shut down the database
SHUTDOWN IMMEDIATE;

-- 2. Mount it
STARTUP MOUNT;

-- 3. Change the mode
ALTER DATABASE ARCHIVELOG;

-- 4. Open the database
ALTER DATABASE OPEN;

You can verify the status with: archive log list;


6. The "Golden Rule" of Archiving

If you enable Archive Log Mode, you must have a strategy to manage the files. If the destination (usually the Fast Recovery Area) fills up and Oracle cannot archive a log, the entire database will hang and refuse to process any more transactions until space is cleared.

Peer Tip: Always include DELETE INPUT in your RMAN backup scripts. This tells RMAN to back up the archived logs to a safe place and then delete them from the local disk to prevent your storage from filling up.

Looking for servers Rental ?

Call Our Expert :


  • (call for rental enquiries)

Email us :