转载:https://blog.csdn.net/wenzhihui_2010/article/details/12099029
@echo 开始备份….
@echo 本程序使用zip压缩,备份后的文件可使用rar或者zip解压。set instanse=orcl
set username=user
set password=password
set extname=rar
set year=%date:~0,4%
set month=%date:~5,2%
set day=%date:~8,255);">set mydate=%year%-%month%-%day%
set spath=e:\backup\
mkdir "%spath%"
set filename=e:\backup\%username%%mydate%
@echo %filename%
exp %username%/%password%@%instanse% file=%filename%.dmp owner=%username% log=%filename%.log
C:\WinRAR\rar.exe a %filename%.%extname% %filename%.dmp %filename%.log
del %filename%.dmp
del %filename%.log
@echo 备份完毕!
@echo 备份文件为:%filename%.%extname%
@echo 执行sql….
@echo off
echo OK!