Monday, June 13, 2016

Rman_Scripts


  • Taking Partial Backups(Specific datafiles):

     
run
        {
         allocate channel c1 type disk
         format='/u01/app/backup/example01.bak';
         backup datafile '/u01/app/oracle/oradata/testdb/example01.dbf';
         release channel c1;
        }


rman target / cmdfile=/u01/app/cmd/rm1

  • Taking Database backup(all datafiles):


    run
   {
    allocate channel c1 type disk
    format ='/u01/app/backup/fullbac%U.bak';
    backup database;
    release channel c1;
   }
rman target / cmdfile=/u01/app/cmd/rm2

  • Backup of current control file:


   run
   {
    allocate channel c1 type disk;
    backup
    format='/u01/app/backup/contl.bak'
    current controlfile;
    release channel c1;
   }
rman target / cmdfile=/u01/app/cmd/rm3


  •  Whole database backup(datafile+archive file):


    run
   {
    allocate channel c1 type disk;
    backup
    format='/u01/app/%d_%p_%sabc.bak'
    database plus archivelog;
    release channel c1;
   }

rman target / cmdfile=/u01/app/cmd/rm4

  • Parallelism of Backup


  run
   {
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    allocate channel c3 type disk;
    backup
    incremental level 0
    format 'c:\bac\df_%d_%p_%s.bak'
   (datafile 1,2 channel c1 tag=dbf1)
   (datafile 3,4 channel c2 tag=dbf2)
   (datafile 5 channel c3 tag=dbf3);
    release channel c1;
    release channel c2;
    release channel c3;
   }


rman target / cmdfile=/u01/app/cmd/rm5

  • Multiplexed backups


 run
  {
   allocate channel c1 type disk;
   backup copies 2 datafile 5
   format '/u01/app/copy1.bak' , '/u01/app/oracle/copy2.bak';
   release channel c1;
  }


rman target / cmdfile=/u01/app/cmd/rm6

  • Taking image copies:


 run
  {
   allocate channel c1 type disk;
   copy datafile '/u01/app/oracle/oradata/testdb/example01.dbf'
                  to '/u01/app/bac/dat.bak';
   copy archivelog '/u01/app/oracle/flash_recovery_area/testdb/arc00044.001'
                  to '/u01/app/bac/arc.bak';
   release channel c1;
  }

rman target / cmdfile=/u01/app/cmd/rm7


  • Backup archive file to diff location and then delete from primary location:


 run
   {
    allocate channel c1 type disk;
    backup
    format '/u01/app/bac/arc_%d_%t_%s.bak'
    archivelog all delete all input;
    release channel c1;
   }

rman target / cmdfile=/u01/app/cmd/rm8

No comments:

Post a Comment