Thursday, March 27, 2014

SCRIPT FOR RMAN BACKUP

Must be set control file autobackup on

//full incremental level 0  backup

DELETE OBSOLETE;
DELETE EXPIRED ARCHIVELOG ALL;
crosscheck archivelog all;
run
{
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
allocate channel c1 type disk
maxpiecesize=500m;
backup incremental level 0 database tag='weekly_level0';
backup archivelog from time 'sysdate-1' until time 'sysdate';
release channel c1;
}

backup current controlfile;
backup spfile;


//////////////full backup specified directory


run {
     allocate channel ch1 type Disk maxpiecesize = 1900M;
     backup full database noexclude
     include current controlfile
     format '/opt/oracle/backup/datafile_%s_%p.bak'
     tag 'datafile_daily';
   }

run {
     allocate channel ch1 type Disk maxpiecesize = 1900M;
     backup archivelog all
     format '/opt/oracle/backup/archivelog_%s_%p.bak'
     tag 'archivelog_daily';
   }

run {
   allocate channel ch1 type Disk maxpiecesize = 1900M;
   backup format '/opt/oracle/backup/controlfile_%s.bak'
   current controlfile;
   }

No comments:

Post a Comment