Guide to RMAN Archive Log Deletion Across Database

Title: Step-by-Step Guide to RMAN Archive Log Deletion Across Database Incarnations in Oracle RAC

Meta Description: Learn how to safely delete archived logs from previous database incarnations using Oracle RMAN in a RAC environment. A clean, tested, and SEO-optimized process for DBAs.

Introduction

Oracle’s Recovery Manager (RMAN) provides powerful tools for managing archive logs, especially in complex environments like Oracle Real Application Clusters (RAC). However, handling archive logs across multiple database incarnations (post-FLASHBACK or RESETLOGS operations) requires special attention.

In this guide, we walk through a real-world test scenario where we delete specific archive logs from a previous incarnation of a database running on a two-node RAC system. We’ll validate the logs before and after deletion and ensure they do not interfere with the current incarnation.

Important: All instance names and log paths used here are fictional and generated for educational purposes.

Use Case Summary

We want to:

  1. Identify specific archive logs from an older incarnation that are still present.
  2. Delete them cleanly using RMAN.
  3. Confirm that the logs are not visible in the current incarnation before or after the operation.

Environment:

  • Database Type: Oracle RAC (2-node)
  • Target Incarnation SCN: 1479194 (Incarnation 2)
  • Current Incarnation SCN: 40447753
  • Threads Involved: 3 and 4

Selected Archive Logs for Deletion:

ThreadSequenceCompletion Time334825-MAR-2025 04:12:31334925-MAR-2025 04:27:29433725-MAR-2025 04:12:31433825-MAR-2025 04:27:32

Step-by-Step Process

Step 1: Backup the Control File (Best Practice)

rman target /
BACKUP CURRENT CONTROLFILE TAG 'PRE_RMAN_INC_TEST';

Step 2: Validate Log Visibility in Current Incarnation

Run this SQL in SQL*Plus. These logs should not be visible since they belong to a prior incarnation.

SELECT THREAD#, SEQUENCE#, NAME, DELETED
FROM V$ARCHIVED_LOG
WHERE (THREAD#, SEQUENCE#) IN ((3,348), (3,349), (4,337), (4,338));

Step 3: Shutdown and Mount the Database

sqlplus / as sysdba
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;

Step 4: Reset RMAN to the Target Incarnation

rman target /
RESET DATABASE TO INCARNATION 2;

Step 5: Confirm Logs Exist in Incarnation 2

Run this again in SQL*Plus:

SELECT THREAD#, SEQUENCE#, NAME, DELETED
FROM V$ARCHIVED_LOG
WHERE (THREAD#, SEQUENCE#) IN ((3,348), (3,349), (4,337), (4,338));

Expected: DELETED = NO, and logs have valid paths.

Step 6: Delete the Archive Logs

DELETE NOPROMPT ARCHIVELOG SEQUENCE 348 THREAD 3;
DELETE NOPROMPT ARCHIVELOG SEQUENCE 349 THREAD 3;
DELETE NOPROMPT ARCHIVELOG SEQUENCE 337 THREAD 4;
DELETE NOPROMPT ARCHIVELOG SEQUENCE 338 THREAD 4;

Step 7: Verify Deletion

SELECT THREAD#, SEQUENCE#, NAME, DELETED
FROM V$ARCHIVED_LOG
WHERE (THREAD#, SEQUENCE#) IN ((3,348), (3,349), (4,337), (4,338));

Expected: NAME = NULL, DELETED = YES

Step 8: Reset RMAN Back to Current Incarnation

RESET DATABASE TO INCARNATION 4;

Step 9: Final Validation in Current Incarnation

SELECT THREAD#, SEQUENCE#, NAME, DELETED
FROM V$ARCHIVED_LOG
WHERE (THREAD#, SEQUENCE#) IN ((3,348), (3,349), (4,337), (4,338));

Expected: No rows returned, confirming isolation from current incarnation.

Conclusion

Using RMAN to cleanly delete archive logs from previous incarnations is critical for maintaining a healthy FRA and reducing clutter, especially in RAC environments. This guide provided a hands-on example with detailed steps, demonstrating how incarnation handling in Oracle ensures archive log integrity and prevents accidental cross-incarnation interference.

💡 Always backup your control file before such operations and perform them only in MOUNT state.

For more Oracle DBA tips and best practices, subscribe to our newsletter or follow us for regular updates.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *