ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 數據庫全備份腳本

數據庫全備份腳本

原创 Linux操作系统 作者:tom_xieym 时间:2011-08-04 15:47:37 0 删除 编辑

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;

 

案例如下:

su - oracle </opt/app/oracle/product/9.2.0.4.0/bin/rman target sys/oracle catalog rman/rman
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;
exit
EOF1


 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25850100/viewspace-704111/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 11 g rac 安裝 1步
请登录后发表评论 登录
全部评论

注册时间:2011-05-20

  • 博文量
    77
  • 访问量
    95586