以文本方式查看主题

-  康柏仕电脑学院  (http://www.combss.com/bbs/index.asp)
--  Server服务器配置教程  (http://www.combss.com/bbs/list.asp?boardid=68)
----  用BAT代码解决Server服务器服务问题  (http://www.combss.com/bbs/dispbbs.asp?boardid=68&id=8018)

--  作者:吴文杰
--  发布时间:2023/2/1 14:37:51
--  用BAT代码解决Server服务器服务问题
当SQLServer服务器服务出现问题时,可手动重启SQL相关服务,或用bat代码进行重启

在桌面新建一个txt文件,把以下代码复制到txt文件中,保存后,把txt文件的后缀改为bat,再打开该bat文件

@echo off
echo.
echo. 等待大约1分钟
echo.
echo. 关闭服务
net stop "SQLSERVERAGENT"
net stop "MSSQLSERVER"
net stop "MSSQLFDLauncher"
net stop "MSSQLServerOLAPService"
net stop "ReportServer"
net stop "SQLBrowser"
timeout 5
echo. 关闭进程
taskkill /IM SQLAGENT.exe -t -f
taskkill /IM sqlservr.exe -t -f
taskkill /IM fdlauncher.exe -t -f
taskkill /IM msmdsrv.exe -t -f
taskkill /IM ReportingServicesService.exe -t -f
taskkill /IM sqlbrowser.exe -t -f
timeout 5
echo. 开启服务
net start "MSSQLSERVER"
net start "SQLSERVERAGENT"
net start "MSSQLFDLauncher"
net start "MSSQLServerOLAPService"
net start "ReportServer"
net start "SQLBrowser"
timeout 3
@echo off
[此贴子已经被作者于2023/2/1 14:38:28编辑过]