1.用RMAN连接目标DB:
RMAN target sys/*****@orcl
2.在RMAN命令窗口中,输入如下命令:
crosscheck archivelog all;
delete expired archivelog all;
或者删除指定时间之前的archivelog:
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';(指定删除7天前的归档日志)
3.其它相关命令:
查看归档日志列表:
list archivelog all;
查看失效的归档日志列表:
list expired archivelog all;
查看过期备份
RMAN> report obsolete;
删除过期备份
RMAN> delete obsolete;
4.定期清除archivelog:
可以将如下代码写成.bat文件,在控制面版的任务计划下添加新的定时任务:
RMAN target sys/*****@orcl
crosscheck archivelog all;
delete expired archivelog all;
5.
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7'; //删除七天前的归档
DELETE ARCHIVELOG FROM TIME 'SYSDATE-7'; //删除七天到现在的归档