linux oracle archivelog 定时清理方法
<div class="cnt">linux 平台下 oracle 数据库 archivelog 定时清理的方法用crontab定时执行事先写好的脚本 脚本内容如下:
脚本名:clear_archivelog.sh
$ORACLE_HOME/bin/rman <<EOF
connect target sys/password@mydb
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog until time 'sysdate-7';
exit;
EOF
脚本编写好后,在 oracle 用户下 使用 crontab -e 进行编辑 设定定时执行的时间等 即可
删除acrhivelog,最好用rman delete, 实际上在写脚本的时候,用OS的rm删除archivelog路径下的物理文件也可以,然后执行 crosscheck 和 delete expired ,但是这种方法在遇到ASM存储的时候实现起来会比较麻烦,所以建议用rman delete的方法。
另外,用 rman delete的时候可能会报:
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
<span style="" class="Apple-style-span"><span style="line-height: 20px; color: #444444; font-size: 12px;" class="Apple-style-span"><span style="" class="Apple-style-span"><span style="line-height: 20px; color: #444444; font-size: 12px;" class="Apple-style-span"><div style="line-height: 20px;">尝试删除归档日志,oracle提示这些归档日志还要用到standby数据库上面,不让删除,
页:
[1]