今天遇到一个问题:
由于未知原因,SQLServer服务无法启动,对应的用友系统无法使用。
结果排查后发现,发现是SQLServer服务丢失,其他安装文件和数据文件等正常。
尝试通过运行 C:\Program Files\ Microsoft SQL Server\MSSQL\Binn下的sqlservr.exe 可以将该服务启动,使用SQL Server Management Studio 可以将数据库打开,查看其中的数据,一切正常。但是用友系统仍然无法使用。也许用友是需要通过SQLServer服务才能使用对应的数据。
尝试重建一个一个SQLServer服务。
以下方法使用 http://www.chinahtml.com/0705/aspnet-117850713913317.html 提供的解决办法。
通过注册表添加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的健值也可以是字符串值:C:\Program Files\ Microsoft SQL Server\MSSQL\Binn\sqlservr.exe
其中C:\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"="c:\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安装情况来适当修改才能行。
如果没改就导入了,其实也可以打开regedit注册表编辑器,根据自己的实际情况重新编辑。然后再重启。就可以看到SQLserver服务已经建立好了。
然后用友系统也可以使用了。
以上方法亲测有效。