DBA Hub

📋Steps in this guide1/15

Difference Between Redo Log and Archive Log in Oracle Database

Learn the difference between Redo Log and Archive Log in Oracle Database. Understand their roles, working, recovery use cases, and DBA best practices.

oracle configurationintermediate
by OracleDba
13 views
1

What is a Redo Log?

A Redo Log is a file that records every change made to the Oracle database , whether the transaction is committed or not. Whenever a user performs an operation like: - INSERT INSERT - UPDATE UPDATE - DELETE DELETE - DDL statements DDL statements Oracle records the change in the Redo Log Buffer , and then LGWR (Log Writer process) writes it to the redo log files.
2

Key Characteristics of Redo Logs

- Stores change vectors (not actual data) Stores change vectors (not actual data) - Written sequentially Written sequentially - Required for instance recovery Required for instance recovery - Works in a circular fashion Works in a circular fashion - Overwritten automatically Overwritten automatically - Mandatory for all Oracle databases Mandatory for all Oracle databases
3

Redo Log Architecture

- Redo Log Buffer (SGA) Redo Log Buffer (SGA) - Online Redo Log Files Online Redo Log Files - Log Groups and Members Log Groups and Members - LGWR Process LGWR Process
4

Why Redo Logs Are Important

- Crash recovery Crash recovery - Instance recovery Instance recovery - Protects against memory failures Protects against memory failures - Ensures database consistency Ensures database consistency Without redo logs, Oracle cannot recover from crashes .
5

What is an Archive Log?

An Archive Log is a copy of a filled redo log file that is saved to a separate location before the redo log is reused. Archive logs are generated only when the database is running in ARCHIVELOG mode . The ARCH (Archiver) process is responsible for copying filled redo logs to archive destinations.
6

Key Characteristics of Archive Logs

- Stores historical redo data Stores historical redo data - Created after redo log switch Created after redo log switch - Used for media recovery Used for media recovery - Not overwritten automatically Not overwritten automatically - Required for point-in-time recovery Required for point-in-time recovery - Mandatory for Data Guard & Standby databases Mandatory for Data Guard & Standby databases
7

Archive Log Architecture

- ARCH Process ARCH Process - Archive Destinations Archive Destinations - Archive Log Files Archive Log Files - FRA (Fast Recovery Area) FRA (Fast Recovery Area)
8

How Redo and Archive Logs Work Together

- User performs a transaction User performs a transaction - Changes go to Redo Log Buffer Changes go to Redo Log Buffer - LGWR writes changes to Redo Log File LGWR writes changes to Redo Log File - Redo Log becomes full Redo Log becomes full - Log switch occurs Log switch occurs - ARCH copies redo log to archive location ARCH copies redo log to archive location - Redo log is reused Redo log is reused This mechanism ensures zero data loss recovery capability when properly configured.
9

Scenario 1: Database Crash

- Oracle uses Redo Logs to recover uncommitted transactions Oracle uses Redo Logs to recover uncommitted transactions - Archive logs are not involved Archive logs are not involved
10

Scenario 2: Disk Failure

- Datafiles are restored from backup Datafiles are restored from backup - Archive logs are applied Archive logs are applied - Database recovers to the latest point Database recovers to the latest point
11

Scenario 3: Data Guard Standby

- Archive logs are shipped to standby Archive logs are shipped to standby - Applied for synchronization Applied for synchronization
12

Scenario 4: Point-in-Time Recovery

- RMAN uses archive logs RMAN uses archive logs - Restores database to a specific SCN or time Restores database to a specific SCN or time
13

What Happens If ARCHIVELOG Mode Is Disabled?

❌ No point-in-time recovery ❌ No Data Guard ❌ Risk of data loss ❌ Limited backup strategy ✔ Only suitable for test or non-critical environments
14

DBA Best Practices

- Always enable ARCHIVELOG mode in production Always enable ARCHIVELOG mode in production - Monitor archive log space (FRA) Monitor archive log space (FRA) - Implement regular archive log backups Implement regular archive log backups - Delete archive logs after backup using RMAN Delete archive logs after backup using RMAN - Multiplex redo logs for high availability Multiplex redo logs for high availability
15

Interview Perspective (Must-Know)

Simple way to explain in interviews: Redo Logs capture live database changes, while Archive Logs store those changes permanently for recovery.

Comments (0)

Please to add comments

No comments yet. Be the first to comment!