首页 > 代码库 > Oralce 导出脚本命令,定时执行

Oralce 导出脚本命令,定时执行

原文:Oralce 导出脚本命令,定时执行

@echo off @echo ================================================

@echo  windows环境下Oracle数据库的自动备份脚本

@echo  1、备份导出文件时自动使用当前日期进行命名。

@echo  2、urls 是临时目录,url,是最终保存目录 ,保存后会删除临时目录

@echo  3、这是Oracle 11g 的导出命令,下面是5个用户的导出 expdp ppp/ppp@zcjc dumpfile=zcjc_ppp_%mydate%_exp.dmp content=all

@echo  4、把文件命名为 xxxxx.bat,我这里的命名是expdportOracle.bat

@echo  5、脚本执行时间,在dos命令里面执行at 02:0 /every:m,t,w,th,f,s,su "E:\expbportOracle.bat" 

@echo  6、删除任务,在dos命令里面执行 at 1 /delete 

@echo  7.不懂的地方找我问QQ:1216331654

@echo ================================================

 

set mydate=%date:~0,4%%date:~5,2%%date:~8,2%

set years=%date:~0,4%

set month=%date:~5,2%

set day=%date:~8,2%

set urls=E:\app\Administrator\admin\zcjc\dpdump set url=E:\expbportOracle

md %url%\%years% md %url%\%years%\%month% md %url%\%years%\%month%\%day%

 

expdp ppp/ppp@zcjc dumpfile=zcjc_ppp_%mydate%_exp.dmp content=all

expdp aus/aus@zcjc dumpfile=zcjc_aus_%mydate%_exp.dmp content=all

expdp cif/cif@zcjc dumpfile=zcjc_cif_%mydate%_exp.dmp content=all

expdp spm/spm@zcjc dumpfile=zcjc_spm_%mydate%_exp.dmp content=all

expdp ua/ua@zcjc dumpfile=zcjc_ua_%mydate%_exp.dmp content=all

 

copy "%urls%\zcjc_ppp_%mydate%_exp.dmp" "%url%\%years%\%month%\%day%"

copy "%urls%\zcjc_aus_%mydate%_exp.dmp" "%url%\%years%\%month%\%day%"

copy "%urls%\zcjc_cif_%mydate%_exp.dmp" "%url%\%years%\%month%\%day%"

copy "%urls%\zcjc_spm_%mydate%_exp.dmp" "%url%\%years%\%month%\%day%"

copy "%urls%\zcjc_ua_%mydate%_exp.dmp" "%url%\%years%\%month%\%day%"

 

del %urls%\zcjc_ppp_%mydate%_exp.dmp

del %urls%\zcjc_aus_%mydate%_exp.dmp

del %urls%\zcjc_cif_%mydate%_exp.dmp

del %urls%\zcjc_spm_%mydate%_exp.dmp

del %urls%\zcjc_ua_%mydate%_exp.dmp

exit

Oralce 导出脚本命令,定时执行