公司磁带库坏了。。每天oracle的备份往哪里放?
原备份方式
现备份方式
小白写了一个备份的shell脚本,分享出来
#!/bin/bash # tar oraclebackup file # check RMAN is run? #我做RMAN备份的时候都会创建一个RMAN日志,所以此日志就可以判断我的RMAN是否执行了 filename="/mnt/rman/log/RmanBackup_`date +%y%m%d`.log" comparedata="Recovery Manager complete." if [ -e $filename ];then echo "`date` RMAN is run" &>> /OPS/tarlog else echo "`date` RMAN is not run,please check" &>> /OPS/tarlog exit 1 fi # check RMAN is OK? #通过判断我的日志最后结果,判断RMAN备份是否成功,如果没有成功,我也没必要备份了 data=`tail -1 $filename` if [ "$data" == "$comparedata" ];then echo "`date` Rman backup sucess" &>> /OPS/tarlog else echo "`date` Rman backup fail" &>> /OPS/tarlog exit 2 fi # tar backupfile and move to backupserver #将当天的备份集压缩备份出来并move至对应nfs提供的文件夹,我300GB的备份压缩后只要30个G,压缩比还是很惊人的 /usr/bin/find /mnt/rman -name ‘oradb1*‘ > /OPS/tarlist for i in `/bin/cat /OPS/tarlist`;do echo "`date` tar $i start" &>> /OPS/tarlog tar -zcvf $i.tar.gz $i &>> /OPS/tarlog done if [ $? -eq 0 ];then echo "`date` tar end success" &>> /OPS/tarlog mv /mnt/rman/*.tar.gz /oraclebackup if [ $? -eq 0 ];then echo "`date` move to oraclebackup end success" &>> /OPS/tarlog else echo "`date` move to oraclebackup fail" &>> /OPS/tarlog fi else echo "`date` tar fail" &>> /OPS/tarlog fi
本文出自 “Open World” 博客,请务必保留此出处http://voidyao000.blog.51cto.com/12458042/1915210
通过shell脚本实现对oracle RMAN备份集压缩并异地备份
原文地址:http://voidyao000.blog.51cto.com/12458042/1915210