RMAN Config

CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK
TO '/u02/oradata/PROD/rman/cf_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u02/oradata/PROD/rman/bk_t%t_s%s_p%p';

backup as compressed backupset
database plus archivelog
delete all input

backup_level_0.rman

run {
  crosscheck archivelog all;
  sql 'alter system archive log current';
  backup incremental level 0 database
    filesperset 10 maxsetsize 20G
    tag 'full_db';
  backup archivelog all delete input
    filesperset 16 maxsetsize 20G
    tag 'full_al';
  backup current controlfile reuse;
  delete noprompt obsolete;
}

backup_level_1.rman

run {
  crosscheck archivelog all;
  sql 'alter system archive log current';
  backup incremental level 1 database
    filesperset 10 maxsetsize 15G
    tag 'incr_db';
  backup archivelog all delete input
    filesperset 16 maxsetsize 15G
    tag 'incr_al';
  backup current controlfile reuse;
  delete noprompt obsolete;
}

backup_level_0.sh

#! /bin/sh
#
rman target / nocatalog @backup_level_0.rman

backup_level_1.sh

#! /bin/sh
#
rman target / nocatalog @backup_level_1.rman
run {
crosscheck archivelog all;
backup
  full
  tag hot_db_bk_full
  maxsetsize 10G
  filesperset 10
  format '/u03/oradata/PROD/rman/current/bk_%U.bkp'
   (database);
sql 'alter system archive log current';
backup
   maxsetsize 10G
   filesperset 100
   format '/u03/oradata/PROD/rman/current/al_%U.bkp'
   (archivelog all delete input);
backup
   format '/u03/oradata/PROD/rman/current/ct_%U.bkp'
  (current controlfile);
sql "alter database backup controlfile to ''/u03/oradata/PROD/rman/current/control01.bak'' reuse";
sql "create pfile=''/u03/oradata/PROD/rman/current/initybb.bkp'' from spfile";
}
exit;
(echo ${ORACLE_SID} backup job finished. ; echo ; echo detail: ; echo ; cat run.log ) | mail -s "Report (${ORACLE_SID})" mailto@mail

} > run.log 2>&1
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License