- @echo off
- for /f "skip=3 tokens=4" %%i in ('sc query OracleServiceORCL') do set "zt=%%i" &goto :next
- :next
- if /i "%zt%"=="RUNNING" (
- echo Stoping OracleService, please wait ...
- net stop OracleServiceORCL
- net stop OracleOraDb10g_home1TNSListener
- ) else (
- echo Starting OracleService, please wait ...
- net start OracleServiceORCL
- net start OracleOraDb10g_home1TNSListener
- set "oraName=jame"
- set "oraPass=jame"
- set "oraDB=orcl"
- set "oraSql=%temp%\myOra.sql"
- >"%oraSql%" echo conn %oraName%/%oraPass%@%oraDB%
- >>"%oraSql%" echo alter user SCOTT identified by scott account unlock;
- start sqlplus /nolog @"%oraSql%"
- )
复制代码
|