为了账号安全,请及时绑定邮箱和手机立即绑定

最近为公司制定的备份解决方案

标签:
MySQL


说明

不用TSM,不用CA,不用带库,不用NBU

对于差钱的公司来说,拿土方法自己弄了套免费的

1、拓扑

wKiom1j4F7TCN7NpAACImoZK9UA462.png

2、排程wKiom1j4GH6iIehGAABnkoOhh9s197.png

3、各服务器配置说明

备份服务器设置:

1、nfs搭建 [root@wubackup oraclebackup]# rpm -qa | grep nfs nfs4-acl-tools-0.3.3-6.el6.x86_64 nfs-utils-1.2.3-39.el6.x86_64 nfs-utils-lib-1.1.5-6.el6.x86_64 [root@wubackup home]# vim /etc/exports  home/oraclebackup 10.55.1.204(rw,no_root_squash) home/eipbackup 10.55.1.3(rw,no_root_squash) home/wuwis2backup 10.55.1.88(rw,no_root_squash) home/wuwis1backup 10.55.1.10(rw,no_root_squash) home/wulmailbackup 10.55.1.13(rw,no_root_squash) home/wuwtl1backup 10.55.1.14(rw,no_root_squash) [root@wubackup home]# exportfs -r [root@wubackup home]# service start nfs.service start: unrecognized service [root@wubackup home]# service nfs start Starting NFS services:                                     [  OK  ] Starting NFS quotas:                                       [  OK  ] Starting NFS mountd:                                       [  OK  ] Starting NFS daemon:                                       [  OK  ] Starting RPC idmapd:                                       [  OK  ] [root@wubackup home]# ss -tnl State      Recv-Q Send-Q             Local Address:Port               Peer Address:Port  LISTEN     0      128                            *:875                           *:*      LISTEN     0      128                           :::43660                        :::*      LISTEN     0      64                            :::34191                        :::*      LISTEN     0      128                           :::58255                        :::*      LISTEN     0      128                           :::111                          :::*      LISTEN     0      128                            *:111                           *:*      LISTEN     0      128                           :::41842                        :::*      LISTEN     0      128                            *:35668                         *:*      LISTEN     0      128                           :::22                           :::*      LISTEN     0      128                            *:22                            *:*      LISTEN     0      128                    127.0.0.1:631                           *:*      LISTEN     0      128                          ::1:631                          :::*      LISTEN     0      64                             *:48665                         *:*      LISTEN     0      100                          ::1:25                           :::*      LISTEN     0      100                    127.0.0.1:25                            *:*      LISTEN     0      128                           :::56346                        :::*      LISTEN     0      128                    127.0.0.1:6010                          *:*      LISTEN     0      128                          ::1:6010                         :::*      LISTEN     0      128                    127.0.0.1:6011                          *:*      LISTEN     0      128                          ::1:6011                         :::*      LISTEN     0      128                            *:36064                         *:*      LISTEN     0      64                            :::2049                         :::*      LISTEN     0      64                             *:2049                          *:*      LISTEN     0      128                            *:54337                         *:*      LISTEN     0      128                            *:49322                         *:*      [root@wubackup home]# ss -tnl | grep 2049 LISTEN     0      64                       :::2049                    :::*      LISTEN     0      64                        *:2049                     *:*   [root@wubackup home]# ls eipbackup  lost+found  oraclebackup  wulmailbackup   wuwis1backup   wuwis2backup  wuwtl1backup  2、samba服务搭建 说明:本来规划的时候都是使用nfs提供服务,但是server 2003要挂载nfs文件夹需要使用sfu插件,实在国内找不到资源,再次吐槽下天朝。所以改用了使用samba提供服务。 [root@wubackup oraclebackup]# yum install samba -y Installed:   samba.x86_64 0:3.6.23-42.el6_9                                                                                     Dependency Updated:   libsmbclient.x86_64 0:3.6.23-42.el6_9                        samba-client.x86_64 0:3.6.23-42.el6_9                  samba-common.x86_64 0:3.6.23-42.el6_9                        samba-winbind.x86_64 0:3.6.23-42.el6_9                 samba-winbind-clients.x86_64 0:3.6.23-42.el6_9                Complete! [root@wubackup oraclebackup]# service smb status smbd is stopped [root@wubackup oraclebackup]# useradd wuwis1 [root@wubackup oraclebackup]# useradd wuwis2 [root@wubackup oraclebackup]# smbpasswd -a wuwis1 New SMB password: Retype new SMB password: Added user wuwis1. [root@wubackup oraclebackup]# smbpasswd -a wuwis2 New SMB password: Retype new SMB password: Added user wuwis2. [root@wubackup oraclebackup]# vim /etc/samba/smb.conf  [root@wubackup oraclebackup]# cd /etc/samba/ [root@wubackup samba]# ls lmhosts  smb.conf  smbusers [root@wubackup samba]# cp smb.conf{,.bak} [root@wubackup samba]# ls lmhosts  smb.conf  smb.conf.bak  smbusers [root@wubackup samba]# vim smb.conf [wuwis1backup]          comment = wuwis1backup     path= /home/wuwis1backup          public = yes          valid users = wuwis1          read list = wuwis1        write list = wuwis1   [wuwis2backup]     comment = wuwis2backup     path= /home/wuwis2backup     public = yes     valid users = wuwis2     read list = wuwis2     write list = wuwis2 [root@wubackup samba]# service smb start Starting SMB services:                                     [  OK  ]  3、脚本说明: [root@wubackup ~]# crontab -l #tar backupfile 12 8 * * * /OPS/tar.sh &>>/OPS/crontar.log  #rm old backupfile 0 17 * * * /OPS/rmoldbak.sh &>>/OPS/cronrm.log  [root@wubackup ~]# cat /OPS/tar.sh  #!/bin/bash #tar backup file  #tar eip backupfile eipbackupfile=/home/eipbackup/eipbak`date -d "1 days ago" +%y%m%d` if [ -e $eipbackupfile ];then     echo "`date`" >> /OPS/eiptar.log     echo "tar eipbackupfile start" >>/OPS/eiptar.log     tar -zcf $eipbackupfile.tar.gz $eipbackupfile     rm -rf $eipbackupfile     echo "`date`" >> /OPS/eiptar.log         echo "tar eipbackupfile sucsessful" >>/OPS/eiptar.log else     echo "`date`" >> /OPS/eiptar.log         echo "tar eipbackupfile fail,file not exist!" >>/OPS/eiptar.log  fi  #tar wuwtl1 backupfile wuwtl1backupfile=/home/wuwtl1backup/wuwtl1bak`date +%y%m%d` if [ -e $wuwtl1backupfile ];then         echo "`date`" >> /OPS/wuwtl1tar.log         echo "tar wuwtl1backupfile start" >>/OPS/wuwtl1tar.log         tar -zcf $wuwtl1backupfile.tar.gz $wuwtl1backupfile         rm -rf $wuwtl1backupfile         echo "`date`" >> /OPS/wuwtl1tar.log         echo "tar wuwtl1backupfile sucsessful" >>/OPS/wuwtl1tar.log else         echo "`date`" >> /OPS/wuwtl1tar.log         echo "tar wuwtl1backupfile fail,file not exist!" >>/OPS/wuwtl1tar.log  fi  #tar wuwis2 backupfile wuwis2backupfile=/home/wuwis2backup/wuwis2bak`date +%y%m%d` if [ -e $wuwis2backupfile ];then         echo "`date`" >> /OPS/wuwis2tar.log         echo "tar wuwis2backupfile start" >>/OPS/wuwis2tar.log         tar -zcf $wuwis2backupfile.tar.gz $wuwis2backupfile         rm -rf $wuwis2backupfile         echo "`date`" >> /OPS/wuwis2tar.log         echo "tar wuwis2backupfile sucsessful" >>/OPS/wuwis2tar.log else         echo "`date`" >> /OPS/wuwis2tar.log         echo "tar wuwis2backupfile fail,file not exist!" >>/OPS/wuwis2tar.log  fi  #tar wuwis1 backupfile wuwis1backupfile=/home/wuwis1backup/wuwis1bak`date +%y%m%d` if [ -e $wuwis1backupfile ];then         echo "`date`" >> /OPS/wuwis1tar.log         echo "tar wuwis1backupfile start" >>/OPS/wuwis1tar.log         tar -zcf $wuwis1backupfile.tar.gz $wuwis1backupfile         rm -rf $wuwis1backupfile         echo "`date`" >> /OPS/wuwis1tar.log         echo "tar wuwis1backupfile sucsessful" >>/OPS/wuwis1tar.log else         echo "`date`" >> /OPS/wuwis1tar.log         echo "tar wuwis1backupfile fail,file not exist!" >>/OPS/wuwis1tar.log fi  [root@wubackup ~]# cat /OPS/rmoldbak.sh  #!/bin/bash #rm old backupfile  #rm oraclebackup #oracle backup keep 7 days  echo `date` >>/OPS/rmorabak.log echo "rm old oraclebackup start" >>/OPS/rmorabak.log find /home/oraclebackup/ -ctime +6 | xargs rm -rf echo "old oraclebackup rm finish sucessful" >>/OPS/rmorabak.log  #rm wuwtl1backup #wuwtl1 backup keep 7 days echo `date` >>/OPS/rmwuwtl1bak.log echo "rm old wuwtl1backup start" >>/OPS/rmwuwtl1bak.log find /home/wuwtl1backup/ -ctime +6 | xargs rm -rf echo "old wuwtl1backup rm finish sucessful" >>/OPS/rmwuwtl1bak.log  #rm wulmailbackup #wulmail backup keep 5 days echo `date` >>/OPS/rmwulmailbak.log echo "rm old wulmailbackup start" >>/OPS/rmwulmailbak.log find /home/wulmailbackup/ -ctime +4 | xargs rm -rf echo "old wulmailbackup rm finish sucessful" >>/OPS/rmwulmailbak.log  #rm eipbackup #eip backup keep 5 days echo `date` >>/OPS/rmeipbak.log echo "rm old eipbackup start" >>/OPS/rmeipbak.log find /home/eipbackup/ -ctime +4 | xargs rm -rf echo "old eipbackup rm finish sucessful" >>/OPS/rmeipbak.log  #rm wuwis2backup #wuwis2 backup keep 5 days echo `date` >>/OPS/rmwuwis2bak.log echo "rm old wuwis2 backup start" >>/OPS/rmwuwis2bak.log find /home/wuwis2backup/ -ctime +4 | xargs rm -rf echo "old wuwis2backup rm finish sucessful" >>/OPS/rmwuwis2bak.log  #rm wuwis1backup #wuwis1 backup keep 5 days echo `date` >>/OPS/rmwuwis1bak.log echo "rm old wuwis1 backup start" >>/OPS/rmwuwis1bak.log find /home/wuwis1backup/ -ctime +4 | xargs rm -rf echo "old wuwis1backup rm finish sucessful" >>/OPS/rmwuwis1bak.log

