我的系統重裝以前的d:盤裝有sqlserver,後重裝裡系統後,原來裝在d:下的sql服務卻啟動不起來了,沒有找到sqlserver的安裝光碟,所以我嘗試能不能手動恢復sql服務。
我做了以下嘗試:
(1)。直接執行D:Program FilesMicrosoft SQL ServerMSSQLBinn下的sqlservr.exe,發現他有一個參數:/c
作為一個服務運行,運行後的確可以透過企業管理器找到sqlserver,但是不方便,因為要啟動sqlserver就必須多運行一個dos介面的窗口,我想把它當作一個後台服務運行。
(2)。透過登錄機碼新增sqlserver後台服務:
找到HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices,以下就是系統中的所有的服務了,新增一個項目: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 FilesMicrosoft SQL ServerMSSQLBinnsqlservr.exe
其中D:Program FilesMicrosoft SQL Server為你的sqlserver的目錄,
然後此項下新增子項:
Linkage
Performance
Security
Enum
重新啟動電腦在服務中就會加入MSSQLSERVER服務
然後,透過mmc新建一個管理單元,把這個服務加進去。
sqlserver 服務管理員也會偵測到並管理sqlserver
其中完整的reg如下,你可以複製下來存成.reg 檔案匯入到註冊表中
Windows Registry
EditorSQLSERVER]
"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_MACHINESYSTEMCurrentControlSetServicesMSSQLSERVERLinkage]
"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_MACHINESYSTEMCurrentControlSetServicesMSSQLSERVERPerformance]
"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_MACHINESYSTEMCurrentControlSetServicesMSSQLSERVERSecurity]
"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_MACHINESYSTEMCurrentControlSetServicesMSSQLSERVEREnum]
"0"="Root\LEGACY_MSSQLSERVER\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001
導入之前一定要依照自己的機器的SQLserver安裝狀況來適當修改才能行。差不多10分鐘就搞定了
http://shengshuai.cnblogs.com/archive/2006/05/27/410996.html