标题: [其他] 想做一个批处理 开启orcl服务 登录orcl 改密码解锁....有问题了 [打印本页]
作者: 185362154 时间: 2015-10-13 21:12 标题: 想做一个批处理 开启orcl服务 登录orcl 改密码解锁....有问题了
本帖最后由 185362154 于 2015-10-13 21:17 编辑
@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
sqlplus jame/jame@orcl
pause alter user SCOTT identified by scott account unlock;
)
机器每次都是还原
每次要启动服务 改密码 等等..很烦人
作者: DAIC 时间: 2015-10-13 21:49
- @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%"
- )
复制代码
作者: 185362154 时间: 2015-10-14 23:38
回复 2# DAIC myOra.sql 貌似路径不对 还是要创建一个sql文件吗
作者: DAIC 时间: 2015-10-15 11:28
回复 3# 185362154
myOra.sql 是脚本自动生成的,不需要手工创建。
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |