首先,先使用rman命令,手动清理一下归档日志
(1)set oracle_sid=orcl
(2)rman.exe target /
(3)然后执行rman的命令即可
crosscheck archivelog all; #校验日志的可用性
list expired archivelog all; #列出所有失效的归档日志
删除系统时间七天以前的归档日志
delete force archivelog all completed before 'sysdate-7';
清除当前所有的归档日志
delete force archivelog all completed before 'sysdate';
具体的清理脚本
delete_arch.bat
rman cmdfile=E:\arch_clean\delete_arch.txt
echo bat in %date% %time% clean arch sucessed>E:\arch_clean\clean.txt
delete_arch.txt
connect target /
run{
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7'; //删除7天前的归档日志,怕哪天DG有问题,有日志没有及时应用
crosscheck archivelog all;
delete expired archivelog all;
}