Configuring Retention policy in Oracle RMAN

«« Previous
Next »»

When you are taking backups regularly to a specified disk then after some period of time the backup disk will get full and you will need to delete old backups to make space for new backups.

Usually you delete the old backups manually by following a particular rule like, deleting all the backups taken before 1 month or keep 2 backup copies of data files and delete older copies.

Manually identifying and deleting old backup files is cumbersome. To help you out, Oracle RMAN has a feature called RETENTION POLICY.

By configuring Retention Policy in RMAN, you can easily delete old backups by just giving one command.

Let's see how to configure Retention Policy and how to delete old backups

Configuring Retention Policy


You can configure retention policy to either number of days or number of copies. By default the RETENTION POLICY is set to redundancy 1.

Configuring Retention Policy to number of copies

RMAN> configure retention policy to redundancy 2;

In the above command we are asking RMAN to keep 2 backup copies of each file. Backup copies which are older than 2 copies can be marked as obsolete and hence can be deleted.

Oracle RMAN, Oracle Database Learning, Oracle Database Cert Exam, Database Prep

Configuring Retention Policy to number of copies

RMAN> configure retention policy to recovery window of 15 days;

When we issue this command RMAN will mark obsolete those backups which are older than 15 days.

Oracle RMAN, Oracle Database Learning, Oracle Database Cert Exam, Database Prep

Viewing obsolete backups

To view backups which have become obsolete according to the current retention policy you can give the following command

RMAN> report obsolete;

Oracle RMAN, Oracle Database Learning, Oracle Database Cert Exam, Database Prep

Deleting Obsolete Backups

We can delete obsolete backups by giving the following command

RMAN> delete obsolete;

delete obsolete backupsets 

Oracle RMAN, Oracle Database Learning, Oracle Database Cert Exam, Database Prep

Once retention policy is configured we can anytime issue the above command to delete old backups and free up space.

Checking the status of Retention Policy

Type the following command to know the currently configured RETENTION POLICY

RMAN> show retention policy;

Oracle RMAN, Oracle Database Learning, Oracle Database Cert Exam, Database Prep

Resetting RETENTION POLICY to default

You can reset the RETENTION POLICY to default value by giving the following command

RMAN> configure retention policy clear;

Oracle RMAN, Oracle Database Learning, Oracle Database Cert Exam, Database Prep

Disabling RETENTION POLICY

You can also disable retention policy. Disabling makes RMAN not consider any backup as obsolete

Oracle RMAN, Oracle Database Learning, Oracle Database Cert Exam, Database Prep

«« Previous
Next »»

0 comments:

Post a Comment