对于归档在ASM中的,使用如下的脚本
. /home/oracle/.bash_profile
/u01/app/oracle/product/11.2.0/db/bin/rman nocatalog log=/home/oracle/del_arch$(date +%Y-%m-%d).log <<EOF
connect target /
crosscheck archivelog all;
delete noprompt expired archivelog all;
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
exit;
EOF
对于归档在本地的,使用如下的命令:
0 0,3,6,9,12,15,18,21 * * * /usr/bin/find /u02/archive/storedb -ctime +5 | xargs rm -f