![[Rman]Oracle Rman增量备份Level012脚本 - CSDN博客,第1张 [Rman]Oracle Rman增量备份Level012脚本 - CSDN博客,第1张](/aiimages/%5BRman%5DOracle+Rman%E5%A2%9E%E9%87%8F%E5%A4%87%E4%BB%BDLevel012%E8%84%9A%E6%9C%AC+-+CSDN%E5%8D%9A%E5%AE%A2.png)
Rman Level012备份实验http://blog.csdn.net/u011364306/article/details/50036429
采用0221222增量备份策略,7天一个轮回
也就是周日0级备份,周1 2 4 5 6 采用2级增量备份,周3采用1级增量备份
打开控制文件自动备份
[sql]vIEw plaincopy
CONfigURE CONTRolfile autoBACKUP ON;11g控制文件自动备份新特性:http://blog.csdn.net/u011364306/article/details/50051303
配置控制文件备份路径
[sql]vIEw plaincopy
RMAN > CONfigURE CONTRolfile autoBACKUP FORMAT FOR DEVICE TYPE disK TO‘/file/backup/rman/controlfile_%F‘;将过期天数设为7天
[sql]vIEw plaincopy
RMAN> CONfigURE RETENTION POliCY TO RECOVERY WINDOW OF 7 DAYS;数据备份目录
[sql]vIEw plaincopy
$ mkdir -p /file/backup/rman/脚本解释:
[sql]vIEw plaincopy
vim rman_bak_level0.sh #! /bin/bash export ORACLE_BASE=/u01/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=neal --数据库ORACLE_SID export NLS_LANG=‘AMERICAN_AMERICA.ZHS16GBK‘--字符集 rman target / < run{ allocate channel d1 type disk; --分配通道d1,类型备份到磁盘 allocate channel d2 type disk; --分配通道d2,类型备份到磁盘 backup incremental level 0 database format ‘/file/backup/rman/level0_%d_%s_%p_%u.bkp‘; --备份级别、输出格式、路径 sql ‘alter system archive log current‘; --对当前redo日志进行归档 backup archivelog alldelete input format ‘/file/backup/rman/archivelog_%d_%s_%p_%u.bkp‘; --备份归档日志并删除 crosscheck backup; --检查备份 delete noprompt obsolete; --静默删除过期备份 release channel d1; --释放通道d1 release channel d2; --释放通道d2 } EOF下面开始创建0级 1级 2级备份脚本
0级备份脚本
[sql]vIEw plaincopy
vim rman_bak_level0.sh #! /bin/bash export ORACLE_BASE=/u01/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=neal export NLS_LANG=‘AMERICAN_AMERICA.ZHS16GBK‘ rman target / < run{ allocate channel d1 type disk; allocate channel d2 type disk; backup incremental level 0 database format ‘/file/backup/rman/level0_%d_%s_%p_%u.bkp‘; sql ‘alter system archive log current‘; backup archivelog alldelete input format ‘/file/backup/rman/archivelog_%d_%s_%p_%u.bkp‘; crosscheck backup; delete noprompt obsolete; release channel d1; release channel d2; } EOF1级备份脚本
[sql]vIEw plaincopy
vim rman_bak_level1.sh #! /bin/bash export ORACLE_BASE=/u01/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=neal export NLS_LANG=‘AMERICAN_AMERICA.ZHS16GBK‘ rman target / < run{ allocate channel d1 type disk; allocate channel d2 type disk; backup incremental level 1 database format ‘/file/backup/rman/level1_%d_%s_%p_%u.bkp‘; sql ‘alter system archive log current‘; backup archivelog alldelete input format ‘/file/backup/rman/archivelog_%d_%s_%p_%u.bkp‘; crosscheck backup; delete noprompt obsolete; release channel d1; release channel d2; } EOF2级备份脚本
[sql]vIEw plaincopy
vim rman_bak_level2.sh #! /bin/bash export ORACLE_SID=neal export NLS_LANG=‘AMERICAN_AMERICA.ZHS16GBK‘ /u01/oracle/product/11.2.0/db_1/bin/rman target / < run{ allocate channel d1 type disk; allocate channel d2 type disk; backup incremental level 2 database format ‘/file/backup/rman/level2_%d_%s_%p_%u.bkp‘; sql ‘alter system archive log current‘; backup archivelog alldelete input format ‘/file/backup/rman/archivelog_%d_%s_%p_%u.bkp‘; crosscheck backup; delete noprompt obsolete; release channel d1; release channel d2; } EOF加入到crontab中
[sql]vIEw plaincopy
crontab -e #周日0级备份 00 23 * * 0 /server/scripts/rman_bak_level0.sh #周一、二、四、五、六2级增量备份 00 23 * * 1,2,4,5,6 /server/scripts/rman_bak_level2.sh #周三1级增量备份 00 23 * * 3 /server/scripts/rman_bak_level1.shRman备份中变量的含义
backup incremental level 0 database format=‘LEV0_%d_%t_%U_%s_%p‘
format=string 文件路径和名称的格式串,其中可包含宏变量:
%c copy ID
%p backup pIEce ID
%s backup set ID
%e log sequence
%h log thread ID
%d database name
%n database name(x填充到8个字符)
%I DBID
%f file ID
%F DBID,day,month,year,and sequencer的复合
%N tablespace name
%t timestamp
%M mh mm格式
%Y year yyyy格式
%u backup set+time((x填充到8个字符)
%U %u_%p_%c
%% %
The format specifIEr %U is replaced with unique filenames for the files when you take backups.
the %F element of the format string combines the DBID,and sequence number to generate a unique filename. %F must be included in any control file autobackup format.
总结以上是内存溢出为你收集整理的[Rman]Oracle Rman增量备份Level012脚本 - CSDN博客全部内容,希望文章能够帮你解决[Rman]Oracle Rman增量备份Level012脚本 - CSDN博客所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)