RMAN DELETE
Examples on this page assume that all pre-requiste and configuration steps are complete.
DELETE OBSOLETE
To remove backups that are no longer required...
DELETE OBSOLETE;
To avoid having to interactively confirm the deletion...
DELETE NOPROMPT OBSOLETE;
In scripts the NOPROMPT is implicitTo remove backups from TSM, plus any obsolete files on disk...
RUN{
ALLOCATE CHANNEL t1 TYPE 'SBT_TAPE' PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
ALLOCATE CHANNEL d1 TYPE disk;
DELETE OBSOLETE DEVICE TYPE DISK;
DELETE OBSOLETE DEVICE TYPE 'SBT_TAPE';
RELEASE CHANNEL d1;
RELEASE CHANNEL t1;
}
RMAN-06091
Recent versions of Oracle (patch levels after July 2019) are more prone to failing with this error.
(Due to bug 28391990 and the limitations of its fix: 28432129)RMAN-06091: no channel allocated for maintenance (of an appropriate type)
In most cases, updating your backup to match the command block above (i.e. with the explicit channel allocations and device types) will avoid this error.
DELETE EXPIRED
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;
CROSSCHECK ARCHIVELOG ALL;
DELETE EXPIRED ARCHIVELOG ALL;
DELETE ARCHIVELOG
To delete all archivelogs that are already backed up to 'SBT_TPAE' (TSM or similar)...
DELETE ARCHIVELOG ALL BACKED UP 1 TIMES TO DEVICE TYPE 'SBT_TAPE';
To delete all archivelogs older than 1 day...
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'sysdate-1';
Recommended post-delete steps...
CROSSCHECK ARCHIVELOG ALL;
DELETE EXPIRED ARCHIVELOG ALL;
Automatic Deletion
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY BACKED UP 1 TIMES TO 'SBT_TAPE';
DELETE BACKUP
To delete all backups (using default channel)...
DELETE BACKUP;
To delete a specific backupset...
LIST BACKUP;
LIST BACKUPSET DEVICE TYPE DISK;
DELETE BACKUPSET 1234;
Where 1234 is the "BS Key"DELETE from "lost" Media Manager
LIST BACKUPSET DEVICE TYPE 'SBT_TAPE';
DELETE BACKUPSET 18977;
Let's try explicitly setting the device type to 'SBT_TAPE'...
run
{
ALLOCATE CHANNEL d1 TYPE DISK;
ALLOCATE CHANNEL t1 TYPE 'SBT_TAPE' PARMS 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
DELETE BACKUPSET 18977 DEVICE TYPE 'SBT_TAPE';
}
released channel: t1RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-03002: failure of delete command at 02/13/2023 15:17:58RMAN-06091: no channel allocated for maintenance (of an appropriate type)
run
{
ALLOCATE CHANNEL t1 DEVICE TYPE SBT PARMS 'SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/tmp)';
DELETE OBSOLETE;
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;
}
LIST BACKUPSET DEVICE TYPE 'SBT_TAPE';
LIST BACKUP SUMMARY;
Bibliography
http://www.juliandyke.com/Research/RMAN/DeleteCommand.phpRMAN Backup Returns RMAN-06091: No Channel Allocated For Maintenance (of An Appropriate Type) After Applying July (DBPSU/BP/RU) (Doc ID 2428682.1)http://www.oracledocs.com/delete-rman-archivelogs-older-than-1-days/https://blog.zeddba.com/2017/08/10/delete-old-sbt_tape-backups-that-are-no-longer-available-in-rman/