Saturday, 19 September 2020

RMAN Incremental Backup Script

 dt=`date +"%d.%m.%Y"`

rman <<EOF

        spool msglog to '/backup/RMAN/logs/rman_INC_ORAPROD$dt.log'

        connect target /

delete noprompt archivelog all completed before 'sysdate-8';

run {

allocate channel c1 type disk;

BACKUP FORMAT '/backup/RMAN/INC/ORAPRODctrl_%s_%p_%t.rman' CURRENT CONTROLFILE;

RELEASE CHANNEL c1;

allocate channel c1 type disk;

allocate channel c2 type disk;

BACKUP  AS COMPRESSED BACKUPSET  INCREMENTAL LEVEL 1 TAG ORAPROD_BACKUP_LEVEL1 FILESPERSET 4 FORMAT '/backup/RMAN/INC/ORAPROD_%s_%p_%t.rman' DATABASE;

RELEASE CHANNEL c1;

RELEASE CHANNEL c2;

allocate channel c1 type disk;

allocate channel c2 type disk;

BACKUP  as compressed backupset FILESPERSET 5 FORMAT '/backup/RMAN/INC/ORAPROD_ARC_%s_%p_%t.rman' ARCHIVELOG ALL skip inaccessible;

RELEASE CHANNEL c1;

RELEASE CHANNEL c2;

allocate channel c1 type disk;

copy current controlfile to '/backup/RMAN/INC/ORAPRODcontrol.rman';

RELEASE CHANNEL c1;

}

EXIT;

EOF

No comments:

Post a Comment