Skip to content

Instantly share code, notes, and snippets.

@deshneni-akhil
Last active April 25, 2025 18:54
Show Gist options
  • Select an option

  • Save deshneni-akhil/abb991d1067d188fedfbff15a493f28a to your computer and use it in GitHub Desktop.

Select an option

Save deshneni-akhil/abb991d1067d188fedfbff15a493f28a to your computer and use it in GitHub Desktop.
Provides information on how to do backup using RMAN utility on Oracle19c

Oracle Database Backup Procedure Using RMAN

Overview

This document details the RMAN backup procedure for Oracle Database, outlining methods for both offline (consistent) and online (inconsistent) backups.

Definitions

  • Consistent Backup (Offline): Requires database downtime. The database must be shut down cleanly, causing application outage. Not ideal for production environments due to downtime.
  • Inconsistent Backup (Online): Performed while the database remains online and accessible. Requires the database to operate in ARCHIVELOG mode to preserve transactional integrity.

Backup Method Selected

To ensure uninterrupted database operation, the online backup method is selected. This backup method allows transactions and database access to continue seamlessly during backup.

Preconditions

  • The database must be running in ARCHIVELOG mode.

  • Verify ARCHIVELOG mode using the command:

    sqlplus / as sysdba
    ARCHIVE LOG LIST;

    Status: Verified that the database is already in ARCHIVELOG mode.

RMAN Configuration

Set RMAN to automatically back up control files for safety and ease of recovery:

rman target /
CONFIGURE CONTROLFILE AUTOBACKUP ON;

Backup Location

Backups will be stored on a dedicated drive:

  • Drive: F:
  • Directory: F:\rman_backup
  • Available Space: 184 GB (adequate for the current database size)

RMAN Backup Command

Execute the following RMAN commands to perform the backup on a single processor:

RUN {
  ALLOCATE CHANNEL c1 DEVICE TYPE DISK FORMAT 'F:\rman_backup\backup_%U.bkp';
  
  BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
  
  RELEASE CHANNEL c1;
}

Given that the server has multiple logical processors (e.g., 4 logical processors), we will allocate parallel RMAN backup channels to optimize performance. To maintain a balance between backup efficiency and ongoing database operations, approximately 50% of available processing capacity will be dedicated to backup tasks. This balanced approach ensures minimal impact on live database performance while significantly speeding up the backup operation.

RUN {
  ALLOCATE CHANNEL c1 DEVICE TYPE DISK FORMAT 'F:\rman_backup\backup_%U.bkp';
  ALLOCATE CHANNEL c2 DEVICE TYPE DISK FORMAT 'F:\rman_backup\backup_%U.bkp';
  
  BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG;
  
  RELEASE CHANNEL c1;
  RELEASE CHANNEL c2;
}

Explanation:

  • ALLOCATE CHANNEL: Specifies backup destination and file naming.
  • COMPRESSED BACKUPSET: Optimizes storage usage.
  • PLUS ARCHIVELOG: Ensures transaction logs are included, allowing complete database restoration.

Result

  • Creates multiple backup pieces ensuring a complete, recoverable database state.
  • Database remains online and fully operational during the backup.

Post-Backup Verification

To verify successful completion, use:

LIST BACKUP OF DATABASE COMPLETED BETWEEN 'SYSDATE-1' AND 'SYSDATE';

This will list backup sets and pieces, confirming backup integrity and completeness.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment