通过sqlserver服务管理器启动出现“指定的服务未安装”的解决方法
网络整理 - 07-27
我的系统重装以前的d:\盘装有sqlserver,后重装里系统后,原来装在d:\下的sql服务却启动不起来了,没有找到sqlserver的安装光盘,于是我就尝试能不能手动恢复sql服务。我做了以下尝试:
(1)。直接运行D:\Program Files\ Microsoft SQL Server\MSSQL\Binn下的sqlservr.exe,发现他有一个参数:/c
作为一个服务运行,运行后的确可以通过企业管理器找到sqlserver,但是不方便,因为要启动sqlserver就必须多运行一个dos界面的窗口,我想把它作为一个后台服务运行。
(2)。通过注册表添加sqlserver后台服务:
找到HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\,下面就是系统中的所有的服务了,添加一个项:MSSQLSERVER,添加以下的健值:
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):64,00,3a,00,5c,00,50,00,52,00,4f,00,47,00,52,00,41,00,7e,00,\
31,00,5c,00,4d,00,53,00,53,00,51,00,4c,00,5c,00,62,00,69,00,6e,00,6e,00,5c,\
00,73,00,71,00,6c,00,73,00,65,00,72,00,76,00,72,00,2e,00,65,00,78,00,65,00,\
00,00
"DisplayName"="MSSQLSERVER"
"ObjectName"="LocalSystem"
其中的ImagesPath的健值也可以是字符串值:D:\Program Files\ Microsoft SQL Server\MSSQL\Binn\sqlservr.exe
其中D:\Program Files\ Microsoft SQL Server为你的sqlserver的目录,
然后此项下添加子项:
Linkage
Performance
Security
Enum
重启电脑在服务中就会添加MSSQLSERVER服务
然后,通过mmc新建一个管理单元,把此服务添加进去。
sqlserver 服务管理器也会检测到并管理sqlserver
其中完整的reg如下,你可以复制下来存成 .reg 文件导入到注册表中
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):64,00,3a,00,5c,00,50,00,52,00,4f,00,47,00,52,00,41,00,7e,00,\
31,00,5c,00,4d,00,53,00,53,00,51,00,4c,00,5c,00,62,00,69,00,6e,00,6e,00,5c,\
00,73,00,71,00,6c,00,73,00,65,00,72,00,76,00,72,00,2e,00,65,00,78,00,65,00,\
00,00
"DisplayName"="MSSQLSERVER"
"ObjectName"="LocalSystem"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER\Linkage]
"Export"=hex(7):4d,00,53,00,53,00,51,00,4c,00,53,00,45,00,52,00,56,00,45,00,52,\
00,00,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER\Performance]
"Library"="d:\\PROGRA~1\\MSSQL\\BINN\\SQLCTR80.DLL"
"Collect"="CollectSQLPerformanceData"
"Open"="OpenSQLPerformanceData"
"Close"="CloseSQLPerformanceData"
"PerfIniFile"="sqlctr.ini"
"Last Counter"=dword:000010c2
"Last Help"=dword:000010c3
"First Counter"=dword:00000fae
"First Help"=dword:00000faf
"WbemAdapFileSignature"=hex:d6,a0,b9,c1,d1,85,78,63,4f,31,8b,f2,18,51,1a,5d
"WbemAdapFileTime"=hex:24,a2,b9,6d,3b,7d,c6,01
"WbemAdapFileSize"=dword:0000803b
"WbemAdapStatus"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER\Security]
"Security"=hex:01,00,14,80,b8,00,00,00,c4,00,00,00,14,00,00,00,30,00,00,00,02,\
00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
00,00,02,00,88,00,06,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\
05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,04,00,00,00,00,\
00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,06,00,00,00,00,00,14,00,00,01,\
00,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,00,18,00,fd,01,02,00,01,02,00,\
00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,00,00,00,00,00,05,12,00,00,00,\
01,01,00,00,00,00,00,05,12,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER\Enum]
"0"="Root\\LEGACY_MSSQLSERVER\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001
导入之前一定要根据自己的机器的SQLserver安装情况来适当修改才能行。差不多10分钟就搞定了