将以下内容根据自己想要备份的库修改后保存为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