欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Linux下Oracle归档日志自动清理脚本代码(sh)

程序员文章站 2022-05-24 17:58:22
复制代码 代码如下: #!/bin/sh export back_date=`date +%y%m%d` export backup_path=/home/oracle/d...
复制代码 代码如下:

#!/bin/sh
export back_date=`date +%y%m%d`
export backup_path=/home/oracle/dbbak
echo `mkdir -p ${backup_path}/archivelog/${back_date}`
rman msglog=$backup_path/archivelog/${back_date}/arch_0_$back_date.log << eof
connect target /;
delete expired archivelog all;
delete noprompt archivelog until time 'sysdate - 1' ;
exit
eof