Sql-Server

安裝 SQL Server 2014 Express 失敗並出現錯誤“找不到數據庫引擎啟動句柄”。

  • July 8, 2021

首先讓我說我不是 DBA,實際上我沒有很多數據庫管理經驗。我只是一個試圖在我的本地機器上執行 SQL Server 來建構一些簡單的.NET 應用程序來學習和練習的人。我遇到了這篇文章中提到的同樣的問題(安裝 SQL Server 2012 Express 失敗並出現錯誤“找不到數據庫引擎啟動句柄。”),但它與 SQL Server Express 2014 相關。我嘗試了以下操作不解決問題:

  • 已驗證 SSL 已關閉
  • 刪除了 Users 文件夾下的 MSSQL$SQLEXPRESS 文件夾
  • 更改為 SQL 配置管理器中的內置帳戶
  • 以管理員身份執行安裝文件
  • 在安裝過程中選擇了預設的 NT Service\MSSQL$SQLEXPRESS 帳戶(注意我被禁止選擇任何其他帳戶)
  • 根據所選答案下方的評論(來自 Frederic),我嘗試遵循此路徑(電腦屬性、高級參數、使用者配置文件參數、抑製網路服務\mssql 配置文件),但它不存在,如所列。我能找到的最接近的只有使用者帳戶(不是虛擬帳戶)
  • 在設置過程中嘗試使用混合身份驗證

答案中指向 MSDN 的連結指向列出一些配置數據的資源,但它沒有告訴我在哪裡更改服務帳戶權限。根據我目前所讀到的內容,我認為這是我需要做的。我查看了 SQL 配置管理工具,但那裡沒有任何東西可以讓我更改權限(我看到的)。我看到了解決方案的零碎部分,但我在任何地方都沒有找到任何說“使用此工具修改服務帳戶的權限”的內容。這是錯誤日誌:

2015-02-08 19:55:05.51 Server      Microsoft SQL Server 2014 - 12.0.2000.8 (Intel X86) 
Feb 20 2014 19:20:46 
Copyright (c) Microsoft Corporation
Express Edition on Windows NT 6.1 <X64> (Build 7601: ) (WOW64)

