Issue
During rman backup, there is an error:
During rman backup, there is an error:
RMAN-00571: ==============================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
RMAN-00571: ==============================================
RMAN-03002: failure of delete command at 18/01/2021 22:04:21
RMAN-06091: no channel allocated for maintenance (of an appropriate type)
The error is coming from delete obsolete archive logs and backups.
Solution
A way to see expired backups
RMAN> CROSSCHECK BACKUP;
RMAN> DELETE EXPIRED BACKUP;
Are you sure? YES
In case of disk backup:
To delete obsolete backup sets :
To delete obsolete backup sets :
RMAN> ALLOCATE CHANNEL FOR MAINTENANCE TYPE DISK;
To delete obsolete:
RMAN> CROSSCHECK ARCHIVELOG ALL;
RMAN> DELETE OBSOLETE DEVICE TYPE DISK;
To delete expired:
RMAN> DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
RMAN> DELETE NOPROMPT EXPIRED BACKUPSET;
In case of SBT backup:
To delete obsolete backup sets of SBT type:
To delete obsolete backup sets of SBT type:
RMAN> ALLOCATE CHANNEL FOR MAINTENANCE TYPE SBT;
RMAN> CROSSCHECK ARCHIVELOG ALL;
RMAN> DELETE OBSOLETE DEVICE TYPE SBT;
But this step failed!
allocate channel for maintenance device type 'SBT_TAPE';
ORA-27211 Failed to load media management library
Note:
I failed to understand how SBT type backup pieces were created on the system in the first place.
All the scheduled scripts work only with DISK type!
All the SBT type backup pieces were expired.
All the scheduled scripts work only with DISK type!
All the SBT type backup pieces were expired.
Seems they were created, but then failed to be deleted with the default script that uses DISK type.
To delete them manually, I had to allocate a dummy path, to be able to delete the SBT type backupsets.
--This will allow to work with SBT type
allocate channel for maintenance device type sbt parms 'SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/tmp)';
--This will give list of all backupsets
LIST BACKUPSET;
--This will give info for backupsets 8840
LIST BACKUPSET 8840;
The output gives:
Backupset 8840 is a SBT_TYPE, and it has no backuppieces.
--It will mark it as EXPIRED, and now it can be deleted
CROSSCHECK BACKUPSET 8840;
--Delete the backupset without the "YES" approval
DELETE NOPROMPT BACKUPSET 8840;
==========================================
crontab task to delete old SBT and Disk backups
==========================================
/backup/ora_online/scripts/rnam_del_old_backups.sh
#!/bin/bash
./etc/profile > /dev/null 2>/dev/null
./etc/sh/orash/oracle_login.sh igt
. $BACKUP_ROOT/internal/backupFunctions.sh
WORK_DIR=/backup/ora_online/scripts
LOGFILE=/backup/ora_online/scripts/rman_del_old_backups.log
write_to_log() {
echo $1
echo $1 >> $LOGFILE
}
#main()
RUN_DATE=`date +"%Y%m%d"_"%H%M%S"`
write_to_log " "
write_to_log "============================="
write_to_log "Running at $RUN_DATE"
write_to_log "============================="
write_to_log "Starting Clean SBT Backups"
rman target / << zZ >> $LOGFILE
allocate channel for maintenance device type SBT_TAPE PARMS 'SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/tmp)';
LIST BACKUPSET;
CROSSCHECK BACKUPSE;
DELETE NOPROMPT EXPIRED BACKUPSET;
RELEASE CHANNEL;
EXIT;
zZ
write_to_log "Starting Clean Disk Backups"
rman target / << zZ >> $LOGFILE
allocate channel for maintenance device type disk;
DELETE NOPROMPT ACRHIVELOG ALL BACKED UP 1 TIMES TO DEVICE TYPE DISK;
DELETE NOPROMPT COPY OF ACRHIVELOG ALL COMPLETED BEFORE 'SYSDATE-2';
DELETE NOPROMPT OBSOLETE REDUNDANCE = 1;
RELEASE CHANNEL;
EXIT;
zZ
write_to_log "Finished Clean Backups"
crontab task to delete old directories
/backup/ora_online/scripts/clean_old_backups.sh
#!/bin/bash
WORK_DIR=/backup/ora_online/scripts
BACKUP_DIR=/backup/ora_online
TARGET_DIR=/backup/ora_online/for_backup
LOGFILE=${WORK_DIR}/clean_old_backups.log
write_to_log() {
echo $1
echo $1 >> $LOGFILE
}
#main()
RUN_DATE=`date +"%Y%m%d"_"%H%M%S"`
write_to_log " "
write_to_log "============================="
write_to_log "Running at $RUN_DATE"
write_to_log "============================="
for d in `find /backup/ora_online -maxdepth 1 -type d -name "20*"`
do
write_to_log "Handling Directory $d"
mv $d ${TARGET_DIR}/
done
directories=`ls -1 ${TARGET_DIR} | grep 20 | wc -l`
while [[ $directories -gt 2 ]];
do
del_dir=`ls -1 ${TARGET_DIR} | grep 20 | sort | head -1`
write_to_log "Deleting Directory ${TARGET_DIR}/$del_dir"
rm -r ${TARGET_DIR}/$del_dir
directories=`ls -1 ${TARGET_DIR} | grep 20 | wc -l`
done
No comments:
Post a Comment