$ vi clean.sh #!/bin/sh export BACK_DATE=`date +%Y%m%d` export BACKUP_PATH=/home/oracle/dbbak echo `mkdir -p ${BACKUP_PATH}/archivelog/${BACK_DATE}` rman msglog=$BACKUP_PATH/archivelog/${BACK_DATE}/arch_0_$BACK_DATE.log << EOF connect target /; delete expired archivelog all; delete noprompt archivelog until time 'sysdate - 3' ; exit EOF $ chmod 777 clean.sh $ sh clean.sh