1、Linux下oracle备份脚本
创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站制作、做网站、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的大关网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin:
export NLS_LANG=AMERICAN_AMERICA.zhs16gbk
export ORACLE_SID=orcl
rman target / nocatalog log=/tmp/rman_full.log append< run{ allocate channel c1 type disk; allocate channel c2 type disk; backup filesperset 3 database format '/oracle/backup/full_%d_%T_%s_%p'; sql 'alter system archive log current'; sql 'alter system archive log current'; sql 'alter system archive log current'; backup archivelog all format '/oracle/backup/arch_%d_%T_%s_%p' delete input; backup current controlfile format '/oracle/backup/ctl_%d_%T_%s_%p'; } EOF Linux下删除过期备份的脚本 rman target / nocatalog log=/tmp/rman_delete.log append< run{ allocate channel for maintenance type disk; crosscheck backup; crosscheck archivelog all; delete noprompt archivelog until time 'sysdate-1'; delete noprompt obsolete; } EOF 注:将脚本添加到crontab中定时执行即可。 2、windows下ORACLE备份脚本 全库备份脚本full_backup.txt run{ allocate channel c1 type disk; allocate channel c2 type disk; backup filesperset 2 database format 'd:\u01\rman\full_%d_%T_%s_%p'; sql 'alter system archive log current'; sql 'alter system archive log current'; sql 'alter system archive log current'; backup archivelog all format 'd:\u01\rman\arch_%d_%T_%s_%p' delete input; backup current controlfile format 'd:\u01\rman\ctl_%d_%T_%s_%p'; backup spfile format 'd:\u01\rman\spfile_%d_%T_%s_%p'; } exit 全库备份可执行脚本full_backup.bat rman target / nocatalog log=d:\u01\rman.log append CMDFILE 'd:\u01\full_backup.txt'; 归档日志备份脚本log_backup.txt run{ backup archivelog all format 'd:\u01\rman\arch_%d_%T_%s_%p' delete input; } exit 删除过期备份脚本delete_obsolete.txt run{ crosscheck backup; crosscheck archivelog all; delete noprompt archivelog until time 'sysdate-1'; delete noprompt obsolete; } exit 注:windows下备份需要添加定时任务 另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享文章:ORCLERMAN备份脚本-创新互联
网站地址:http://cdkjz.cn/article/ddjsjd.html