Monday, October 11, 2010

RMAN Backup quick reference guide

configure RMAN configuration

$ rman target / nocatalog
RMAN>configure controlfile autobackup on;
RMAN>configure retention policy to recovery window of 14 days;


Init.ora Parameters defines Backup media and retention of information in controlfile

backup_tape_io_slaves=TRUE
control_file_record_keep_time=14

Init.ora parameters to speed up backup

sort_area_size = 20971520
sort_area_retained_size = 20971520

Channels For disk Backup

RMAN>allocate channel dmon_d1 type disk format '/u01/BACKUP/demo/%U';

Channels for Tape Backup

RMAN> allocate channel ch1 type 'SBT_TAPE'
   parms='ENV=(NB_ORA_CLASS=RMAN_MTBackup_Tier3)';

Backup database+archivelog+controlfile

$ rman target / nocatalog
RMAN>backup  as compressed backupset
      full
      maxsetsize = 32G
      filesperset = 1024
      diskratio=0
      tag 'Full'
      (database include current controlfile)
   PLUS ARCHIVELOG skip inaccessible format '/u01/BACKUP/demo/ar_%d_%t_%c_%s_%p';
  

Backup database+archive log

  $ rman target / nocatalog
 
# to disk
       RMAN> backup device type disk format '/u01/BACKUP/demo/%U' database
                 plus archivelog skip inaccessible delete input;;
    
   # to Tape
     RMAN> backup as compressed backupset
          full
          filesperset = 1024
          diskratio = 0
          tag = 'Full'
          (database format 'SBT_TAPE/RMAN_%d.%t.full.%c.%s.%p')
        plus archivelog
          skip inaccessible
          delete input
          format 'SBT_TAPE/RMAN_%d.%t.arch.%c.%s.%p';
 
Backup database+controlfile

 RMAN>backup as compressed backupset
          full
          maxsetsize = 32G
          filesperset = 1024
          diskratio = 0
          tag = 'Full'
          (database  include current controlfile) keep until time 'SYSDATE+365' nologs;


Backup Controlfile for standby

RMAN> backup device type disk format '/u01/BACKUP/demo/%U' current controlfile for standby;


Backup Controlfile

Option # 1
RMAN>copy current controlfile to '/u01/BACKUP/demo/backup/demo_controlfile.bak';

Option # 2
RMAN>backup current controlfile format '/u01/BACKUP/demo/%d_controlfile_bak_%T_s%s';

Note : Control file is automatically backed up when
     RMAN>configure controlfile autobackup on;


archive log

# to disk
RMAN>backup as compressed backupset
     maxsetsize =5G
     diskratio = 0
     skip inaccessible
     tag 'Archive Logs'
   (archivelog all  NOT BACKED UP 1 TIMES format '/u01/BACKUP/demo/ar_%d_%t_%c_%s_%p');

   
# to disk
RMAN> backup as compressed backupset
         maxsetsize = 5G
         diskratio = 0
         skip inaccessible
         tag = 'Archive Logs'
        (archivelog all delete input format'SBT_TAPE/RMAN_%d.%t.arch.%c.%s.%p');
 
Maintainance

delete force noprompt obsolete recovery window of 14 days;
crosscheck backup;
delete force noprompt expired backup;

Report
list backup;

Hope this help. Regards Rupam