Showing posts with label Rman. Show all posts
Showing posts with label Rman. Show all posts

May 5, 2025

RMAN Configuration Demystified: A Practical Deep Dive for DBAs – Part 3

RMAN Configuration Demystified: A Practical Deep Dive for DBAs – Part 3

LIST Commands:-

Command

Description

LIST BACKUP OF DATABASE;

Lists all backup sets (full, incremental, archivelogs) related to the entire database.

LIST COPY OF DATAFILE 1, 2;

Lists image copies of datafiles 1 and 2. These are exact file copies, not in backup set format.

LIST BACKUP OF ARCHIVELOG FROM SEQUENCE 10;

Shows archive log backups starting from sequence 10 onward.

LIST BACKUPSET OF DATAFILE 1;

Lists backup sets that include datafile 1.

LIST BACKUP;

Shows all backup sets and image copies in the RMAN catalog/control file.

LIST COPY;

Lists all image copies (of datafiles, control files, etc.).

LIST ARCHIVELOG ALL;

Lists all archived redo logs known to RMAN (including backed-up or not).

LIST RESTORE POINT <Restore_point_name>;

Lists a specific restore points details. Useful for point-in-time recovery.

LIST RESTORE POINT ALL;

Lists all restore points in database.

LIST EXPIRED BACKUP;

Lists expired backups (files not found on disk, marked expired by RMAN).

LIST BACKUP SUMMARY;

Provides a summary view (high-level) of backup sets — size, date, device type, etc.

LIST BACKUPSET TAG 'weekly_full_db_backup';

Lists backup sets with a specific tag (e.g., full weekly backups).

LIST BACKUPSET 213;

Displays information about backupset with ID 213.

LIST COPY OF DATAFILE 2 COMPLETED BETWEEN '10-DEC-2024' AND '17-DEC-2024';

Shows image copies of datafile 2 completed within a date range.

LIST BACKUP OF DATAFILE 1;

Lists backups that include only datafile 1.




REPORT Commands:-

Command

Description

REPORT OBSOLETE;

Lists backups that are no longer needed according to current retention policy (can be deleted).

REPORT SCHEMA;

Displays the current database schema as seen by RMAN (tablespaces, datafiles).

REPORT NEED BACKUP;

Shows files that need a backup based on the retention policy.

REPORT NEED BACKUP RECOVERY WINDOW OF 2 DAYS DATABASE DEVICE TYPE SBT;

Reports files that need a backup to satisfy a 2-day recovery window for tape.

REPORT NEED BACKUP DEVICE TYPE DISK;

Same as above, but for disk-based backups.

REPORT NEED BACKUP TABLESPACE USERS DEVICE TYPE SBT;

Shows if tablespace USERS needs backup on tape.

REPORT OBSOLETE RECOVERY WINDOW OF 3 DAYS;

Lists backups that fall outside a 3-day recovery window — can be purged.

REPORT OBSOLETE REDUNDANCY 1;

Lists backups that exceed a redundancy of 1 copy, meaning you can safely delete extras.


CROSSCHECK Commands:-

Command

Description

CROSSCHECK BACKUP DEVICE TYPE DISK;

Checks all disk-based backups to ensure the files still exist on disk.

CROSSCHECK BACKUP DEVICE TYPE SBT;

Checks tape-based (SBT) backups for availability.

CROSSCHECK BACKUP;

Validates all backups: backup sets, image copies, proxy copies — regardless of device type.

CROSSCHECK COPY OF DATABASE;

Validates all image copies of the entire database (datafiles, controlfiles, etc.).

CROSSCHECK BACKUPSET 1338, 1339, 1340;

Checks specific backup sets by ID numbers.

CROSSCHECK BACKUPPIECE TAG nightly_backup;

Checks all backup pieces that were tagged with nightly_backup.

CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;

Verifies backups of all archivelogs and SPFILEs.

CROSSCHECK CONTROLFILECOPY '/tmp/control01.ctl';

Checks the availability of a control file copy at a specific location.



DELETE Commands:-

Command

Description

DELETE BACKUPPIECE 101;

Deletes the specific backup piece with ID 101 from disk or tape.

DELETE CONTROLFILECOPY '/tmp/control01.ctl';

Deletes a control file copy located at /tmp/control01.ctl.

DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE 300;

Deletes all archived redo logs up to sequence 299, without prompting for confirmation. Useful for space management.

DELETE BACKUP TAG 'before_upgrade';

Deletes all backups (sets or copies) with the tag before_upgrade. Helpful in identifying backups made for specific events.

DELETE ARCHIVELOG ALL BACKED UP 3 TIMES TO SBT;

Deletes all archived logs that have been successfully backed up 3 times to tape (SBT). Ensures recoverability is retained before deletion.

DELETE EXPIRED BACKUP;

Deletes all expired backups (files that were marked as EXPIRED after a CROSSCHECK operation).

DELETE OBSOLETE;

Deletes all backups (datafile, archivelog, controlfile, etc.) no longer needed according to the configured retention policy (either redundancy or recovery window).


May 2, 2025

RMAN Configuration Demystified: A Practical Deep Dive for DBAs – Part 2

 

RMAN Configuration Demystified: A Practical Deep Dive for DBAs – Part 2

 

RMAN > CONFIGURE DEVICE TYPE DISK PARALLELISM 2;

 

  • RMAN opens 2 channels to write to disk simultaneously.
  • This improves backup/restore speed, especially for large databases or multiple datafiles.
  • Each channel can operate independently, writing to different backup pieces.

 

RMAN >CONFIGURE DEVICE TYPE SBT PARALLELISM 2;

 

·         RMAN will use 2 channels to send backup data to tape drives in parallel.

·         This improves throughput (faster backups/restores) especially when:

·         You have multiple tape drives.

·         Your tape infrastructure supports concurrent streams.

 

RMAN >CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/orabackup/ora_df%t_s%s_s%p';

 

·         Sets the backup file naming format for disk backups.

·         %t represents four byte time stamp, %s with the backup set number, and %p with the backup piece number.

 

RMAN >CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2G;

 

·         RMAN Limits maximum size of a backup piece to 2 GB.

 

RMAN >CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‘/tmp/%U’;

 

·         Overrides previous disk format to /tmp/%U. (%U = unique filename)

 

RMAN >CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ‘/disk1/%U’, ‘/disk2/%U’;

 

Defines where and how RMAN should name the backup files:

  • %U is a substitution variable that generates a unique file name.
  • RMAN will alternate writing backup pieces between /disk1/ and /disk2/ paths.
  • This provides load balancing across multiple directories/disks.

 

RMAN >CONFIGURE DEVICE TYPE <DISK | SBT> BACKUP TYPE TO COMPRESSED BACKUPSET;

 

This Configures RMAN to always create compressed backup sets instead of regular backup sets or image copies.

 

RMAN >CONFIGURE CONTROLFILE AUTOBACKUP ON;

 

This is used to enable automatic backup of the control file and the server parameter file (SPFILE) every time an RMAN backup is run or a structural change is made to the database.

 

RMAN >CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/orclbackup/ora_cf%F';

 

This sets a custom format for automatic control file and SPFILE backups when the device type is DISK.

%F Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name

 

RMAN >CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+DATA/%F';

 

This is used to configure automatic control file and SPFILE backups to be stored in an Oracle ASM disk group named +DATA

 

RMAN >CONFIGURE BACKUP OPTIMIZATION ON;

 

It enables backup optimization, which helps avoid backing up files that haven't changed since the last backup.

With BACKUP OPTIMIZATION ON, RMAN will skip backing up:

  • Datafiles that are:
    • part of a previous backup of the same file
    • not changed since that backup
  • Archived redo logs that were already backed up to the same device type
  • Control files and SPFILEs that are unchanged

RMAN >CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT TO 2;

 

 

·         This command instructs RMAN to create 2 identical copies of each datafile backup when backing up to SBT (tape).

·         It will write 2 separate backup sets, each containing the same datafiles.

·         This increases redundancy — useful for offsite + onsite storage, or general fault tolerance.

 

RMAN >CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT TO 2;

 

·         This tells RMAN to create 2 identical copies of each archived redo log backup when backing up to SBT (tape).

·         It writes them as separate backup sets (not just duplicated files in the same set)

 

