Exp数据库导出(备份)、导入-----可执行文件(bat,cmd,exe)。

1.导出(备份)数据库-----Export.cmd

@Echo OFF



REM 取当前系统时间,可能因操作系统不同而取值不一样  

set CURDATE=%date:~0,4%%date:~5,2%%date:~8,2%  

set CURTIME=%time:~0,2%  

REM 小时数如果小于10,则在前面补0  

if "%CURTIME%"==" 0" set CURTIME=00  

if "%CURTIME%"==" 1" set CURTIME=01  

if "%CURTIME%"==" 2" set CURTIME=02  

if "%CURTIME%"==" 3" set CURTIME=03  

if "%CURTIME%"==" 4" set CURTIME=04  

if "%CURTIME%"==" 5" set CURTIME=05  

if "%CURTIME%"==" 6" set CURTIME=06  

if "%CURTIME%"==" 7" set CURTIME=07  

if "%CURTIME%"==" 8" set CURTIME=08  

if "%CURTIME%"==" 9" set CURTIME=09  

set CURTIME=%CURTIME%%time:~3,2%%time:~6,2%  





set dbService=bmstest (服务名)

set sysPass=admin (数据库用户sys密码)

set expUser=bms_test (表用户名称)

set expPass=picnuser (表用户密码)

set dmpFile=bms (文件名。。。)





echo ***************************************

echo 导入GROUPMASTER

echo ***************************************

EXP %expUser%/%expPass%@%dbService% FILE=dmp\%dmpFile%_%CURDATE%_%CURTIME%.dmp LOG=log\%dmpFile%.log





Pause

2.导入文件

@Echo OFF



:dbService

set dbService=mlcpsi101

set /P dbService=dbService?    (%dbService%)



:fromUser

set fromUser=mlclbs

set /P fromUser=from user?    (%fromUser%)



:toUser

set toUser=MLCLBSUAT

set /P toUser=to user?    (%toUser%)



:toUserPass

set toUserPass=MLCLBSUAT

set /P toUserPass=To User Password?    (%toUserPass%)



:sysPass

set sysPass=ADMIN

set /P sysPass=sys Password?    (%sysPass%)



:dmpFile

set dmpFile=mlclbs

set /P dmpFile=dmp File?    (%dmpFile%)



echo ***************************************

echo 导入GROUPMASTER

echo ***************************************

IMP %toUser%/%toUserPass%@%dbService% FROMUSER=%fromUser% TOUSER=%toUser% FILE=dmp\%dmpFile%.dmp LOG=log\%dmpFile%.log



echo ***************************************

echo Oracle对象再编译

echo ***************************************

sqlplus /nolog @Compiler.sql %sysPass% %dbService%



Pause

Exp数据库导出(备份)、导入-----可执行文件(bat,cmd,exe)。

你可能感兴趣的:(数据库)