Oracle服務(wù)端裝的版本為10.1,IP地址為129.1.9.90
在備份機(jī)上安裝oracle10.1,配IP地址為129.1.9.91,關(guān)閉防火墻。
并修改tnsnames.ora文件,添加如下內(nèi)容:
以下是代碼片段: JMYBJS = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 129.1.9.90)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jmybjs) ) ) |
在D盤新建文件夾:
d:\backup\dmp
d:\backup\log
用來存放dmp文件和備份的日志。
修改備份腳本如下:
以下是代碼片段: 'Nightly Bulk copy export for the customers table&veiw 'Write output to clarentYYMMDD.txt and errors to ERRYYMMDD.txt ''strssql="bcp demo.clrnuser.bill_recordview out c:\bibak\"+outfile+" -U jl_voip -P jlvoip -c -k -t," Dim outfile,aa,bb,stroption1,stroption2,A,B,C,strsql set ws=WScript.CreateObject("WScript.shell") A=cint(month(dateadd("d",0,date()))) B=cint(day(dateadd("d",0,date()))) C=cint(year(dateadd("d",0,date()))) if A<10 then aa=cstr(0)+cstr(A) if A>=10 then aa=cstr(A) if B<10 then bb=cstr(0)+cstr(B) if B>=10 then bb=cstr(B) outfile=cstr(C)+aa+bb stroption1="D:\oracle_bf\product\10.1.0\Db_1\BIN\exp system/******@jmybjs full=y buffer=900000 file=d:\backup\dmp\jmybjs"+outfile+" log=d:\backup\log\jmybjs"+outfile+".log""" strsql=stroption1 ret=ws.Run(strsql) |
測(cè)試后,備份正常。