@echo off color f1 echo "停止数据库服务为1,启动数据库服务为2" set source=: set /p source= 请输入要进行操作的序号: if "%source%"=="1" goto net1 if "%source%"=="2" goto net2 :net1 rem @net stop OracleDBConsoleora10g rem @net stop OracleOraDb10g_home1iSQL*Plus @net stop OracleOraDb10g_home1TNSListener @net stop OracleServiceORA10G rem oracle 服务已经停止 goto end :net2 rem @net start OracleDBConsoleora10g rem @net start OracleOraDb10g_home1iSQL*Plus @net start OracleOraDb10g_home1TNSListener @net start OracleServiceORA10G rem oracle 服务已经启动 goto end :end color f2 pause & echo 操作完毕,并按任意键退出!
注:上文中的OracleDBConsoleora10g、OracleOraDb10g_home1iSQL、OracleOraDb10g_home1TNSListener、OracleServiceORA10G这几个服务名
需根据实际情况替换,这里的这些名称是本人自已Oracle的相关服务的名称。