dataguard 备库删除已应用过的过期归档

vi deletearchlog.sh

#!/bin/sh
export PATH
TABLE='v美元符号archived_log'
sqlplus -silent "/ as sysdba" <<EOF > /home/oracle/dba/deleteorclarch.sh
set heading off;
set pagesize 0;
set term off;
set feedback off;
set linesize 32767;
select 'rm -rf '||name from 美元符号{TABLE} where DELETED='NO' and APPLIED='YES'and COMPLETION_TIME<=sysdate-16/24;
exit;
EOF
#根据上面将已应用过的执行 rm -rf ...针对接下来的就不是很合理了,保留不了7天了,需要调整为sysdate -7,暂时没测试
sh /home/oracle/dba/deleteorclarch.sh
rman target / log=/home/oracle/dba/log/del_`date +%Y%m%d%H%M`.log << EOF
crosscheck archivelog all;
delete noprompt force archivelog until time 'sysdate - 7';
EOF

参考 https://blog.csdn.net/weixin_30861797/article/details/98531390

posted @ 2020-12-08 17:30  ritchy  阅读(354)  评论(0编辑  收藏  举报