1.编辑backup.dat文件
rem @echo offrem
set backupfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.dmp
rem
set logfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.log
rem
set rarfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.rar
set ftpip=10.168.1.200
set username=dba
set password=CEEpcb0752dba
set ftpPath=./iSCSI_dba/backup/NC/
set data=%date:~0,4%%date:~5,2%%date:~8,2%
set /a deldata=data-3
set /a delrar=data-1
rem backup schemas
set backupfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.dmp
set logfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.log
expdp zjdzncc_nc65/zjdzncc_nc65@orcl directory=dump_autobak dumpfile=%backupfile% logfile=%logfile%
rem 上传ftt
rem 注意ftp上传的文件名称全部为大写,删除文件必须大写文件名才能删除
Echo open %ftpip% >ftp.up
Echo %username%>>ftp.up
Echo %password%>>ftp.up
Echo Cd %ftpPath% >>ftp.up
Echo binary>>ftp.up
Echo put E:\autobak\%backupfile%>>ftp.up
Echo prompt niublility>>ftp.up
Echo mdelete ZJDZNCC_%deldata%.DMP >>ftp.up
Echo bye>>ftp.up
FTP -s:ftp.up
del ftp.up /q
: Pause
rem 压缩并删除原有文件
del /a E:\autobak\zjdzncc_%delrar%*.rar
del /a E:\autobak\zjdzncc_%delrar%*.log
set RAR_CMD="C:\Program Files\WinRAR\WinRAR.exe"
%RAR_CMD% a -df "E:\autobak\%rarfile%" "E:\autobak\%backupfile%"