Data Aging from the RMAN Command Line for Oracle

You can manage Oracle backup data retention by using the RMAN retention policy instead of the CommCell Console data aging. You must perform the following procedures to use RMAN for data aging.

  1. Set the CommCell Console storage policy to have infinite retention when you use the RMAN retention.
  2. Specify the RMAN retention criteria with the CONFIGURE RETENTION POLICY command. See Setting the Oracle RMAN Retention Policy.

You can configure an Oracle RMAN retention policy for each database. When RMAN retention rules are in effect, RMAN uses the criteria to determine which backup jobs comprising are obsolete and no longer needed for recovery.

If you want to use the CommCell Console data aging feature, execute the following RMAN command which disables the RMAN retention policy.

CONFIGURE RETENTION POLICY TO NONE

Oracle Crosschecks and Deleting Backup Pieces

You can use the RMAN CROSSCHECK BACKUP command to synchronize the RMAN repository with the records that are on the file system or the disk.

The command marks backup pieces that entries in the RMAN repository, but do not have physical backup files in the file system or the disk as EXPIRED

The DELETE EXPIRED command deletes backup pieces that are marked EXPIRED.

You can use an automatic channel, or allocate the channel for maintenance.

WARNING: The software might delete backup pieces when you run this command.

Use the following code snippets as examples.

To use a maintenance channel:

ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt
PARMS="BLKSIZE=524288,SBT_LIBRARY=/opt/snapprotect/Base/libobk.so,ENV=(CvClientName=<client_name>,CvInstanceName=Instance001)";
CROSSCHECK BACKUP;
delete backuppiece <bkppiece>;
delete expired ;

To use an automatic channel:

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS "SBT_LIBRARY=/opt/snapprotect/Base/libobk.so,ENV=(CvInstanceName=Instance001,CvClientName=<client name>)";
run
{
CROSSCHECK BACKUP;
delete backuppiece <bkppiece>;
delete expired ;
}

Report Aged Backups

You can use the RMAN REPORT OBSOLETE command to see the list of backups RMAN considers no longer needed for recovery.

Note: Before you run the command, you must allocate a channel for maintenance.

Use the following script as an example.

allocate channel for maintenance device type  sbt PARMS="SBT_LIBRARY=/opt/snapprotect/Base/libobk.so";
run{
Report OBSOLETE;
}

Delete Aged Backups

You can use the RMAN DELETE OBSOLETE command to delete all backups associated with the specified retention policy that are no longer needed for recovery. RMAN frees the disk or tape spaces associated with the deleted backup.

Note: Before you run the command, you must allocate a channel for maintenance.

Use the following script as an example.

allocate channel for maintenance device type  sbt  PARMS="SBT_LIBRARY=/opt/snapprotect/Base/libobk.so";
run{
DELETE OBSOLETE;
}

In the example, the backup pieces in the last two backup cycles are kept and the rest are deleted from both the primary and secondary copies.

Aged RMAN backup pieces are permanently deleted from all copies.

Related Topics

Data Aging for Oracle

Retention Rules for Oracle

Data Aging from the CommCell Console

Data Aging