oracle db

1、进行nfs挂载,并加入fstab中 [root@DataGuard script]# showmount -e 10.55.2.83 Export list for 10.55.2.83: /home/oraclebackup 10.55.1.204 [root@DataGuard script]# cd / [root@DataGuard /]# mkdir oraclebackup [root@DataGuard /]# mount -t nfs 10.55.2.83:/home/oraclebackup /oraclebackup  fstab中添加 10.55.2.83:/home/oraclebackup   /oraclebackup   nfs defaults    0 0  2、设定脚本,添加crontab中 #dbbackup to wubackup 30 9 * * * /OPS/orabackup.sh  3、脚本说明: #!/bin/bash # tar oraclebackup file    # check RMAN is run? 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? 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 /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

mail

1、nfs挂载,fstab中添加 10.55.2.83:/home/wulmailbackup   /wulmailbackup   nfs     defaults        0 0  2、脚本编写并在crontab中添加 #wulmail backup to wubackup 0 21 * * * /OPS/wulmailbackup.sh  3、脚本说明: #!/bin/bash #wulmail data backup  logfile=/OPS/wulmailbackup.log bakfile=wulmailbak`date +%y%m%d`  #cp notesdata to notesdatabak echo `date` >> $logfile echo "wulmail backup start" >> $logfile cp -rf /notesdata /notesdatabak/$bakfile if [ $? -eq 0 ];then     echo "cp data finish" >> $logfile else     echo "cp fail" >> $logfile     exit 1 fi  #tar wulmail data echo "tar data start" >>$logfile tar -zcf /notesdatabak/$bakfile.tar.gz /notesdatabak/$bakfile if [ $? -eq 0 ];then         echo "tar data finish" >> $logfile     rm -rf /notesdatabak/$bakfile else             echo "tar fail" >> $logfile         exit 2 fi  #bakcup wulmail data to backupserver echo "mv backup wulmail data to backupserver" >>$logfile mv /notesdatabak/$bakfile.tar.gz /wulmailbackup if [ $? -eq 0 ];then         echo `date` >> $logfile         echo "wulmail backup sucessful" >> $logfile else             echo "mv fail,backup end" >> $logfile         exit 3 fi

eip(server 2008服务器均雷同,traveler配置此次省略):

1、windows上安装nfs服务 servermanagercmd.exe -install FS-NFS-Servicesd.exe -install FS-NFS-Services net use /persistent:yes #让磁盘隐射永久有效 重启存在  2、bat脚本编写并添加至执行计划 @echo off mount -u:root  -p:oracleadmin 10.55.2.83:/home/eipbackup z: echo %date% %time% >>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log echo eip backup start >>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log  md z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%  xcopy D:\Lotus z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%\ /S/E >>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log echo %date% %time% >>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log echo eip backup sucessful >>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log  umount z:

ISO(ISO1 2相同配置)

1、bat脚本编写并添加至执行计划 @echo off net use z: \\10.55.2.83\wuwis2backup "******" /user:"wuwis2" echo %date% %time% >>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log echo wuwis2 backup start >>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log  md z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%  xcopy D:\Lotus z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%\ /S/E >>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log echo %date% %time% >>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log echo wuwis2 backup sucessful >>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log  net use z: /delete

©著作权归作者所有:来自51CTO博客作者扫地僧void的原创作品,如需转载,请注明出处,否则将追究法律责任

sambabackuptarBackup

2


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消