RMAN配置自动增量备份
2013-05-29 16:47
507 查看
#!/bin/bash
set -e
#############################################################
# sunday incremental level 0
# other day incremental level 1
#
#############################################################
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
rman_bin=$ORACLE_HOME/bin/rman
weekday=`date +%a`
case "${weekday}" in
"Sun")
inc_level=0
;;
"Wed")
inc_level=1
;;
*)
inc_level=1
;;
esac
rman_user=sys
rman_passwd=oracle
catalog_inst_name=orcl
target_sys_passwd=oracle
target_inst_name=orcl
log_file=/home/oracle/tmp/backup/log/`date +%F`_${inc_level}.log
bak_file=/home/oracle/tmp/backup/bkfile/'bak_%T_%U'
arc_file=/home/oracle/tmp/backup/bkfile/'arc_%T_%U'
ctl_file=/home/oracle/tmp/backup/bkfile/'ctl_%F'
$rman_bin log ${log_file} >> /dev/null 2>&1 <<EOF
connect catalog ${rman_user}/${rman_passwd}@${catalog_inst_name};
connect target sys/${target_sys_passwd}@${target_inst_name};
run {
configure backup optimization on;
configure archivelog deletion policy to applied on standby;
configure retention policy to redundancy 3;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to '${ctl_file}';
allocate channel ch1 device type disk;
backup incremental level ${inc_level} cumulative database format '${bak_file}' skip readonly plus archivelog format '${arc_file}';
release channel ch1;
}
crosscheck backup;
delete noprompt obsolete;
delete noprompt archivelog all completed before 'sysdate - 14';
exit;
EOF
exit 0
******
用cron创建定时执行任务,默认情况下,cron为开机自动启动的
执行 crontab –e 添加以下语句:
00 01 * * * sh /u01/backup/backup.sh
保存退出
set -e
#############################################################
# sunday incremental level 0
# other day incremental level 1
#
#############################################################
export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2
rman_bin=$ORACLE_HOME/bin/rman
weekday=`date +%a`
case "${weekday}" in
"Sun")
inc_level=0
;;
"Wed")
inc_level=1
;;
*)
inc_level=1
;;
esac
rman_user=sys
rman_passwd=oracle
catalog_inst_name=orcl
target_sys_passwd=oracle
target_inst_name=orcl
log_file=/home/oracle/tmp/backup/log/`date +%F`_${inc_level}.log
bak_file=/home/oracle/tmp/backup/bkfile/'bak_%T_%U'
arc_file=/home/oracle/tmp/backup/bkfile/'arc_%T_%U'
ctl_file=/home/oracle/tmp/backup/bkfile/'ctl_%F'
$rman_bin log ${log_file} >> /dev/null 2>&1 <<EOF
connect catalog ${rman_user}/${rman_passwd}@${catalog_inst_name};
connect target sys/${target_sys_passwd}@${target_inst_name};
run {
configure backup optimization on;
configure archivelog deletion policy to applied on standby;
configure retention policy to redundancy 3;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to '${ctl_file}';
allocate channel ch1 device type disk;
backup incremental level ${inc_level} cumulative database format '${bak_file}' skip readonly plus archivelog format '${arc_file}';
release channel ch1;
}
crosscheck backup;
delete noprompt obsolete;
delete noprompt archivelog all completed before 'sysdate - 14';
exit;
EOF
exit 0
******
用cron创建定时执行任务,默认情况下,cron为开机自动启动的
执行 crontab –e 添加以下语句:
00 01 * * * sh /u01/backup/backup.sh
保存退出
相关文章推荐
- centos下通过RMAN配置自动增量备份
- 使用Rman配置自动增量备份
- Linux 下crontab管理RMAN一周自动增量备份
- oracle 数据库rman+crontab自动差异增量备份
- linux自动运行rman增量备份脚本
- linux自动运行rman增量备份脚本
- linux自动运行rman增量备份脚本
- mysql大数据量且多存储引擎场景下的完整+增量自动异地备份的可靠方案
- 使用Rman增量备份修复Oracle11g adg传输Gap
- ORACLE RMAN备份的脚本配置[转载]
- Win7下配置MySql定时自动备份
- ORACLE RMAN 增量备份完整恢复测试
- 【RMAN】使用RMAN增量备份刷新 Standby Database
- RMAN自动备份脚本
- rman 0级1级增量备份
- Oracle Database 12c RMAN全量+增量备份+归档日志恢复详解
- oracle中Rman增量备份下各级别level的区别
- Step5:通过rman增量备份修复standby
- cisco网络设备配置自动备份
- rman备份前环境配置详解