您当前的位置: 首页 > 数据库教程 > Oracle教程 > Windows下的Oracle导出脚本

Windows下的Oracle导出脚本

作者:不详 来源:网络 发布时间: 2014-09-01 11:56 点击:
导出脚本内容: @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

Windows下的Oracle导出脚本

  导出脚本内容:

  @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
分享到:
本文"Windows下的Oracle导出脚本"由远航站长收集整理而来,仅供大家学习与参考使用。更多网站制作教程尽在远航站长站。
顶一下
(0)
0%
踩一下
(0)
0%
[点击 次] [返回上一页] [打印]
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
关于本站 - 联系我们 - 广告合作 - 网站声明 - 友情连接- 网站地图 - 站点地图 - 返回顶部
Copyright © 2007-2013 www.yhzhan.com(远航站长). All Rights Reserved .
远航站长:为中小站长提供最佳的学习与交流平台,提供网页制作与网站编程等各类网站制作教程.
官方QQ:445490277 网站群:26680406 网站备案号:豫ICP备07500620号-4