Delete RMAN Backups
Safely delete obsolete RMAN backups to free up storage.
There are many ways to delete RMAN backups and as a DBA you must know the different ways so that you can keep RMAN and OS disk space clean.
Delete All Backups
To delete all the backups for the target database, use below command
RMAN> DELETE BACKUP;
The above command will prompt you to confirm the deletion. In case you are sure to delete the backups and want to skip the confirmation prompt then use below command
RMAN> DELETE NOPROMPT BACKUP;
Delete Archivelog Backup
To delete archivelog files from disk (NOT BACKUP), use below commands
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;
To delete archivelog files from the RMAN backups (NOT DISK), use below commands
RMAN> DELETE BACKUP OF ARCHIVELOG ALL;
RMAN> DELETE BACKUP OF ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
Delete Backup Tag
If you triggered a backup and want to delete it completely, you can specify the backup tag and rman will delete all the backup files associated with tag
RMAN> DELETE BACKUP TAG <tag>;
Delete Expired Backups
First run RMAN CROSSCHECK command and then use below command to delete all the expired backups
RMAN> CROSSCHECK BACKUP;
RMAN> DELETE EXPIRED BACKUP;
RMAN> DELETE EXPIRED ARCHIVELOG ALL;
Delete Obsolete Backups
You can run REPORT OBSOLETE command to see all the rman backups that are no longer required for database recovery. Use below command to delete all the RMAN obsolete backups
RMAN> DELETE OBSOLETE;
Delete Archivelog While Backup
You can use DELETE INPUT clause to delete files while taking RMAN backups
RMAN> BACKUP ARCHIVELOG ALL DELETE INPUT;
RMAN> BACKUP ARCHIVELOG ALL FROM SEQUENCE 1200 DELETE ALL INPUT;