使用批处理备份oracle数据库

@ECHO ON
SET BACKPATH=d:
SET FILENAME=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
SET USERNAME=WAS
SET PASSWORD=WASUSER
SET DBNAME=WAS

ECHO 准备备份数据库

IF NOT EXIST %BACKPATH% GOTO NOPATH
IF NOT EXIST %BACKPATH%/DMP GOTO NODMPPATH
IF NOT EXIST %BACKPATH%/LOG GOTO NOLOGPATH
GOTO STARTWORK
:NOPATH
ECHO NOPATH
PAUSE
MKDIR %BACKPATH%
MKDIR %BACKPATH%/DMP
MKDIR %BACKPATH%/LOG
GOTO STARTWORK

:NODMPPATH
ECHO NODMPPATH
PAUSE
MKDIR %BACKPATH%/DMP
IF NOT EXIST %BACKPATH%/LOG GOTO NOLOGPATH
GOTO STARTWORK

:NOLOGPATH
ECHO NOLOGPATH
PAUSE
MKDIR %BACKPATH%/LOG
GOTO STARTWORK

:STARTWORK
ECHO STARTWORK
PAUSE
IMP %USERNAME%/%PASSWORD%@%DBNAME% FILE=%BACKPATH%/DMP/%FILENAME%.DMP LOG=%BACKPATH%/LOG/%FILENAME%.LOG
EXIT

你可能感兴趣的:(使用批处理备份oracle数据库)