数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

Windows下的Oracle导出脚本


发布日期:2023年05月16日
 
Windows下的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

上一篇:如何杀死oracle死锁进程

下一篇:Oracle数据库设置任务计划备份一周的备份记录