欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用批處理異地備份數(shù)據(jù)(winrar)

 更新時(shí)間:2014年04月29日 22:26:01   作者:  
為了保障服務(wù)器中數(shù)據(jù)的可恢復(fù)性,采用異地備份數(shù)據(jù)庫(kù)方案。異地備份數(shù)據(jù)分為異地備份文件數(shù)據(jù)與異地備份數(shù)據(jù)庫(kù)數(shù)據(jù)二種

為了保障服務(wù)器中數(shù)據(jù)的可恢復(fù)性,采用異地備份數(shù)據(jù)庫(kù)方案。異地備份數(shù)據(jù)分為異地備份文件數(shù)據(jù)與異地備份數(shù)據(jù)庫(kù)數(shù)據(jù)二種。其中異地備份文件數(shù)據(jù)是為了備份網(wǎng)站中用戶上傳的文件而設(shè)計(jì)的。而異地備份數(shù)據(jù)庫(kù)數(shù)據(jù)是將數(shù)據(jù)庫(kù)中數(shù)據(jù)備份文件上傳到異地服務(wù)器。

如果省事可以使用一些軟件例如 綠環(huán)FTP數(shù)據(jù)備份rsync都可以。

一、實(shí)施過(guò)程及原理為:

1.       需安裝WinRAR軟件,用于將多個(gè)待備份文件壓縮成一個(gè)壓縮文件。
2.       書寫備份腳步:
目錄定位到WinRAR軟件安裝路徑下
cd c:\program files\winrar
執(zhí)行rar.exe程序
rar a -r -y c:\c.rar c:\c\a c:\c\b
連接遠(yuǎn)程ftp服務(wù)器,其中要書寫ftp://ftp.txt/文件
ftp -s:c:\ftp.txt 192.168.0.1
可刪除本地備份文件
del /f /q c:\c.rar
目錄重新定位
cd\
完整代碼如下(back.bat):

復(fù)制代碼 代碼如下:

cd c:\program files\winrar
rar a -r -y c:\c.rar c:\c\a c:\c\b
ftp -s:c:\ftp.txt 192.168.0.1
del /f /q c:\c.rar
cd\

3. 書寫遠(yuǎn)程ftp連接配置文件

用戶名
密碼
cd 路徑
Put 本地文件路徑及文件名 遠(yuǎn)程文件路徑及文件名
Bye為退出
完整代碼如下(ftp.txt):
admin
Heroic
put c:\c.rar c.rar
bye
4.       通過(guò)windows自帶的“任務(wù)計(jì)劃”功能定時(shí)運(yùn)行bat文件。(通過(guò)“開始”->“附近”->“系統(tǒng)工具”->“任務(wù)計(jì)劃”
5.       備份oracle數(shù)據(jù)庫(kù)命令為:
exp userid/pwd@servicename file = "backupfilepath" owner = user
注意userid為系統(tǒng)管理員,backupfilepath為文件保存路徑(文件后綴為dmp) ,user是針對(duì)那個(gè)用戶進(jìn)行備份,如果不寫該參數(shù),則默認(rèn)針對(duì)userid用戶進(jìn)行備份
例如:
exp user/pwd@servername file=d:"backup"oracle"oracle%date:~0,10%.dmp owner=system log=d:"backup"oracle"oracle%date:~0,10%.log
(其中%date:~0,10% 為取當(dāng)前系統(tǒng)時(shí)間。0為開始位置,10為結(jié)束位置)

復(fù)制代碼 代碼如下:

set files=c:\backup\%date:~0,10%.rar
set dbfilesdmp=c:\backup\%date:~0,10%db.dmp
set userdb="jbpmdemo"
set pwddb="jbpmdemo"
set domain="master.jhserver"
set filespath=c:\c\a c:\c\b
set ftpfile="c:\backup\ftp.txt"
set ftpname=admin
set ftppwd=Heroic
set ftpfiles="%date:~0,10%.rar"
set ftpdbfiles="%date:~0,10%db.rar"
set ftpdomain="192.168.0.1"
set rarpath="c:\program files\winrar"

@echo 開始備份數(shù)據(jù)庫(kù)
exp %userdb%/%pwddb%@%domain% file="%dbfilesdmp%"

@echo 開始?jí)嚎s文件
c:
cd c:\program files\winrar
rar a -r -y %files% %filespath% %dbfilesdmp%

@echo 寫入文件ftp
@echo %ftpname%>%ftpfile%
@echo %ftppwd%>>%ftpfile%
@echo put %files% %ftpfiles%>>%ftpfile%
@echo bye>>%ftpfile%
@echo 上傳%files%.rar文件
ftp -s:%ftpfile% 192.168.0.1
del /f /q %files%

相關(guān)文章

最新評(píng)論