@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