Board logo

标题: [其他] 求助,批处理登录Oracle失败后如何执行后续命令 [打印本页]

作者: yuyuyuyu    时间: 2017-7-3 18:39     标题: 求助,批处理登录Oracle失败后如何执行后续命令

RT,以下是部分代码:
  1. :create1
  2. set /p ORA_SID=Please enter the ORACLE_SID:
  3. @echo.
  4. set /p pass=Please enter the password:
  5. @echo.
  6. sqlplus sys/%pass%@%ORA_SID% as sysdba @%p%/get_rebuild.sql>nul
  7. for /f "usebackq" %%b in (`sed -n "/.trc/p" C:\gettrc.txt`) do (set var=%%b)
  8. if exist "%var%" (
  9.     echo Get the control file rebuild scripts from the %ORA_SID% successfully ! &echo.  
  10. )else(
  11.     echo Get the control file rebuild scripts from the %ORA_SID% failed ! &echo.
  12.     echo Please re-enter the "ORACLE_SID" or verify  the database status is normal ! &echo.
  13.     goto create1
  14. )
  15. goto create2
复制代码
目的是登录Oracle数据库后获取某个文件。
问题:当实例或者密码输入错误后,脚本会卡在登录那个阶段,errorlevel也没有返回值,此时该怎样跳过这条命令继续执行?




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2