Delete RMAN Backups – Clean Up Like a Pro!

As a DBA, one of the crucial maintenance tasks is managing RMAN backups. Over time, backups and archived logs can pile up, consuming a large amount of storage. If not managed properly, this can lead to space issues and impact database performance.

This guide will help you delete RMAN backups safely and efficiently using simple commands.

1. Delete All Backups

If you want to remove all RMAN backups from your system:

RMAN> DELETE BACKUP;
RMAN> DELETE NOPROMPT BACKUP;  -- No confirmation prompt

The NOPROMPT option skips the confirmation step, so use it carefully.

2. Delete Archivelogs from Disk

Archivelogs can quickly fill up your disk. Use these commands to remove them:

RMAN> DELETE ARCHIVELOG ALL;
RMAN> DELETE ARCHIVELOG UNTIL SEQUENCE 300;
RMAN> DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-1';
RMAN> DELETE ARCHIVELOG ALL BACKED UP 2 TIMES TO DISK;
  • Delete all logs
  • Delete until a specific sequence
  • Delete logs older than 1 day
  • Delete logs backed up 2 times

3. Delete Archivelog Backups (Not Disk Files)

Sometimes, you want to delete archivelog backups (not the logs themselves on disk):

RMAN> DELETE BACKUP OF ARCHIVELOG ALL;
RMAN> DELETE BACKUP OF ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';

4. Delete Backup by Tag

If you’ve used tags to organize your backups, you can delete by tag:

RMAN> DELETE BACKUP TAG <your_tag>;

5. Delete Expired Backups

Expired backups are those that RMAN can’t find on disk anymore. Clean them up with:

RMAN> CROSSCHECK BACKUP;
RMAN> DELETE EXPIRED BACKUP;

6. Delete Archivelogs While Taking Backup

You can configure RMAN to delete archivelogs as soon as they are backed up:

RMAN> BACKUP ARCHIVELOG ALL DELETE INPUT;
RMAN> BACKUP ARCHIVELOG ALL FROM SEQUENCE 1200 DELETE ALL INPUT;

note: Always run REPORT OBSOLETE or CROSSCHECK before deleting backups to avoid accidental data loss.


Leave a Reply