oracle差异增量异地备份(Differential incremental and remote backup)
2021/7/24 2:18:20
本文主要是介绍oracle差异增量异地备份(Differential incremental and remote backup),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
- 挂载nfs,并设置开机自动挂载。
2,编写level0备份脚本并chmod执行权限。
[oracle@oracle170 job]$ vim bak0.sh #~/.bashrc中有定义环境变量,脚本中就不需要重复定义。 export ORACLE_SID=OCR export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS" export TMP=/tmp export TMPDIR=$TMP export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$HOME/.local/bin:$HOME/bin:$PATH export EDITOR=vim export TNS_ADMIN=$ORACLE_HOME/network/admin export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin export SQLPATH=$ORACLE_HOME/sqlplus/admin export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8" alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' alias asmcmd='rlwrap asmcmd' /u01/app/oracle/product/12.2.0/db_1/bin/rman target / log=/orabaskup/data/bak0.log append <<EOF run{ allocate channel c1 type disk; allocate channel c2 type disk; allocate channel c3 type disk; crosscheck archivelog all;#先crosscheck一下减少archivelog备份集大小 delete noprompt expired archivelog all; backup incremental level 0 tag 'bak0' format '/orabaskup/data/bak0_%u_%d_%s' database ; sql 'alter system archive log current';#归档level0备份日志 backup archivelog all tag='arch_bak' format '/orabaskup/data/archbak_%u_%d_%s' delete input;#控制文件和参数文件会自动备份。 crosscheck backup; delete noprompt expired backup; delete noprompt obsolete;#删除废弃的备份。 release channel c1; release channel c2; release channel c3; } EOF
3,编写差异增量level1备份脚本并chmod执行权限。
[oracle@oracle170 job]$ vim bak1.sh export ORACLE_SID=OCR export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS" export TMP=/tmp export TMPDIR=$TMP export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$HOME/.local/bin:$HOME/bin:$PATH export EDITOR=vim export TNS_ADMIN=$ORACLE_HOME/network/admin export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin export SQLPATH=$ORACLE_HOME/sqlplus/admin export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8" alias sqlplus='rlwrap sqlplus' alias rman='rlwrap rman' alias asmcmd='rlwrap asmcmd' /u01/app/oracle/product/12.2.0/db_1/bin/rman target / log=/orabaskup/data/bak1.log append <<EOF run{ allocate channel c1 type disk; allocate channel c2 type disk; allocate channel c3 type disk; crosscheck archivelog all; delete noprompt expired archivelog all; backup incremental level 1 tag 'bak1' format '/orabaskup/data/bak1_%u_%d_%s' database ; sql 'alter system archive log current'; backup archivelog all tag='arch_bak' format '/orabaskup/data/archbak_%u_%d_%s' delete input; crosscheck backup; delete noprompt expired backup; delete noprompt obsolete; release channel c1; release channel c2; release channel c3; } EOF
4,oracle用户创建任务计划crontab
[oracle@oracle170 data]$ crontab -e 1 0 * * sat /orabaskup/job/bak0.sh#周六level0级备份 1 0 * * sun,mon,tue,wed,thu,fri /orabaskup/job/bak1.sh#其他level1级备份
这篇关于oracle差异增量异地备份(Differential incremental and remote backup)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23增量更新怎么做?-icode9专业技术文章分享
- 2024-11-23压缩包加密方案有哪些?-icode9专业技术文章分享
- 2024-11-23用shell怎么写一个开机时自动同步远程仓库的代码?-icode9专业技术文章分享
- 2024-11-23webman可以同步自己的仓库吗?-icode9专业技术文章分享
- 2024-11-23在 Webman 中怎么判断是否有某命令进程正在运行?-icode9专业技术文章分享
- 2024-11-23如何重置new Swiper?-icode9专业技术文章分享
- 2024-11-23oss直传有什么好处?-icode9专业技术文章分享
- 2024-11-23如何将oss直传封装成一个组件在其他页面调用时都可以使用?-icode9专业技术文章分享
- 2024-11-23怎么使用laravel 11在代码里获取路由列表?-icode9专业技术文章分享
- 2024-11-22怎么实现ansible playbook 备份代码中命名包含时间戳功能?-icode9专业技术文章分享