sonia hamilton – life on the digital bikepath – sonia@snowfrog.net

18 December 2008

Oracle – how to purge old RMAN backups

Filed under: Oracle — Sonia @ 13:01

Oracle runs on Linux, therefore I must be an Oracle expert (so goes management thinking). Here’s how to correctly purge old RMAN backups when storage runs out of space (thanks Nakrob):

Do not use rm to remove files. You must do it via RMAN.

$ export NLS_DATE_FORMAT='DD-MM-YY HH24:MI'

$ rman target / NOCATALOG

RMAN > crosscheck backupset;
This command will verify whether backup file is still on media.
If it is unavailable, RMAN will mark it as UNAVAILABLE or EXPIRED.

RAMN > delete expired backupset;
or
RMAN > delete expired backup;

Note : If you manually rename or zip RMAN backup files, you must manually remove it from disk since RMAN
does not recognize them.

RMAN > report obsolete;
The command lists all backups rendered obsolete based on rentention policy.
Current Retention Policy is 'Recovery WINDOW OF 30 DAYS'.

RMAN > delete obsolete;

RMAN > list backup summary;
It will show all backupset info kept in RMAN repository.
If you want to see what RMAN keeps in each backupset, run 'list backupset N' where N is Backupset ID.

RMAN > delete backupset N;
or
RMAN > delete backupset; (to delete all backups)

Once fair amount of space is reclaimed, do full backup.
Not sure how much full back space is needed but not less than 20G.

RMAN > backup database;

RMAN > list backup;
Full backup may have more than one backupset.
Look for last backupsets. It will list backup db files.

RMAN > delete obsolete;
Rerun this command to delete unwanted existing backupsets (if have) after completed full backup.

3 Comments »

  1. Wonderful, just found everything I needed.

    Also, if you’re running in archivelog mode:
    crosscheck archivelog;
    delete archivelog all;

    Comment by Matt! — 30 May 2009 @ 04:38

  2. [...] Filed under: Oracle — Sonia @ 11:59 More notes on Oracle RMAN backups, see also Oracle – how to purge old RMAN backups. Thanks Raoul for your [...]

    Pingback by Oracle RMAN backups « sonia hamilton – life on the digital bikepath – sonia@snowfrog.net — 29 June 2009 @ 11:59

  3. what about if catalog option is used?

    Comment by oracle-rman — 8 October 2009 @ 23:02


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.