2015-02-08 19:55:05.51 Server      UTC adjustment: -5:00
2015-02-08 19:55:05.51 Server      (c) Microsoft Corporation.
2015-02-08 19:55:05.51 Server      All rights reserved.
2015-02-08 19:55:05.51 Server      Server process ID is 2944.
2015-02-08 19:55:05.51 Server      System Manufacturer: 'System manufacturer', System     Model: 'System Product Name'.
2015-02-08 19:55:05.51 Server      Authentication mode is MIXED.
2015-02-08 19:55:05.51 Server      Logging SQL Server messages in file 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Log\ERRORLOG'.
2015-02-08 19:55:05.51 Server      The service account is 'NT Service\MSSQL$SQLEXPRESS'. This is an informational message; no user action is required.
2015-02-08 19:55:05.51 Server      Registry startup parameters: 
-d C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\master.mdf
-e C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Log\ERRORLOG
-l C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\mastlog.ldf
2015-02-08 19:55:05.51 Server      Command Line Startup Parameters:
-s "SQLEXPRESS"
-m "SqlSetup"
-Q
-q "SQL_Latin1_General_CP1_CI_AS"
-T 4022
-T 4010
-T 3659
-T 3610
-T 8015
-d "C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Template Data\master.mdf"
-l "C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\Template Data\mastlog.ldf"
2015-02-08 19:55:05.84 Server      SQL Server detected 1 sockets with 4 cores per socket and 4 logical processors per socket, 4 total logical processors; using 4 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2015-02-08 19:55:05.84 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2015-02-08 19:55:05.84 Server      Detected 8191 MB of RAM. This is an informational message; no user action is required.
2015-02-08 19:55:05.84 Server      Using conventional memory in the memory manager.
2015-02-08 19:55:05.89 Server      Default collation: SQL_Latin1_General_CP1_CI_AS (us_english 1033)
2015-02-08 19:55:05.90 Server      Perfmon counters for resource governor pools and groups failed to initialize and are disabled.
2015-02-08 19:55:05.91 Server      Query Store settings initialized with enabled = 1, 
2015-02-08 19:55:05.91 Server      The maximum number of dedicated administrator connections for this instance is '1'
2015-02-08 19:55:05.91 Server      This instance of SQL Server last reported using a process ID of 5432 at 2/8/2015 7:55:02 PM (local) 2/9/2015 12:55:02 AM (UTC). This is an informational message only; no user action is required.
2015-02-08 19:55:05.91 Server      Node configuration: node 0: CPU mask: 0x0000000f:0 Active CPU mask: 0x0000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2015-02-08 19:55:05.92 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2015-02-08 19:55:05.94 Server      Database Mirroring Transport is disabled in the endpoint configuration.
2015-02-08 19:55:05.94 Server      Software Usage Metrics is disabled.
2015-02-08 19:55:05.94 spid7s      Warning ******************
2015-02-08 19:55:05.94 spid7s      SQL Server started in single-user mode. This an informational message only. No user action is required.
2015-02-08 19:55:05.94 spid7s      Starting up database 'master'.
2015-02-08 19:55:05.98 spid7s      1 transactions rolled forward in database 'master' (1:0). This is an informational message only. No user action is required.
2015-02-08 19:55:05.98 spid7s      0 transactions rolled back in database 'master' (1:0). This is an informational message only. No user action is required.
2015-02-08 19:55:06.01 Server      CLR version v4.0.30319 loaded.
2015-02-08 19:55:06.09 Server      Common language runtime (CLR) functionality initialized using CLR version v4.0.30319 from C:\Windows\Microsoft.NET\Framework\v4.0.30319\.
2015-02-08 19:55:06.09 spid7s      Service Master Key could not be decrypted using one of its encryptions. See sys.key_encryptions for details.
2015-02-08 19:55:06.12 spid7s      SQL Server Audit is starting the audits. This is an informational message. No user action is required.
2015-02-08 19:55:06.12 spid7s      SQL Server Audit has started the audits. This is an informational message. No user action is required.
2015-02-08 19:55:06.15 spid7s      SQL Trace ID 1 was started by login "sa".
2015-02-08 19:55:06.15 spid7s      Server name is 'MIKE-PC\SQLEXPRESS'. This is an informational message only. No user action is required.
2015-02-08 19:55:06.15 spid7s      Starting up database 'msdb'.
2015-02-08 19:55:06.16 spid11s     Starting up database 'mssqlsystemresource'.
2015-02-08 19:55:06.16 spid14s     Error: 17190, Severity: 16, State: 1.
2015-02-08 19:55:06.16 spid14s     Initializing the FallBack certificate failed with error code: 1, state: 20, error number: 0.
2015-02-08 19:55:06.16 spid14s     Unable to initialize SSL encryption because a valid certificate could not be found, and it is not possible to create a self-signed certificate.
2015-02-08 19:55:06.16 spid14s     Error: 17182, Severity: 16, State: 1.
2015-02-08 19:55:06.16 spid14s     TDSSNIClient initialization failed with error 0x80092004, status code 0x80. Reason: Unable to initialize SSL support. Cannot find object or property. 
2015-02-08 19:55:06.16 spid14s     Error: 17182, Severity: 16, State: 1.
2015-02-08 19:55:06.16 spid14s     TDSSNIClient initialization failed with error 0x80092004, status code 0x1. Reason: Initialization failed with an infrastructure error. Check for previous errors. Cannot find object or property. 
2015-02-08 19:55:06.16 spid14s     Error: 17826, Severity: 18, State: 3.
2015-02-08 19:55:06.16 spid14s     Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
2015-02-08 19:55:06.16 spid14s     Error: 17120, Severity: 16, State: 1.
2015-02-08 19:55:06.16 spid14s     SQL Server could not spawn FRunCommunicationsManager thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.

我非常沮喪,我認為應該很簡單的事情卻變得非常困難和耗時。任何建議將不勝感激 - 謝謝。

$$ UPDATE $$

我將預設模板數據庫複製到錯誤中指定的位置。這使我能夠啟動 db 服務。我打開了 SQL Server Management Studio,但無法使用 Windows 身份驗證登錄。由於我在設置過程中使用了混合身份驗證,因此我能夠使用我創建的 sa 帳戶。

不幸的是,這導致了另一條錯誤消息:“無法在伺服器級別顯示策略健康狀態,因為使用者沒有權限。此功能需要訪問 msdb 數據庫的權限才能正常工作。” 我不確定如何為安裝期間創建的 sa 帳戶設置權限。我可以在左側的導航樹中看到系統數據庫,但 msdb 旁邊是文本(Recovery Pending)。當我嘗試創建新數據庫時,出現以下錯誤:

嘗試添加新的數據庫錯誤消息