RMAN >CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;

 

·         It configures RMAN to create 2 identical backup copies of each datafile when backing up to disk.

·         Each copy is a complete, usable backup of the datafile.

·         This provides redundancy in case one backup file is lost or corrupted.

 

RMAN Configuration Demystified: A Practical Deep Dive for DBAs – Part 1

 

RMAN Configuration Demystified: A Practical Deep Dive for DBAs – Part 1

 

rman TARGET SYS/target_pwd@target_str

 

Explanation:

  • This command starts RMAN and connects only to the target database, using the credentials provided.
  • Since there's no CATALOG clause, this is a NOCATALOG mode backup/restore operation.
  • target_pwd is the password of the SYS user, and target_str is the TNS alias (or connection string) of the target database.

Use Case:

Used for RMAN operations without a recovery catalog. The control file is used to store backup metadata.

 

rman TARGET / CATALOG rman/rman@rcat

 

Explanation:

  • Connects to the target database using OS authentication (TARGET /) — assuming the user has SYSDBA privilege.
  • Connects to the recovery catalog database using the user rman with password rman and TNS alias rcat.

Use Case:

Used when backup metadata is maintained in a Recovery Catalog (preferred for environments with multiple databases or long backup retention policies).

 

rman TARGET / CATALOG rman/rman@rcat AUXILIARY sys/aux_pwd@aux_str

 

First let’s crack what is TARGET , CATALOG and AUXILIARY

TARGET Database :

This is the main database you want to back up, restore, or recover.

It is the primary subject of all RMAN operations.

You must always connect to a target database, even if using a recovery catalog.

E.g.

rman TARGET sys/password@orcl

rman TARGET /

 

CATALOG Database(Recovery Catalog)  :

The Recovery Catalog is an optional separate database schema (often in a dedicated database) that stores RMAN metadata.

It offers more advanced reporting, longer metadata retention, and can manage multiple target databases.

E.g.

rman TARGET / CATALOG rman/rman@rcat

rman/rman@rcat is the connection to the Recovery Catalog stored in the rcat database.

 

AUXILIARY Database:

The AUXILIARY is a secondary or temporary database used for specific RMAN operations

E.g.

rman TARGET / CATALOG rman/rman@rcat AUXILIARY sys/aux_pwd@aux_str

 

Explanation:

  • Connects to:
    • TARGET database via OS authentication.
    • CATALOG database using rman user.
    • AUXILIARY database using SYS user with password aux_pwd and TNS alias aux_str.

Use Case:

Used for operations that involve a secondary (auxiliary) database, such as:

  • Duplicating a database (cloning).
  • Tablespace point-in-time recovery (TSPITR).
  • Database point-in-time recovery (DBPITR).
  • Restore and recovery to an alternate location.

 

RMAN >CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR;

 

  • Clears any custom channel configuration for SBT (tape) backups.

 

RMAN >CONFIGURE RETENTION POLICY CLEAR;

 

  • Removes the existing retention policy setting.

 

RMAN >CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;

 

·         Clears the control file autobackup format setting for disk.

 

RMAN >CONFIGURE DEFAULT DEVICE TYPE TO DISK/SBT;

 

·         Sets the default device for RMAN backups.

·         DISK: Backups go to file system.

·         SBT: Backups go to tape (e.g., via third-party software like NetBackup).

 

RMAN >CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

 

·         Redundancy in RMAN means how many copies of a distinct backup RMAN should retain at minimum.

·         When you set REDUNDANCY 3, you're telling RMAN:

"Keep at least 3 full backups of each datafile. If there are more than 3, the older ones can be marked obsolete."

RMAN >CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 4 DAYS;

 

·         RMAN will retain all backup sets (datafiles, control files, archived logs, etc.) that are required to perform a point-in-time recovery to any time in the last 4 days.

·         Older backups beyond the 4-day window are considered obsolete and can be deleted.

 

Oracle Database 26ai Installation Using RPM on Oracle Linux 9 (OEL 9) – Step-by-Step Guide

  In this post I will describe the installation of Oracle Database 26ai 64-bit on Oracle Linux 9 (OL8) 64-bit. The installation requires a m...