>> from zhuhaiqing.info

#!/usr/bin/bash
#删除DataGuard备机归档日志备份

export ORACLE_HOME=/opt/oracle/product/10.2.0/Db_1
export ORACLE_SID=starboss
export ARC_DIR=/home/oracle/arch
export DBID=927537571
 
del_seq=`ls $ARC_DIR/|head -1|cut -f2 -d_`
echo $del_seq
$ORACLE_HOME/bin/sqlplus "/ as sysdba" <<eof >$ARC_DIR/max_sn.log
set head off;
set feedback;
select max(sequence#) from v\$log_history;
exit;
eof
max_sn=`cat $ARC_DIR/max_sn.log|awk '{print $1}'|grep ^[0-9]`
max_sn=`expr $max_sn - 30`
echo $max_sn
while [ $del_seq -lt $max_sn ]
do
  rm -rf $ARC_DIR/1_"$del_seq"_$DBID.arc
  del_seq=`expr $del_seq + 1`
  echo $del_seq
done

 

相关文章:

  • 2022-03-03
  • 2021-05-23
  • 2022-12-23
  • 2021-12-29
  • 2022-02-13
  • 2021-11-23
  • 2022-12-23
  • 2021-05-21
猜你喜欢
  • 2021-10-09
  • 2022-01-15
  • 2022-12-23
  • 2021-04-22
  • 2022-12-23
  • 2021-11-22
相关资源
相似解决方案