Windows下的Oracle匯出指令碼

來源:互聯網
上載者:User

   匯出指令碼內容:

  @echo off

  REM

  REM File name Daily.bat

  REM Batch Process

  Reload DB Backup

  REM

  REM Author Frank.Fan

  REM Modification History

  Created 2012-05-07

  REM Modified

  REM

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

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

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

  #取系統目前時間:時分

  SET USERNAME=SYSTEM #oracle帳號

  SET USERPASSWD=123456 #oracle密碼

  SET SERVICENAME=QEWAY #oracle SID

  SET SCHEMASNAME=ISCOP #oracle SCHEMA帳號

  SET RARTOOL=C:Program FilesWinRAR #設定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%winrar.exe" a -ep %DBBACKUPPATH%%DBBACKUPFILENAME%.RAR %DBBACKUPPATH%%DBBACKUPFILENAME%.dmp

  del %DBBACKUPPATH%%DBBACKUPFILENAME%.dmp

  Echo ...Compression complete

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

  #刪除30天之前的RAR檔案

  REM -----------Send a mail to notification-----------

  start D:DBBAKBatch_notification_Daily.vbs #調用郵件通知VBS檔案

  EXIT

  郵件通知VBS檔案內容:

  NameSpace = "http://schemas.microsoft.com/cdo/configuration/"

  set Email = CreateObject("CDO.Message")

  Email.From = "XXXX@Exchange.com"

  Email.To = "XXXX@163.com"

  Email.Subject = "Gongxtpt Batch Daily Task"

  Email.Textbody = "Gongxtpt Batch Daily Task was done!! Starting at 00:00AM"

  with Email.Configuration.Fields

  .Item(NameSpace&"sendusing") = 2

  .Item(NameSpace&"smtpserver") = "10.0.0.12"

  .Item(NameSpace&"smtpserverport") = 25

  .Item(NameSpace&"smtpauthenticate") = 0

  .Item(NameSpace&"sendusername") = ""

  .Item(NameSpace&"sendpassword") = ""

  .Update

  end with

  Email.Send

  Set Email=Nothing

相關文章

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。