Windows下的Oracle导出脚本
2013-08-07 10:02
281 查看
导出脚本内容:
@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 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%\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:\DBBAK\Batch_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
@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 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%\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:\DBBAK\Batch_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
相关文章推荐
- oracle用户表空间导出导入脚本,以及windows下定时备份脚本
- Oracle自动导出脚本(WINDOWS停的,导出文件名自动加上日期和时间)
- Oracle自动导出脚本,在windows下
- Oracle自动导出脚本(WINDOWS停的,导出文件名自动加上日期和时间)
- ORACLE导出创建非唯一索引脚本的方法 .
- 比较简单windows系统不用RMAN的oracle数据库热备脚本(转载)
- ORACLE 数据库泵导入导出脚本
- windows平台下Oracle自动备份脚本
- Oracle导入导出及删除指定用户下所有数据库脚本
- Oracle 导出脚本
- ORACLE导出表结构脚本
- ORACLE创建表空间、删除用户与建立用户及权限及导入导出脚本
- Windows下安装Ora2Pg并从oracle中导出数据到postgresql
- Oracle下启动脚本 windows
- pd连接数据库生成pd图/各种数据库相互转换(以oracle->mysql为例)/导出成各种数据库脚本
- 将Oracle中的数据导出成SQL脚本的方法
- windows下oracle导入数据脚本 bat
- 将Oracle表里的数据导出生成insert into 脚本
- Oracle 数据库导入导出和windows环境下的oracle服务
- Oracle 数据库导入导出和windows环境下的oracle服务