我嘗試對整個安裝進行修復,但收到與 SQL Server 服務相關的錯誤消息:“SQL Server 功能 ‘SQL_Engine_Core_Inst’ 未處於支持修復狀態,因為它從未成功配置。只有功能可以修復成功安裝。若要繼續,請刪除指定的 SQL Server 功能。這是完整的錯誤日誌

在此之前我已經嘗試過多次刪除並重新安裝它,所以我似乎處於一個惡性循環中。

找不到數據庫引擎啟動句柄錯誤意味著 SQL Server 安裝能夠安裝 SQL Server 服務,但是當安裝嘗試啟動 SQL Server 服務時它失敗。

我在這篇 Technet 文章中提到的一個簡單解決方案是

請轉到 SQL Server 配置管理器並找到 SQL Server 服務

右鍵點擊 SQL Server express 服務並選擇屬性並將啟動帳戶更改為本地系統並選擇應用然後確定。這將啟動具有本地系統帳戶權限的服務。

在此處輸入圖像描述

可能導致此錯誤的某些原因。

  1. 使用者在伺服器配置頁面視窗(安裝期間)選擇的帳戶無法使 SQL Server 數據庫引擎服務聯機。要麼缺少特權,要麼已損壞。在安裝數據庫引擎服務期間,SQL Server 嘗試將線上數據庫服務作為內部程序引入,但由於啟動帳戶損壞或沒有適當的權限,它無法這樣做,最終安裝失敗。
  2. 其他原因是當安裝由於某種原因第一次失敗並且使用者從添加刪除程序解除安裝失敗時,解除安裝使帳戶處於損壞狀態,因此任何進一步的安裝嘗試都會閃爍此錯誤消息。
  3. 原因也可能是 SQL Server 安裝成功安裝了 SQL Server 及其服務,但由於系統中的一些其他限製或其他與系統相關的錯誤,SQL Server 無法上線。

在您的情況下,原因是

2015-02-08 19:55:06.16 spid14s     Error: 17190, Severity: 16, State: 1.
2015-02-08 19:55:06.16 spid14s     Initializing the FallBack certificate failed with error code: 1, state: 20, error number: 0.
2015-02-08 19:55:06.16 spid14s     Unable to initialize SSL encryption because a valid certificate could not be found, and it is not possible to create a self-signed certificate.
2015-02-08 19:55:06.16 spid14s     Error: 17182, Severity: 16, State: 1.

要解決此問題,請使用本地系統啟動 SQL Server 服務帳戶,或者在本地電腦上創建一個具有管理員權限的新本地帳戶,然後嘗試使用該帳戶啟動 SQL Server 服務。這篇 Blogs.msdn文章說如果帳戶配置文件損壞,可能會出現此類錯誤

如您所知,不建議使用具有管理員權限的帳戶執行 SQL Server 服務。在這種情況下,您暫時可以使用本地系統執行該帳戶,但您可以使用配置 Windows 服務帳戶和權限來創建具有最低權限的帳戶。

編輯:

FCB::Open failed: 無法打開文件 E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf 文件編號為 1。作業系統錯誤:2(系統找不到指定的文件。 )。

2015-02-09 10:42:45.12 spid8s 錯誤:5120,嚴重性:16,狀態:101。

2015-02-09 10:42:45.12 spid8s 無法打開物理文件“E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf”。作業系統錯誤 2:“2(系統找不到指定的文件。)”。

2015-02-09 10:42:45.12 spid8s 錯誤:17207,嚴重性:16,狀態:1。

根據以下日誌,SQL Server 正在 E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\ 位置搜尋 msdb 文件

您可以手動將 msdb 數據文件和日誌文件移動到上述位置。我知道這不是您想要的位置,但首先讓 SQL Server 聯機,然後我們可以使用 alter database 命令並將位置更改為適合您的位置。對我來說這是一個錯誤並且正在發生,因為 SQL Server 無法以某種方式決定 msd 文件的位置,因此選擇隨機位置。

如果這不起作用,請還原

我謹慎樂觀地認為我已經解決了這個問題。我做的一些事情可能會有所幫助:

  • 我在 SQL 應用程序文件夾中的文件級別修改了一些權限。
  • 我執行腳本來移動一些指向錯誤位置的模板數據庫。
  • 我能夠在 SQL Server 中添加一些登錄帳戶。

不過,似乎修復它的最後一件事是重建系統數據庫(詳情請點擊此處)。我從來沒有真正創建過任何數據庫,所以沒有要恢復的備份。我剛從頭開始,它奏效了。

感謝@Shanky 的所有建議。

引用自:https://dba.stackexchange.com/questions/91446