Linuxshell implements script to automatically clean up rman backup files

  
        

rman backup script

#! /bin/bash

su - oracle <<!

rman target /<<EOF

backup AS COMPRESSED BACKUPSET database

include current controlfile format'/orabak/db_%d_%T_%s'

plus archivelog format'/orabak/arch_%d_%T_%s' Delete allinput;

delete noprompt obsolete;

exit;

EOF

The third backup save platform automatically cleans up expired backup files

#! /bin/bash

for file in `ls /orabak`

do

if [[ ${file:0:2} == " Db" ]];then

fdate=${file:10:8}

mydate=`date +%Y%m%d -d "-7 day"`

if [[ $fdate < $mydate ]];then

rm -rf $file;

else

echo $file;

fi

else

fdate=${file:12:8}

mydate=`date +%Y%m%d -d "-7 day" ;`

if [[ $fdate < $mydate ]];then

rm -rf $file;

else

echo $file;

fi

fi

done
zh-CN"],null,[0.81432366],zh-CN"]]]

Copyright © Windows knowledge All Rights Reserved