返回顶部

欢迎来到菜鸟大明儿哥的博客

我们一起交流学习,不断提升自我

Oracle备份脚本(数据泵)-Windows平台

将以下内容根据自己想要备份的库修改后保存为expdp.bat,加入到计划任务中


set NLS_LANG=AMERICAN_AMERICA.AL32UTF8
set filename=%date:~0,4%-%date:~5,2%-%date:~8,2%
set workpath=D:\orabak
set zippath=D:\app\Administrator\product\11.2.0\dbhome_1\BIN
set username=test
set password=123456
set sid=orcl
cd %workpath%
echo "TestDBbackup begin..." >> %filename%.log 2<&1
echo expdp %username%/%password%@%sid% dumpfile=%filename%.dmp directory=dumpdir2 >> %filename%.log 2<&1
D:\app\Administrator\product\11.2.0\dbhome_1\BIN\expdp %username%/%password% parallel=4 dumpfile=%filename%.dmp directory=DBBAK >> %filename%.log 2<&1
echo "begin zip file..." >> %filename%.log 2<&1
echo %zippath%\zip.exe -q -9 %filename%.zip %filename%.dmp %filename%.log >> %filename%.log 2<&1
%zippath%\zip.exe -q -9 %filename%.zip %filename%.dmp >> %filename%.log 2<&1
echo "begin delete file..." >> %filename%.log 2<&1
echo del %filename%.dmp export.log >> %filename%.log 2<&1
del %filename%.dmp export.log >> %filename%.log 2<&1
echo "TestDBbackup end" >> %filename%.log 2<&1

posted @ 2021-01-21 13:27  菜鸟大明儿哥  阅读(393)  评论(0编辑  收藏  举报