2 Star 8 Fork 3

闲散居士/数据库备份

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
expback.bat 3.89 KB
一键复制 编辑 原始数据 按行查看 历史
xiaxy 提交于 2019-11-07 01:03 . 取消导出批处理方式版本
@echo off
set date=%date:~4%
if %date:~0,1%==2 (
rem echo win2000
goto OK
)
rem echo winXP
set date=%date:~4,-3%
: OK
set ORACLE_HOME1=%ORACLE_HOME%
set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
set path1=%PATH%
set TNS_ADMIN1=%TNS_ADMIN%
IF NOT "%2"=="NULL" SET ORACLE_HOME=%2
set path2=%ORACLE_HOME%
IF NOT exist %path2%\oci.dll (
GOTO NoOCI
rem IF exist %path2%\oci.dll
) else (
IF exist %path2%\exp.exe GOTO Okpath
IF exist %path2%\exp80.exe GOTO Okpath
)
:NoOCI
IF exist %path2%\bin\oci.dll (
set path2=%path2%\bin
GOTO Okpath
)
:Okpath
set PATH=%path2%\;%PATH1%
set expproc=exp.exe
rem IF exist %path2%\expdp.exe set expproc=expdp.exe
IF exist %path2%\%expproc% (
set expproc=%path2%\%expproc%
GOTO Okexp
)
IF exist %path2%\exp80.exe (
set expproc=%path2%\exp80.exe
GOTO Okexp
)
:Okexp
rem echo %ORACLE_HOME% %path2% %expproc%
rem pause
set TNS_ADMIN1=%TNS_ADMIN%
set TNS_ADMIN=%ORACLE_HOME%
IF NOT "%ORACLE_HOME%"=="%path2%" (
SET TNS_ADMIN=%ORACLE_HOME%\network\ADMIN
) else (
IF exist %ORACLE_HOME%\tnsnames.ora (
set TNS_ADMIN=%ORACLE_HOME%
) else (
IF exist %ORACLE_HOME%\network\ADMIN ( SET TNS_ADMIN=%ORACLE_HOME%\network\ADMIN )
)
)
rem echo %ORACLE_HOME% %path2% %expproc% %TNS_ADMIN%
rem pause
set username=erpsys
rem set expproc=d:\oracle\ora90\bin\exp
set server=erpsys@erp
set arcdir=e:\databak
set rardir=c:\progra~1\winrar\
set parfile=NULL
set istemp=
set zippass=
IF NOT "%1"=="" SET username=%1
rem IF NOT "%2"=="" SET expproc=%2
IF NOT "%3"=="" SET server=%3
IF NOT "%4"=="" SET arcdir=%4
rem IF NOT "%5"==""
SET rardir=%5
IF NOT "%6"=="NULL" SET date=%6
rem IF NOT "%7"=="NULL"
SET parfile=%7
SET istemp=%8
IF "%9"=="NULL" GOTO nozippass
IF "%9"=="" GOTO nozippass
SET zippass=-hp%9
:nozippass
REM IF not exist ..\par\default.par set parfile=default
set filename=%username%_%date%
if not "%parfile%"=="NULL" (
set filename=%username%_%date%_%parfile%
goto par
)
REM IF not exist ..\par\default.par set parfile=default
IF exist .\par\default.par set parfile=default
:par
if "%istemp%"=="temp" set parfile=temp
IF not exist %username% md %username%
cd %username%
IF not exist log md log
REM IF not exist par md par
IF not exist %arcdir%\%username% md %arcdir%\%username%
:start
rem echo %expproc% %username%/%server% parfile=..\par\%parfile%.par file=%filename%.dmp log=.\log\EXP_%filename%.log
rem pause
rem start /MIN /WAIT %expproc% %username%/%server% FULL=Y file=%username%_%dd%.dmp log=.\log\EXP_%username%_%dd%.log
if "%parfile%"=="" (
start /MIN /WAIT %expproc% %username%/%server% FULL=Y file=%filename%.dmp log=.\log\EXP_%filename%.log
goto zip
)
start /MIN /WAIT %expproc% %username%/%server% parfile=..\par\%parfile%.par file=%filename%.dmp log=.\log\EXP_%filename%.log
rem echo %expproc% %username%/%server% %expproc% %username%/%server%
rem pause
:zip
if not "%rardir%"=="NULL" (
IF exist %filename%.dmp start /MIN /WAIT %rardir%winrar a -idp -ao %zippass% %arcdir%\%username%\%filename%.rar %filename%.dmp
IF exist .\log\EXP_%filename%.log start /MIN /WAIT %rardir%winrar m -idp -ao %arcdir%\%username%\%username%_log.rar .\log\EXP_%filename%.log
)
cd ..
if %ERRORLEVEL%==0 (
if exist deloldfile.exe (
REM deloldfile %8 %date% %rardir% %filename% %arcdir% %username% %9
rem deloldfile %date% %parfile% %8
rem 2019-11-05 导出也由 deloldfile 执行 deloldfile %date% %7 %8
goto end
)
echo not deloldfile.exe
goto end
)
echo %ERRORLEVEL%
rem goto end
:end
set username=
set expproc=
set server=
set arcdir=
set rardir=
set parfile=
set date=
set filename=
set istemp=
set zippass=
set PATH=%PATH1%
set ORACLE_HOME=%ORACLE_HOME1%
set PATH1=
set path2=
set ORACLE_HOME1=
set TNS_ADMIN=%TNS_ADMIN1%
set TNS_ADMIN1=
rem 2019-11-05 增加 exit,以便调用后等待退出
@echo on
exit
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Delphi
1
https://gitee.com/xyxia/oraback.git
[email protected]:xyxia/oraback.git
xyxia
oraback
数据库备份
master

搜索帮助