首页 > 网络 > 其他 >

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

2017-04-25

最近为公司制定的备份解决方案,不用TSM,不用CA,不用带库,不用NBU。

说明

最近为公司制定的备份解决方案,不用TSM,不用CA,不用带库,不用NBU。

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

1、拓扑

wKiom1j4F7TCN7NpAACImoZK9UA462.png

2、排程wKiom1j4GH6iIehGAABnkoOhh9s197.png

3、各服务器配置说明

备份服务器设置:

1、nfs搭建
[root@wubackuporaclebackup]#rpm-qa|grepnfs
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@wubackuphome]#vim/etc/exports
home/oraclebackup10.55.1.204(rw,no_root_squash)
home/eipbackup10.55.1.3(rw,no_root_squash)
home/wuwis2backup10.55.1.88(rw,no_root_squash)
home/wuwis1backup10.55.1.10(rw,no_root_squash)
home/wulmailbackup10.55.1.13(rw,no_root_squash)
home/wuwtl1backup10.55.1.14(rw,no_root_squash)
[root@wubackuphome]#exportfs-r
[root@wubackuphome]#servicestartnfs.service
start:unrecognizedservice
[root@wubackuphome]#servicenfsstart
StartingNFSservices:[OK]
StartingNFSquotas:[OK]
StartingNFSmountd:[OK]
StartingNFSdaemon:[OK]
StartingRPCidmapd:[OK]
[root@wubackuphome]#ss-tnl
StateRecv-QSend-QLocalAddress:PortPeerAddress:Port
LISTEN0128*:875*:*
LISTEN0128:::43660:::*
LISTEN064:::34191:::*
LISTEN0128:::58255:::*
LISTEN0128:::111:::*
LISTEN0128*:111*:*
LISTEN0128:::41842:::*
LISTEN0128*:35668*:*
LISTEN0128:::22:::*
LISTEN0128*:22*:*
LISTEN0128127.0.0.1:631*:*
LISTEN0128::1:631:::*
LISTEN064*:48665*:*
LISTEN0100::1:25:::*
LISTEN0100127.0.0.1:25*:*
LISTEN0128:::56346:::*
LISTEN0128127.0.0.1:6010*:*
LISTEN0128::1:6010:::*
LISTEN0128127.0.0.1:6011*:*
LISTEN0128::1:6011:::*
LISTEN0128*:36064*:*
LISTEN064:::2049:::*
LISTEN064*:2049*:*
LISTEN0128*:54337*:*
LISTEN0128*:49322*:*
[root@wubackuphome]#ss-tnl|grep2049
LISTEN064:::2049:::*
LISTEN064*:2049*:*
[root@wubackuphome]#ls
eipbackuplost+foundoraclebackupwulmailbackupwuwis1backupwuwis2backupwuwtl1backup

2、samba服务搭建
说明:本来规划的时候都是使用nfs提供服务,但是server2003要挂载nfs文件夹需要使用sfu插件,实在国内找不到资源,再次吐槽下天朝。所以改用了使用samba提供服务。
[root@wubackuporaclebackup]#yuminstallsamba-y
Installed:
samba.x86_640:3.6.23-42.el6_9

DependencyUpdated:
libsmbclient.x86_640:3.6.23-42.el6_9samba-client.x86_640:3.6.23-42.el6_9
samba-common.x86_640:3.6.23-42.el6_9samba-winbind.x86_640:3.6.23-42.el6_9
samba-winbind-clients.x86_640:3.6.23-42.el6_9

Complete!
[root@wubackuporaclebackup]#servicesmbstatus
smbdisstopped
[root@wubackuporaclebackup]#useraddwuwis1
[root@wubackuporaclebackup]#useraddwuwis2
[root@wubackuporaclebackup]#smbpasswd-awuwis1
NewSMBpassword:
RetypenewSMBpassword:
Addeduserwuwis1.
[root@wubackuporaclebackup]#smbpasswd-awuwis2
NewSMBpassword:
RetypenewSMBpassword:
Addeduserwuwis2.
[root@wubackuporaclebackup]#vim/etc/samba/smb.conf
[root@wubackuporaclebackup]#cd/etc/samba/
[root@wubackupsamba]#ls
lmhostssmb.confsmbusers
[root@wubackupsamba]#cpsmb.conf{,.bak}
[root@wubackupsamba]#ls
lmhostssmb.confsmb.conf.baksmbusers
[root@wubackupsamba]#vimsmb.conf
[wuwis1backup]
comment=wuwis1backup
path=/home/wuwis1backup
public=yes
validusers=wuwis1
readlist=wuwis1
writelist=wuwis1

[wuwis2backup]
comment=wuwis2backup
path=/home/wuwis2backup
public=yes
validusers=wuwis2
readlist=wuwis2
writelist=wuwis2
[root@wubackupsamba]#servicesmbstart
StartingSMBservices:[OK]

3、脚本说明:
[root@wubackup~]#crontab-l
#tarbackupfile
128***/OPS/tar.sh&>>/OPS/crontar.log

