- 论坛徽章:
- 17
|
按照下面的过程配置了RMAN,但是备份不成功,log也不能删除
RMAN备份
create tablespace rman_tbs datafile '/data/oracle/oradata/new/rman_tbs01.dbf' size 1500M;
create user rman identified by rman_#_01 default tablespace rman_tbs temporary tablespace temp;
grant connect,resource ,recovery_catalog_owner to rman;
rman catalog rman/rman_#_01
create catalog tablespace rman_tbs;
connect target sys/t_#_sys
register database;
report schema;
configure retention policy to redundancy 2;
configure retention policy to recovery window of 30 days;
--倒出RMAN数据SHELL脚本exp_rman.sh
#!/bin/bash
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=/data/oracle/product/10.2.0/db_1
export PATH=$ORACLE_HOME/bin PATH
export ORACLE_SID=new
export LD_LIBRARY_PATH=$ORACLE_HOME/lib LD_LIBRARY_PATH:/usr/lib:/usr/local/lib
export LC=en_US
NLS_LANG="simplified chinese"_china.zhs16gbk
export NLS_LANG
exp rman/rman_#_01 file=/back/rman_bak/rman.dmp log=/back/rman_bak/rman.log
--零级备份RMAN脚本rman_level0.dcv
connect catalog rman/rman_#_01
connect target sys/t_#_sys@new
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
backup incremental level 0 database format '/back/rman_bak/rman_level0/level0_%d_%s_%p_%u.bak'
tag='level 0' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '/back/rman_bak/rman_level0/log_%d_%s_%p_%u.bak' delete all input;
release channel d2;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--零级备份SHELL脚本的rman_level0.sh
#!/bin/bash
cd
#..bash_profile
cd /data/oracle/rman_bak
rman cmdfile=rman_level0.dcv msglog=/back/rman_bak/rman_level0/level0_backup.log
--一级差异增量备份RMAN脚本rman_level1.dcv
connect catalog rman/rman_#_01
connect target sys/t_#_sys@new
run {
allocate channel d1 type disk;
backup incremental level 1 format '/back/rman_bak/rman_level1/level1_%d_%s_%p_%u.bak' tag = 'level 1' database;
sql 'alter system archive log current';
backup archivelog all format '/back/rman_bak/rman_level1/log_%d_%s_%p_%u.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--一级差异增量备份SHELL脚本rman_level1.sh
#!/bin/bash
cd
#..bash_profile
cd /data/oracle/rman_bak
rman cmdfile=rman_level0.dcv msglog=/back/rman_bak/rman_level1/level1_backup.log
--二级差异增量备份RMAN脚本rman_level1.dcv
connect catalog rman/rman_#_01
connect target sys/t_#_sys@new
run {
allocate channel d1 type disk;
backup incremental level 2 format '/back/rman_bak/rman_level2/level2_%d_%s_%p_%u.bak' tag = 'level 2' database;
sql 'alter system archive log current';
backup archivelog all format '/back/rman_bak/rman_level2/log_%d_%s_%p_%u.bak' delete all input;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
resync catalog;
--二级差异增量备份SHELL脚本rman_level2.sh
#!/bin/bash
cd
#..bash_profile
cd /data/oracle/rman_bak
rman cmdfile=rman_level0.dcv msglog=/back/rman_bak/rman_level2/level2_backup.log
自动执行
[oracle@jwdb oracle]$ crontab -l
######### RMAN AUTO BACKUP ##########
00 01 * * 0 /data/oracle/rman_bak/rman_level0.sh
////每周日执行0级备份
00 01 * * 1,4 /data/oracle/rman_bak/rman_level1.sh
////每周1,4执行1级备份
00 01 * * 2,3,5,6 /data/oracle/rman_bak/rman_level2.sh
////每周2,3,5,6执行2级备份 |
|