rman 0.1.2 備份 script

tom_xieym發表於2011-08-03

1.資料庫全備份指令碼
run{
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    allocate channel c3 type disk;
    backup full tag 'nb' format '/opt/app/orabak/nb_full_%u_%s_%p' database include current controlfile;
    sql 'alter system archive log current';
    backup tag 'nb' filesperset 3 format '/opt/app/orabak/nb_arch_%u_%s_%p' archivelog all delete input;
    release channel c1;
    release channel c2;
    release channel c3;
   }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    allocate channel db01 type disk ;
    allocate channel db02 type disk ;
    backup(database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb");
    backup(archivelog all
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb");
     release channel db01;
     release channel db02;
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    configure device type disk parallelism 2;
    backup(database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb");
    backup(archivelog all 
           filesperset=10
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb");
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

2.資料庫零級備份指令碼
run{
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    allocate channel c3 type disk;
    backup incremental level 0 tag 'nb0' format '/opt/app/orabak/nb_full_%u_%s_%p' database skip readonly;
    sql 'alter system archive log current';
    backup tag 'nb0' filesperset 3 format '/opt/app/orabak/nb_arch_%u_%s_%p' archivelog all delete input;
    release channel c1;
    release channel c2;
    release channel c3;
   }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    allocate channel db01 type disk ;
    allocate channel db02 type disk ;
    backup incremental level = 0
          (database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb0");
    backup(archivelog all
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb0");
     release channel db01;
     release channel db02;
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    configure device type disk parallelism 2;
    backup incremental level = 0
          (database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb0");
    backup(archivelog all 
           filesperset=10
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb0");
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

3.資料庫一級備份指令碼
run{
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    allocate channel c3 type disk;
    backup incremental level 1 tag 'nb1' format '/opt/app/orabak/nb_full_%u_%s_%p' database skip readonly;
    sql 'alter system archive log current';
    backup tag 'nb1' filesperset 3 format '/opt/app/orabak/nb_arch_%u_%s_%p' archivelog all delete input;
    release channel c1;
    release channel c2;
    release channel c3;
   }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    allocate channel db01 type disk ;
    allocate channel db02 type disk ;
    backup incremental level = 1
          (database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb1");
    backup(archivelog all
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb1");
     release channel db01;
     release channel db02;
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    configure device type disk parallelism 2;
    backup incremental level = 1
          (database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb1");
    backup(archivelog all 
           filesperset=10
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb1");
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

4.資料庫二級備份指令碼
run{
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    allocate channel c3 type disk;
    backup incremental level 2 tag 'nb2' format '/opt/app/orabak/nb_full_%u_%s_%p' database skip readonly;
    sql 'alter system archive log current';
    backup tag 'nb2' filesperset 3 format '/opt/app/orabak/nb_arch_%u_%s_%p' archivelog all delete input;
    release channel c1;
    release channel c2;
    release channel c3;
   }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    allocate channel db01 type disk ;
    allocate channel db02 type disk ;
    backup incremental level = 2
          (database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb2");
    backup(archivelog all
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb2");
     release channel db01;
     release channel db02;
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    configure device type disk parallelism 2;
    backup incremental level = 2
          (database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb2");
    backup(archivelog all 
           filesperset=10
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb2");
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

run{
    configure device type disk parallelism 2;
    backup incremental level = 2 cumulative
          (database 
           include current controlfile
           filesperset=2
           format '/opt/app/orabak/nb_full_%u_%s_%p'
           tag="nb2");
    backup(archivelog all 
           filesperset=10
           format '/opt/app/orabak/nb_arch_%u_%s_%p'
           tag="nb2");
    }
delete archivelog until time 'sysdate- 7' backed up 2 times to disk;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25850100/viewspace-703940/,如需轉載,請註明出處,否則將追究法律責任。

相關文章