oracle增量备份脚本

2012-11-12
  oracle 增量备份脚本
  OS :RHEL AS 4 oracle 10g
  0备份脚本
  #!/bin/bash
  # incremental level 0 backup script
  source /home/oracle/.bash_profile
  current_day=`date +%Y%m%d`
  mkdir /home/oracle/RMANBACKUP/$current_day
  rman target / <<EOF
  run
  {
  CONFIGURE CONTROLFILE AUTOBACKUP ON;
  CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/RMANBACKUP/$current_day/PID-%F';
  allocate channel dev1 type disk;
  allocate channel dev2 type disk;
  allocate channel dev3 type disk;
  backup incremental level 0 tag='db0'
  format '/home/oracle/RMANBACKUP/$current_day/%n_%T_%U' database;
  sql 'alter system archive log current';
  backup archivelog all format '/home/oracle/RMANBACKUP/$current_day/arc_%n_%T_%U' delete all input;
  release channel dev1;
  release channel dev2;
  release channel dev3;
  }
  EOF
  1级累积增量脚本
  #!/bin/bash
  # incremental level 1 backup script
  source /home/oracle/.bash_profile
  current_day=`date +%Y%m%d`
  incr_day=incr$current_day
  mkdir /home/oracle/RMANBACKUP/$incr_day
  rman target / <<EOF
  run
  {
  CONFIGURE CONTROLFILE AUTOBACKUP ON;
  CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/oracle/RMANBACKUP/$incr_day/PID-%F';
  allocate channel dev1 type disk;
  allocate channel dev2 type disk;
  allocate channel dev3 type disk;
  backup incremental level 1 cumulative tag='db1'
  format '/home/oracle/RMANBACKUP/$incr_day/%n_%T_%U' database;
  sql 'alter system archive log current';
  backup archivelog all format '/home/oracle/RMANBACKUP/$incr_day/arc_%n_%T_%U' delete all input;
  release channel dev1;
  release channel dev2;
  release channel dev3;
  }
  EOF
  每天RMAN出来的backup set集合到一个文件夹下面
分享到:
0
相关阅读
友情链接
© 2018 我考网 http://www.woexam.com 中国互联网举报中心 湘ICP备18023104号 京公网安备 11010802020116号
违法和不良信息举报:9447029@qq.com