本人比较懒,所以有些工作将它写成教本自动完成
@echo off
rem ===============================
rem    自动上传oracle备份
rem
rem     $AUTHOR SONGRH
rem
rem
rem ===============================
rem ===设置远程服务器参数====
set FTPIP=210.82.176.84
set FTPUSR=srh
set FTPPASSWD=welcome
rem ==========================
rem ====设置参数文件和日值文件======
set LOGFILE=ftplog.txt
set CONFFILE=config.ini
rem ================================
rem ====设置远程服务器目录=======
set BAKDIR=temp
set DATEDIR=%date:~4%
rem =============================
rem ====需要上传的文件===========
rem set BAKFILE=abc.dmp
rem =============================
rem ====设置备份参数=======
set DMPDIR=D:\oraclebak
set DMPBAKDIR=%date:~4%
set DMPLOG=exp%date:~4%.log
set DMPFILE=zjadmain%date:~4%.dmp
set DMPUSER=abc
set DMPPASS=abc
set TNSNAME=clt
rem =======================
rem ====在当前目录建立参数文件======
echo open %FTPIP% > %CONFFILE%
echo user %FTPUSR% >> %CONFFILE%
echo %FTPPASSWD% >> %CONFFILE%
echo mkdir %BAKDIR% >> %CONFFILE%
echo cd %BAKDIR% >> %CONFFILE%
echo mkdir %DATEDIR% >> %CONFFILE%
echo cd %DATEDIR% >> %CONFFILE%
echo bi >> %CONFFILE%
echo mput %DMPDIR%\%DMPBAKDIR%\* >> %CONFFILE%
echo bye >> %CONFFILE%
rem ================================

echo   #================================#
echo   #   该脚本自动将自动备份         #
echo   #   oracle到指定目录,并         #
echo   #   将备份上传到FTP服务器        #
echo   #   可以将该脚本加入计划         #
echo   #   任务,加入时删除此说明       #
echo   #================================#

mkdir %DMPDIR%\%DMPBAKDIR%
exp %DMPUSER%/%DMPPASS%@%TNSNAME% file=%DMPDIR%\%DMPBAKDIR%\%DMPFILE% buffer=65534 log=%DMPDIR%\%DMPBAKDIR%\%DMPLOG%
rem ===========开始备份===============
ftp -d -i -n -s:%CONFFILE% > %LOGFILE%
rem ==================================