#rmoldbackupfile
017***/OPS/rmoldbak.sh&>>/OPS/cronrm.log

[root@wubackup~]#cat/OPS/tar.sh
#!/bin/bash
#tarbackupfile

#tareipbackupfile
eipbackupfile=/home/eipbackup/eipbak`date-d"1daysago"+%y%m%d`
if[-e$eipbackupfile];then
echo"`date`">>/OPS/eiptar.log
echo"tareipbackupfilestart">>/OPS/eiptar.log
tar-zcf$eipbackupfile.tar.gz$eipbackupfile
rm-rf$eipbackupfile
echo"`date`">>/OPS/eiptar.log
echo"tareipbackupfilesucsessful">>/OPS/eiptar.log
else
echo"`date`">>/OPS/eiptar.log
echo"tareipbackupfilefail,filenotexist!">>/OPS/eiptar.log

fi

#tarwuwtl1backupfile
wuwtl1backupfile=/home/wuwtl1backup/wuwtl1bak`date+%y%m%d`
if[-e$wuwtl1backupfile];then
echo"`date`">>/OPS/wuwtl1tar.log
echo"tarwuwtl1backupfilestart">>/OPS/wuwtl1tar.log
tar-zcf$wuwtl1backupfile.tar.gz$wuwtl1backupfile
rm-rf$wuwtl1backupfile
echo"`date`">>/OPS/wuwtl1tar.log
echo"tarwuwtl1backupfilesucsessful">>/OPS/wuwtl1tar.log
else
echo"`date`">>/OPS/wuwtl1tar.log
echo"tarwuwtl1backupfilefail,filenotexist!">>/OPS/wuwtl1tar.log

fi

#tarwuwis2backupfile
wuwis2backupfile=/home/wuwis2backup/wuwis2bak`date+%y%m%d`
if[-e$wuwis2backupfile];then
echo"`date`">>/OPS/wuwis2tar.log
echo"tarwuwis2backupfilestart">>/OPS/wuwis2tar.log
tar-zcf$wuwis2backupfile.tar.gz$wuwis2backupfile
rm-rf$wuwis2backupfile
echo"`date`">>/OPS/wuwis2tar.log
echo"tarwuwis2backupfilesucsessful">>/OPS/wuwis2tar.log
else
echo"`date`">>/OPS/wuwis2tar.log
echo"tarwuwis2backupfilefail,filenotexist!">>/OPS/wuwis2tar.log

fi

#tarwuwis1backupfile
wuwis1backupfile=/home/wuwis1backup/wuwis1bak`date+%y%m%d`
if[-e$wuwis1backupfile];then
echo"`date`">>/OPS/wuwis1tar.log
echo"tarwuwis1backupfilestart">>/OPS/wuwis1tar.log
tar-zcf$wuwis1backupfile.tar.gz$wuwis1backupfile
rm-rf$wuwis1backupfile
echo"`date`">>/OPS/wuwis1tar.log
echo"tarwuwis1backupfilesucsessful">>/OPS/wuwis1tar.log
else
echo"`date`">>/OPS/wuwis1tar.log
echo"tarwuwis1backupfilefail,filenotexist!">>/OPS/wuwis1tar.log
fi

[root@wubackup~]#cat/OPS/rmoldbak.sh
#!/bin/bash
#rmoldbackupfile

#rmoraclebackup
#oraclebackupkeep7days
echo`date`>>/OPS/rmorabak.log
echo"rmoldoraclebackupstart">>/OPS/rmorabak.log
find/home/oraclebackup/-ctime+6|xargsrm-rf
echo"oldoraclebackuprmfinishsucessful">>/OPS/rmorabak.log

#rmwuwtl1backup
#wuwtl1backupkeep7days
echo`date`>>/OPS/rmwuwtl1bak.log
echo"rmoldwuwtl1backupstart">>/OPS/rmwuwtl1bak.log
find/home/wuwtl1backup/-ctime+6|xargsrm-rf
echo"oldwuwtl1backuprmfinishsucessful">>/OPS/rmwuwtl1bak.log

#rmwulmailbackup
#wulmailbackupkeep5days
echo`date`>>/OPS/rmwulmailbak.log
echo"rmoldwulmailbackupstart">>/OPS/rmwulmailbak.log
find/home/wulmailbackup/-ctime+4|xargsrm-rf
echo"oldwulmailbackuprmfinishsucessful">>/OPS/rmwulmailbak.log

#rmeipbackup
#eipbackupkeep5days
echo`date`>>/OPS/rmeipbak.log
echo"rmoldeipbackupstart">>/OPS/rmeipbak.log
find/home/eipbackup/-ctime+4|xargsrm-rf
echo"oldeipbackuprmfinishsucessful">>/OPS/rmeipbak.log

#rmwuwis2backup
#wuwis2backupkeep5days
echo`date`>>/OPS/rmwuwis2bak.log
echo"rmoldwuwis2backupstart">>/OPS/rmwuwis2bak.log
find/home/wuwis2backup/-ctime+4|xargsrm-rf
echo"oldwuwis2backuprmfinishsucessful">>/OPS/rmwuwis2bak.log

