How to remove old RMAN backup files.

It is possible to use operating system commands such as rm on linux to delete RMAN backup files and generally recover from it, however you are far better using built in RMAN commands to do this.

$ rman target / NOCATALOG

First, check that all backup files are still available. This will show whether files have been removed outside of RMAN.

Unavailable files are marked as UNAVAILABLE or EXPIRED.

RMAN > crosscheck backupset;

Next:

RAMN > delete expired backupset;

or

RMAN > delete expired backup;

This cleans things up and removes files that are not available from the catalog.

If you have changed filenames of zipped backups, RMAN will not know about them and you must remove the files yourself.

Next, remove files that are considered obsolete. These are files that are no longer needed to fulfil the retention policy.

RMAN > report obsolete;

RMAN > delete obsolete;

You can find your current retention policy with the command:

RMAN > show retention policy;

 

RMAN > list backup summary;

Shows everything that RMAN is currently keeping in the repository.

You can also show the contents of a specific backupset by supplying the number at the end of the command.

RMAN > delete backupset N;

or

RMAN > delete backupset; (to delete all backups)

The above are fairly self explanatory. They allow you to either delete all backupsets or a specific one.

RMAN > backup database;

Takes a new backup.

RMAN > list backup;

Gives you a list of all the backups that have been taken (and are still kept).

RMAN > delete obsolete;

Taking the new backup may have made the oldest backups obsolete and so you can delete them.

So remember, Expired backups are gone, obsolete are still there but not needed to meet the retention policy.

‘SHOW RETENTION POLICY’ tells you your current retention policy. Set it with ‘CONFIGURE RETENTION POILCY to REDUNDANCY 2’ or ‘CONFIGURE RETENTION POILCY to WINDOW OF 30 DAYS’ etc

‘REPORT SCHEMA’ lets you check that the db is registered with the catalog.

 

Leave a Comment