rman备份脚本

#!/bin/sh

rman target / nocatalog msglog=/AAfile/AA_rman/AAdata/full_`date +%Y%m%d-%H%M%S`.log << EOF
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
backup
        full
        database iAAlude current controlfile format '/AAfile/AA_rman/AAdata/%d_db_%T_%s.bkp'
        plus archivelog format '/AAfile/AA_rman/AAdata/%d_ar_%T_%s.bkp';
        delete noprompt archivelog all completed before 'SYSDATE-5';
release channel c1;
release channel c2;
}
#delete expired backup
allocate channel for maintenaAAe type disk;
report obsolete;
delete noprompt obsolete;
delete expired backup;
release channel;
exit
EOF
#controlfile backup
sqlplus '/as sysdba'<<eof
alter database backup controlfile to '/AAfile/AA_rman/AAdata/controlfile.bk';
exit
eof
mv /AAfile/AA_rman/AAdata/controlfile.bk /AAfile/AA_rman/AAdata/controlfile_`date +%Y%m%d-%H%M%S`.bk
exit
posted @ 2021-09-15 11:46  learnnote  阅读(80)  评论(0)    收藏  举报