Oracle全备增量备份脚本,oracle增量备份脚本

【 0级全库备份 】

#!/bin/bash

export ORACLE_SID=ora10

export ORACLE_BASE=/ora10g

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0

date=`date +%y-%m-%d`

logdir=/script/log/

[ -d "$logdir" ] || mkdir -p $logdir

/ora10g/product/10.2.0/bin/rman catalog rman/rman123 target rman/rman@dic10 log="$logdir"/"$date"_10_inc0.log <

run {

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

allocate channel ch4 device type disk;

allocate channel ch5 device type disk;

allocate channel ch6 device type disk;

allocate channel ch7 device type disk;

allocate channel ch8 device type disk;

sql 'alter system archive log current';

backup incremental level 0 database format '/backup/data/0_LEVEL_FULL_DATABASE_%T_%s.ful';

backup archivelog all format '/backup/data/ARCHIVE_LOG_%T_%s.arc' delete all input;

backup current controlfile format '/backup/data/CONTROL_FILE_%T_%s.ctl';

crosscheck backup;

crosscheck archivelog all;

delete noprompt expired backup;

delete noprompt obsolete;

release channel ch1;

release channel ch2;

release channel ch3;

release channel ch4;

release channel ch5;

release channel ch6;

release channel ch7;

release channel ch8;

}

EOF

【 一级差异增量备份 】

#!/bin/bash

export ORACLE_SID=ora10

export ORACLE_BASE=/ora10g

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0

date=`date +%y-%m-%d`

logdir=/script/log/

[ -d "$logdir" ] || mkdir -p $logdir

/ora10g/product/10.2.0/bin/rman catalog rman/rman123 target rman/rman@dic10 log="$logdir"/"$date"_10_inc1.log <

run {

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

allocate channel ch4 device type disk;

allocate channel ch5 device type disk;

allocate channel ch6 device type disk;

allocate channel ch7 device type disk;

allocate channel ch8 device type disk;

sql 'alter system archive log current';

backup incremental level 1 database format '/backup/data/1_LEVEL_INCREMENTAL_DATABASE_%T_%s.ful';

backup archivelog all format '/backup/data/ARCHIVE_LOG_%T_%s.arc' delete all input;

backup current controlfile format '/backup/data/CONTROL_FILE_%T_%s.ctl';

crosscheck archivelog all;

delete noprompt archivelog all;

release channel ch1;

release channel ch2;

release channel ch3;

release channel ch4;

release channel ch5;

release channel ch6;

release channel ch7;

release channel ch8;

}

EOF

【 二级差异增量备份 】

#!/bin/bash

export ORACLE_SID=ora10

export ORACLE_BASE=/ora10g

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0

date=`date +%y-%m-%d`

logdir=/script/log

[ -d "$logdir" ] || mkdir -p $logdir

/ora10g/product/10.2.0/bin/rman catalog rman/rman123 target rman/rman@dic10 log="$logdir"/"$date"_10_inc2.log <

run {

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

allocate channel ch4 device type disk;

allocate channel ch5 device type disk;

allocate channel ch6 device type disk;

allocate channel ch7 device type disk;

allocate channel ch8 device type disk;

sql 'alter system archive log current';

backup incremental level 2 database format '/backup/data/2_LEVEL_INCREMENTAL_DATABASE_%T_%s.ful';

backup archivelog all format '/backup/data/ARCHIVE_LOG_%T_%s.arc' delete all input;

backup current controlfile format '/backup/data/CONTROL_FILE_%T_%s.ctl';

crosscheck archivelog all;

delete noprompt archivelog all;

release channel ch1;

release channel ch2;

release channel ch3;

release channel ch4;

release channel ch5;

release channel ch6;

release channel ch7;

release channel ch8;

}

EOF

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值