Oracle incremental backup shell scripts

来源:互联网 发布:淘宝店虚假交易警告 编辑:程序博客网 时间:2024/06/09 13:48
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