rman增量备份shell脚本

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/oracle/product/10.2.0/db_1/dbs/snapcf_filenet.f'; # default

./home/oracle/.bash_profile

RMAN_LOG_FILE="/file_store_area/ora_bak/log/rman_lv0_`date +%Y"-"%m"-"%d"_"%H":"%M":"%S`.log"
echo ==== started on `date` ==== > $RMAN_LOG_FILE
rman target / nocatalog msglog $RMAN_LOG_FILE append >>$RMAN_LOG_FILE <<EOF
run {

allocate channel c1 type disk;

allocate channel c2 type disk;

backup incremental level 0 database filesperset 4

  include current controlfile

  format '/file_store_area/ora_bak/db_bak/%T_db_lv0_%t_%s_%p'

  plus archivelog delete input

  format '/file_store_area/ora_bak/db_bak/%T_ar_%t_%s_%p';

release channel c1;

release channel c2;

}exit;
EOF
echo ==== finished on `date` ==== >> $RMAN_LOG_FILE =========



. /home/oracle/.bash_profile

RMAN_LOG_FILE="/file_store_area/ora_bak/log/rman_lv1_`date +%Y"-"%m"-"%d"_"%H":"%M":"%S`.log"
echo ==== started on `date` ==== > $RMAN_LOG_FILE
rman target / nocatalog msglog $RMAN_LOG_FILE append >>$RMAN_LOG_FILE <<EOF
run {

allocate channel c1 type disk;

allocate channel c2 type disk;

backup incremental level 1 database filesperset 4

  include current controlfile

  format '/file_store_area/ora_bak/db_bak/%T_db_lv1_%t_%s_%p';

release channel c1;

release channel c2;

crosscheck archivelog all;

ALLOCATE CHANNEL ch00 TYPE DISK;
ALLOCATE CHANNEL ch01 TYPE DISK;
BACKUP
        filesperset 20
        FORMAT '/file_store_area/ora_bak/db_bak/%T_ar_%t_%s_%p'
        ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;

}
crosscheck backup;
delete noprompt obsolete;
delete noprompt expired backup;
exit;
EOF
echo ==== finished on `date` ==== >> $RMAN_LOG_FILE =========

你可能感兴趣的:(oracle,脚本,F#,bash)