1.编辑backup.dat文件

    1. rem @echo offrem
    2. set backupfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.dmp
    3. rem
    4. set logfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.log
    5. rem
    6. set rarfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.rar
    7. set ftpip=10.168.1.200
    8. set username=dba
    9. set password=CEEpcb0752dba
    10. set ftpPath=./iSCSI_dba/backup/NC/
    11. set data=%date:~0,4%%date:~5,2%%date:~8,2%
    12. set /a deldata=data-3
    13. set /a delrar=data-1
    14. rem backup schemas
    15. set backupfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.dmp
    16. set logfile=zjdzncc_%date:~0,4%%date:~5,2%%date:~8,2%.log
    17. expdp zjdzncc_nc65/zjdzncc_nc65@orcl directory=dump_autobak dumpfile=%backupfile% logfile=%logfile%
    18. rem 上传ftt
    19. rem 注意ftp上传的文件名称全部为大写,删除文件必须大写文件名才能删除
    20. Echo open %ftpip% >ftp.up
    21. Echo %username%>>ftp.up
    22. Echo %password%>>ftp.up
    23. Echo Cd %ftpPath% >>ftp.up
    24. Echo binary>>ftp.up
    25. Echo put E:\autobak\%backupfile%>>ftp.up
    26. Echo prompt niublility>>ftp.up
    27. Echo mdelete ZJDZNCC_%deldata%.DMP >>ftp.up
    28. Echo bye>>ftp.up
    29. FTP -s:ftp.up
    30. del ftp.up /q
    31. : Pause
    32. rem 压缩并删除原有文件
    33. del /a E:\autobak\zjdzncc_%delrar%*.rar
    34. del /a E:\autobak\zjdzncc_%delrar%*.log
    35. set RAR_CMD="C:\Program Files\WinRAR\WinRAR.exe"
    36. %RAR_CMD% a -df "E:\autobak\%rarfile%" "E:\autobak\%backupfile%"