oracle删除归档,可以使用rman删除归档,也可以使用rm直接删除!
1.使用rm删除归档:
删除所有归档:find /u01/app/oracle/archive -mtime -1 -name "*.dbf" -exec rm -f {} \;或find /u01/app/oracle/archive -mtime -1 -name "*.dbf"| xargs rm -rf
删除七天前的归档:find /u01/app/oracle/archive -mtime +7 -name "*.dbf" -exec rm -f {} \;或find /u01/app/oracle/archive -mtime +7 -name "*.dbf"| xargs rm -rf
最后需要用rman删除记录:
rman target /crosscheck archivelog all;delete noprompt expired archivelog all;
2.根据sequence#使用rman删除归档:
单节点:
delete noprompt archivelog until sequence ${Seq};
rac(thread后面加节点数):
delete noprompt archivelog until sequence ${Seq} thread ${CurThread};
删除7天前的归档:
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
删除全部归档(noprompt不交互):
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-0';
删除从7天前到现在的全部日志:
DELETE ARCHIVELOG FROM TIME 'SYSDATE-7';
3.根据时间使用rman删除归档:
删除7天前的归档:
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
删除全部归档(noprompt不交互):
DELETE noprompt ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-0';
删除从7天前到现在的全部日志:
DELETE ARCHIVELOG FROM TIME 'SYSDATE-7';
网友评论