1、背景说明
公司磁带库坏了。。每天oracle的备份往哪里放?
2、备份方式重新规划
原备份方式
现备份方式
3、备份脚本分享
小白写了一个备份的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
时间: 2024-10-10 17:10:11