萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> oracle教程 >> Oracle的exp備份機搭建步驟

Oracle的exp備份機搭建步驟

  JMYBJS =

  (DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = 129.1.9.90)(PORT = 1521))

  (CONNECT_DATA =

  (SERVER = DEDICATED)

  (SERVICE_NAME = jmybjs)

  )

  )

  在D盤新建文件夾:

  d:backupdmp

  d:backuplog

  用來存放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_bfproduct10.1.0Db_1BINexp system/******@jmybjs full=y buffer=900000 file=d:backupdmpjmybjs"+outfile+" log=d:backuplogjmybjs"+outfile+".log"""

  strsql=stroption1

  ret=ws.Run(strsql)

  測試後,備份正常。

  修改刪除腳本,使備份數據在備份機上保留30天

  '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",-30,date())))

  B=cint(day(dateadd("d",-30,date())))

  C=cint(year(dateadd("d",-30,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="C:WINDOWSsystem32Delete d:backupdmpjmybjs"+outfile+".dmp"

  strsql=stroption1

  ret=ws.Run(strsql)

  測試,提示不正確,檢查後,發現這個備份機中的sytem32文件夾下沒有delete.exe文件,從其他系統中拷貝delete.exe文件到這個備份機的system32下,測試正常。

  最後,添加到windows的定時任務中

        :更多精彩文章請關注三聯編程教程欄目。

copyright © 萬盛學電腦網 all rights reserved