In this article, we are going to learn how to delete rman backups using the RMAN utility. As an Oracle DBA, you must know all ways to delete the database backups to clean the disk space.
How to Delete all RMAN backups
If you want to delete all the RMAN backups from the disk using the RMAN command so below command will do it for us.
RMAN> delete backup;
The above command asks for confirmation to delete the backup. If you are sure about it and don't want confirmation then use the below query.
RMAN> delete noprompt backup;
How do I delete Archivelog?
Use the below commands to delete archivelog from the disk and remember not to backup.
Delete all archives
using the below command to all archives from the disk.
RMAN>delete archivelog all;
Delete archives till sequence
Use the below command to delete archives till the sequence.
RMAN>delete archivelog until sequence 1250;
Delete archives two days old
If you want to delete two days old archives use the below command.
RMAN>delete archivelog all completed before 'sysdate-2';
Delete Backup completed archives
Delete those archives that backup completed 2 times.
RMAN>delete archivelog all backed up 2 times to disk;
How do I delete Archivelog backup?
Delete archivelog from the backup, not disk.
RMAN>delete backup of archivelog all;
Delete 7 Days old archivelog backup
Delete 7 days old archivelog backups using the below commands.
RMAN>delete backup of archivelog all completed before 'sysdate-7';
Delete RMAN backup using tag
Every RMAN backup has its own tag, if the user does not define the backup tag then rman systematically defines the backup tag automatically. So if you want to delete all backup files which are associated with a single tag then use the below command.
RMAN>delete backup tag you_tag;
How to Delete expired RMAN backups
If you are sure about deleting all expired rman backups then run the crosscheck command first and then delete the expired backups.
RMAN> crosscheck backup;
RMAN> delete expired backup;
RMAN> delete expired archivelog all;
How to Delete Obsolete RMAN backups
You can use the below command to delete obsolete rman backups which no longer required. Using the report obsolete command you can see all obsolete backups list.
RMAN> report obsolete;
RMAN>delete obsolete;
Delete Archives during backup
Use the below command to delete archives during creating a rman backup.
RMAN>backup archivelog all delete input;
RMAN>backup archivelog all from sequence 1300 delete all input;