Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

  • Translate

  • It’s Me






  • My Certificates

  • Links

    My Acclaim Certification : Credly Profile
    My Oracle ACE Pro Profile

  • Achievements

    Awarded Top 100 Oracle Blogs from Worldwide - #RANK 39
  • VISITORS COUNT

  • Verified International Academic Qualification from World Education Service (WES)

    Verified International Academic Qualification from World Education Service (WES)

  • Jobs

Configuring Retention Policy in RMAN in Oracle database 11gR2

Posted by Mir Sayeed Hassan on February 14th, 2018

Configuring Retention Policy in RMAN in Oracle database 11gR2

RMAN Configuration retention policy is a feature to avoid the manually deleting the old backup files from the disk in an Oracle database 11g2

Configuring this retention policy is much easily to delete the old backup by setting up as per your requirement

Now configure the retention policy to either no of days or no of copies, In an Oracle database by default retention policy is set to redundancy 1

Configuring Retention Policy to number of copies

RMAN> configure retention policy to redundancy 2;
old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

new RMAN configuration parameters are successfully stored

In this case RMAN will keep 2 backup copies of each file & the backup copies which are older than 2 copies can marked as obsolete & it will be deleted

Configuring Retention Policy to number of copies

RMAN> configure retention policy to recovery window of 10 days;
old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

new RMAN configuration parameters:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;

new RMAN configuration parameters are successfully stored

In this case RMAN will set obsolete those backups which are older than 10 days.

Note:

Set the retention policy as per your company requirement or the space available to hand it

Viewing obsolete backups

Get the backup of which become obsolete as per your configuration

RMAN> report obsolete; RMAN retention policy will be applied to the command RMAN retention policy is set to recovery window of 10 days no obsolete backups found

(In this case I don’t have any backup to obsolete)

Deleting Obsolete Backups

RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 10 days
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=469 device type=DISK
no obsolete backups found

(In this case I don’t have any backup to delete obsolete)

Checking the status of Retention Policy

RMAN> show retention policy;
RMAN configuration parameters for database with db_unique_name TESTDB are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;

Or

RMAN> show all;
RMAN configuration parameters for database with db_unique_name TESTDB are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_testdb.f'; # default

To reset the retention policy to default as per Oracle standard

RMAN> configure retention policy clear;
old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;
RMAN configuration parameters are successfully reset to default value

Verify

RMAN> show retention policy;
RMAN configuration parameters for database with db_unique_name TESTDB are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
Resetting RETENTION POLICY to default
Disabling RETENTION POLICY
RMAN> configure retention policy to none;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO NONE;
new RMAN configuration parameters are successfully stored

Verify

RMAN> show retention policy;
RMAN configuration parameters for database with db_unique_name TESTDB are:
CONFIGURE RETENTION POLICY TO NONE;

In this case the disable retention policy makes RMAN not consider any backup as obsolete

=====Hence tested & verified in our test env======