熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

Windows下的Oracle導出腳本

2022-06-13   來源: Oracle 

  導出腳本內容

  @echo off

  REM

  REM File name Dailybat

  REM Batch Process

  Reload DB Backup

  REM

  REM Author FrankFan

  REM Modification History

  Created

  REM Modified

  REM

  for /F "tokens= delims=/ " %%i in (date /t) do @set FILENAMEDT=%%i%%j%%k

  #取系統當前日期年月日(中文格式)月日年(英文格式)

  for /F "tokens= delims=: " %%i in (time /t) do @set FILENAMETM=%%i%%j

  #取系統當前時間時分

  SET USERNAME=SYSTEM #oracle帳號

  SET USERPASSWD= #oracle密碼

  SET SERVICENAME=QEWAY #oracle SID

  SET SCHEMASNAME=ISCOP #oracle SCHEMA帳號

  SET RARTOOL=C:\Program Files\WinRAR #設定WINRAR路徑(各個機器不同)

  SET DBBACKUPPATH=D:\DBBAK #設定被導出的文件路徑

  SET DBADIRECTORIES=DBBAK #oracle內設置的Directory目錄名

  SET DBBACKUPFILENAME=QEWAY_%FILENAMEDT%%FILENAMETM%

  goto main

  :main

  ECHO Exporting schemas

  expdp %USERNAME%/%USERPASSWD%@%SERVICENAME% DUMPFILE=%DBADIRECTORIES%:%DBBACKUPFILENAME%dmp schemas=%SCHEMASNAME% LOGFILE=%DBADIRECTORIES%:%DBBACKUPFILENAME%log

  ECHO Done exporting schemas

  ECHO =======================================================

  ECHO Done export

  if exist %DBBACKUPPATH%\%DBBACKUPFILENAME%RAR del %DBBACKUPPATH%\%DBBACKUPFILENAME%RAR

  "%RARTOOL%\winrarexe" a ep %DBBACKUPPATH%\%DBBACKUPFILENAME%RAR %DBBACKUPPATH%\%DBBACKUPFILENAME%dmp

  del %DBBACKUPPATH%\%DBBACKUPFILENAME%dmp

  Echo Compression complete

  forfiles /p "%DBBACKUPPATH%" /m *rar d /c "cmd /c del /f @path"

  #刪除天之前的RAR文件

  REM Send a mail to notification

  start D:\DBBAK\Batch_notification_Dailyvbs #調用郵件通知VBS文件

  EXIT

  郵件通知VBS文件內容

  NameSpace = "

  set Email = CreateObject("CDOMessage")

  EmailFrom = "XXXX@Exchangecom"

  EmailTo = "XXXX@com"

  EmailSubject = "Gongxtpt Batch Daily Task"

  EmailTextbody = "Gongxtpt Batch Daily Task was done!! Starting at :AM"

  with EmailConfigurationFields

  Item(NameSpace&"sendusing") =

  Item(NameSpace&"smtpserver") = ""

  Item(NameSpace&"smtpserverport") =

  Item(NameSpace&"smtpauthenticate") =

  Item(NameSpace&"sendusername") = ""

  Item(NameSpace&"sendpassword") = ""

  Update

  end with

  EmailSend

  Set Email=Nothing


From:http://tw.wingwit.com/Article/program/Oracle/201311/19111.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.