日期:2014-05-16 浏览次数:20806 次
最近做个DG的归档日志删除,
[oracle@.local logs]crontab -l * 8 * * * sh /home/oracle/dbscripts/del_arc.sh
该脚本分别调用 生成 删除 校验 三个脚本
cat del_arc.sh #! /bin/bash source /home/oracle/.bash_profile sh /home/oracle/dbscripts/build_del_archivelog.sh >> /home/oracle/dbscripts/del_arch`date +%F_%H`.sh sleep 5 sh /home/oracle/dbscripts/del_arch`date +%F_%H`.sh >> /home/oracle/dbscripts/logs/del_arch`date +%F_%H`.log sleep 5 sh /home/oracle/dbscripts/crosscheck_archivelog.sh >> /home/oracle/dbscripts/logs/cross_check`date +%F_%H`.log
cat build_del_archivelog.sh sqlplus -s shark/235619<<EOF set heading off set linesize 1000 set echo off set feedback off set timing off set termout on set trimout off set trimspool on set newpage none select 'rm -f '||name from v\$archived_log where applied='YES' and deleted='NO' and completion_time < trunc(sysdate); EOF
另外 生成的每行间距太大了,望各位指教下.
生成的删除脚本
]head del_arch2014-05-07_08.sh rm -f /arch_backup/1_24144_831167377.log rm -f /arch_backup/2_22765_831167377.log
就是Y的太大行间距了.
]cat crosscheck_archivelog.sh #! /bin/bash source /home/oracle/.bash_profile exec >> /home/oracle/dbscripts/logs/del_arch`date +%F_%H`.log $ORACLE_HOME/bin/rman target / <<EOF crosscheck archivelog all; delete noprompt expired archivelog all; #delete noprompt archivelog until time 'sysdate-1'; exit; EOF
这个校验脚本主要是为了清理下归档信息. 如果该信息存放在控制文件中DG是删除不了的