#rmwuwis1backup
#wuwis1backupkeep5days
echo`date`>>/OPS/rmwuwis1bak.log
echo"rmoldwuwis1backupstart">>/OPS/rmwuwis1bak.log
find/home/wuwis1backup/-ctime+4|xargsrm-rf
echo"oldwuwis1backuprmfinishsucessful">>/OPS/rmwuwis1bak.log

oracle db

1、进行nfs挂载,并加入fstab中
[root@DataGuardscript]#showmount-e10.55.2.83
Exportlistfor10.55.2.83:
/home/oraclebackup10.55.1.204
[root@DataGuardscript]#cd/
[root@DataGuard/]#mkdiroraclebackup
[root@DataGuard/]#mount-tnfs10.55.2.83:/home/oraclebackup/oraclebackup

fstab中添加
10.55.2.83:/home/oraclebackup/oraclebackupnfsdefaults00

2、设定脚本,添加crontab中
#dbbackuptowubackup
309***/OPS/orabackup.sh

3、脚本说明:
#!/bin/bash
#taroraclebackupfile

#checkRMANisrun?
filename="/mnt/rman/log/RmanBackup_`date+%y%m%d`.log"
comparedata="RecoveryManagercomplete."

if[-e$filename];then
echo"`date`RMANisrun"&>>/OPS/tarlog
else
echo"`date`RMANisnotrun,pleasecheck"&>>/OPS/tarlog
exit1
fi

#checkRMANisOK?
data=`tail-1$filename`
if["$data"=="$comparedata"];then
echo"`date`Rmanbackupsucess"&>>/OPS/tarlog
else
echo"`date`Rmanbackupfail"&>>/OPS/tarlog
exit2
fi

#tarbackupfileandmovetobackupserver
/usr/bin/find/mnt/rman-name'oradb1*'>/OPS/tarlist
foriin`/bin/cat/OPS/tarlist`;do
echo"`date`tar$istart"&>>/OPS/tarlog
tar-zcvf$i.tar.gz$i&>>/OPS/tarlog
done

if[$?-eq0];then
echo"`date`tarendsuccess"&>>/OPS/tarlog
mv/mnt/rman/*.tar.gz/oraclebackup
if[$?-eq0];then
echo"`date`movetooraclebackupendsuccess"&>>/OPS/tarlog
else
echo"`date`movetooraclebackupfail"&>>/OPS/tarlog
fi

else
echo"`date`tarfail"&>>/OPS/tarlog
fi

mail

1、nfs挂载,fstab中添加
10.55.2.83:/home/wulmailbackup/wulmailbackupnfsdefaults00

2、脚本编写并在crontab中添加
#wulmailbackuptowubackup
021***/OPS/wulmailbackup.sh

3、脚本说明:
#!/bin/bash
#wulmaildatabackup

logfile=/OPS/wulmailbackup.log
bakfile=wulmailbak`date+%y%m%d`

#cpnotesdatatonotesdatabak
echo`date`>>$logfile
echo"wulmailbackupstart">>$logfile
cp-rf/notesdata/notesdatabak/$bakfile
if[$?-eq0];then
echo"cpdatafinish">>$logfile
else
echo"cpfail">>$logfile
exit1
fi

#tarwulmaildata
echo"tardatastart">>$logfile
tar-zcf/notesdatabak/$bakfile.tar.gz/notesdatabak/$bakfile
if[$?-eq0];then
echo"tardatafinish">>$logfile
rm-rf/notesdatabak/$bakfile
else
echo"tarfail">>$logfile
exit2
fi

#bakcupwulmaildatatobackupserver
echo"mvbackupwulmaildatatobackupserver">>$logfile
mv/notesdatabak/$bakfile.tar.gz/wulmailbackup
if[$?-eq0];then
echo`date`>>$logfile
echo"wulmailbackupsucessful">>$logfile
else
echo"mvfail,backupend">>$logfile
exit3
fi

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

1、windows上安装nfs服务
servermanagercmd.exe-installFS-NFS-Servicesd.exe-installFS-NFS-Services
netuse/persistent:yes#让磁盘隐射永久有效重启存在

2、bat脚本编写并添加至执行计划
@echooff
mount-u:root-p:oracleadmin10.55.2.83:/home/eipbackupz:
echo%date%%time%>>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log
echoeipbackupstart>>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log

mdz:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%

xcopyD:\Lotusz:\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
echoeipbackupsucessful>>z:\eipbak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log

umountz:

ISO(ISO1 2相同配置)

1、bat脚本编写并添加至执行计划
@echooff
netusez:\\10.55.2.83\wuwis2backup"******"/user:"wuwis2"
echo%date%%time%>>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log
echowuwis2backupstart>>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log

mdz:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%

xcopyD:\Lotusz:\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
echowuwis2backupsucessful>>z:\wuwis2bak%Date:~2,2%%Date:~5,2%%Date:~8,2%.log

netusez:/delete
相关文章
最新文章
热点推荐