共用方式為


當您啟動 SQL Server Service 時發生錯誤 1069

您在啟動 SQL Server 服務時收到錯誤 1069,這會導致登入失敗。 本文提供錯誤 1069 相關事件的解決方法。

原始產品版本: SQL S
原始 KB 編號: 282254

徵狀

當您嘗試重新啟動 Microsoft SQL Server 或 SQL Server Agent 時,服務不會啟動,而且您會收到下列錯誤訊息,視您嘗試啟動服務的方式而定:

  • 使用服務小程式:

    Windows 無法在本機計算機上啟動 SQL Server 服務。
    錯誤 1069:由於登入失敗,服務未啟動。

  • 使用命令提示字元:

    發生系統錯誤 1069。
    由於登入失敗,服務未啟動。

您可能會在系統事件記錄檔中找到事件標識碼為 7041 或 7038 的訊息。

原因

發生此問題的原因是服務帳戶本身或目前為服務帳戶儲存的信息發生問題。

事件標識碼 7041 的解析

系統事件記錄檔中事件識別碼為 7041 的專案可能包含下列錯誤訊息:

登入失敗:此電腦上的使用者未獲請求的登入類型。

事件記錄檔中的完整訊息專案如下所示:

Log Name:      System
Source:        Service Control Manager
Date:          <Datetime>
Event ID:      7041
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <Server name>
Description:
The MSSQLSERVER service was unable to log on as NT Service\MSSQLSERVER with the currently configured password due to the following error:
Logon failure: the user has not been granted the requested logon type at this computer.

Service: MSSQLSERVER  
Domain and account: <AccountName>

This service account does not have the required user right "Log on as a service."

User Action

Assign "Log on as a service" to the service account on this computer. You can use Local Security Settings (Secpol.msc) to do this.
If this computer is a node in a cluster, check that this user right is assigned to the Cluster service account on all nodes in the cluster.

If you have already assigned this user right to the service account, and the user right appears to be removed,
check with your domain administrator to find out if a Group Policy object associated with this node might be removing the right.

若要修正此問題,請檢查指派給 SQL Server 服務帳戶的用戶權力。

  1. 啟動本機 安全 策略 (開始 -> Secpol.msc) 。

  2. 展開 [本機原則] ,然後選取 [ 用戶權力指派]

  3. 依照 Windows 許可權 許可權中的指示,確認已將必要的用戶權力指派給服務帳戶。 手動指派任何遺漏的許可權。

  4. 檢查是否已將任何 拒絕* 許可權指派給服務帳戶。 從 SQL 服務帳戶移除任何 Deny* 許可權,然後重新測試。

    例如,如果服務帳戶被指派拒絕以服務方式登入,以及以服務SeServiceLogonRightSeDenyServiceLogonRight方式登入,請撤銷SeDenyServiceLogonRight登入的許可權,然後重新啟動 SQL Server。

事件標識碼 7038 的解析

在事件識別碼 7038 相關的記錄專案中,您可能會發現下列錯誤訊息:

此用戶無法登入,因為此帳戶目前已停用

事件記錄檔中的完整訊息專案如下所示:

Log Name:      System
Source:        Service Control Manager
Date:          <Datetime>
Event ID:      7038
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <Server name>
Description:
The MSSQLSERVER service was unable to log on as .\sqlsrvlogin with the currently configured password due to the following error:
This user can't sign in because this account is currently disabled.

To ensure that the service is configured properly, use the Services snap-in in Microsoft Management Console (MMC).

若要修正此問題,請根據您的案例使用下列其中一種方法:

  • 如果 SQL Server 啟動帳戶是計算機上的本機用戶帳戶,請開啟 *計算機管理 (compmgmt.msc) ,並檢查本機使用者和群組中的服務帳戶是否已停用。 如果已停用,請啟用帳戶,然後重新啟動 SQL Server 服務。

  • 如果 SQL Server 啟動帳戶是 Windows 網域帳戶,請檢查帳戶是否在 Active Directory 使用者和電腦 中停。 如果已停用,請啟用帳戶,然後重新啟動 SQL Server 服務。

用戶的密碼必須先變更,才能登入

事件記錄檔中的完整訊息專案如下所示:

Log Name:      System
Source:        Service Control Manager
Date:          <Datetime>
Event ID:      7038
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <Server name>
Description:
The MSSQLSERVER service was unable to log on as .\sqlsrvlogin with the currently configured password due to the following error:
The user's password must be changed before signing in.

To ensure that the service is configured properly, use the Services snap-in in Microsoft Management Console (MMC).

若要修正此問題,請根據您的案例使用下列其中一種方法:

  • 如果 SQL Server 啟動帳戶是電腦上的本機使用者帳戶:

    1. 開啟 計算機管理 (compmgmt.msc) 。
    2. 選取 [本機使用者和群組] ,然後選取 [ 使用者 ] 以找出帳戶。
    3. 按兩下使用者帳戶以開啟其 [屬性]
    4. 清除 [用戶必須在下次登入時變更密碼] 屬性,SQL Server 啟動帳戶],然後按 [確定]
    5. 重新啟動 SQL Server 服務。
  • 如果 SQL Server 啟動帳戶是 Windows 網域帳戶:

    1. 在域控制器上開啟 Active Directory 使用者和電腦
    2. 選取正確網域下的 [使用者 ]。
    3. 按兩下作為 SQL Server服務帳戶的網域帳戶,以開啟其 [屬性]
    4. 移至 [ 帳戶] 索引標籤,檢查 使用者是否必須在下次登入時變更密碼 。 如果啟用此選項,請清除此選項或以互動方式登入 Windows 用戶端電腦,然後設定新的密碼。
    5. 如果您變更密碼,請使用 SQL Server 組態管理員 工具更新 SQL Server 服務的新密碼。

用戶名稱或密碼不正確

針對不正確的密碼問題,事件記錄檔中的完整訊息專案如下所示:

Log Name:      System
Source:        Service Control Manager
Date:          <Datetime>
Event ID:      7038
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <Server name>
Description:
The MSSQLSERVER service was unable to log on as .\sqlsrvlogin with the currently configured password due to the following error:
The user name or password is incorrect.

To ensure that the service is configured properly, use the Services snap-in in Microsoft Management Console (MMC).

若要修正此問題,請依照下列步驟執行:

案例 1:密碼不正確

錯誤訊息專案指出目前的登入名稱或密碼集不正確。 若要確認並解決問題,請遵循下列步驟:

  1. 使用 選項 runas 來測試服務帳戶認證:

    1. 開啟 Windows 命令提示字元。

    2. 執行下列命令:

      runas /user:<localmachine>\<SQLSerivceAccount> cmd
      
  2. 如果命令成功,請在 SQL Server 組態管理員、服務SQL Server服務此帳戶中小心輸入相同的認證。

  3. 如果命令失敗並報告相同的問題,您必須重設 Windows 登入的密碼。

  4. 如果 SQL Server 啟動帳戶是計算機上的本機用戶帳戶,請開啟計算機管理 (compmgmt.msc) ,然後重設本機用戶的密碼。

  5. 如果 SQL Server 啟動帳戶是 Windows 網域帳戶,請開啟 Active Directory 使用者和電腦,然後在 [使用者] 下更新帳戶的密碼。 更新認證之後,請返回 SQL Server 組態管理員服務、SQL Server,然後輸入相同的認證。

  6. 重新啟動 SQL Server 服務。

    若要在 SQL Server 主電腦上的 SQL Server 服務帳戶中輸入正確的密碼,請遵循 SCM 服務 - 變更所使用帳戶的密碼中的程式。

案例 2:gMSA IsManagedAccount 旗標設定不正確

如果您使用群組受控服務帳戶 (gMSA) 帳戶來執行 SQL Server 服務,且IsManagedAccount指定服務的旗標設定為 false,則只要快取的秘密無效,您可能會收到 Service Control Manager 事件標識碼 7038。

若要識別並解決問題,請遵循下列步驟:

  1. 確認您使用的帳戶是 gMSA 帳戶。 只有在確認 gMSA 之後才繼續。

    • 如果下列命令針對帳戶成功,您會使用 gMSG 帳戶。
    • 如果失敗, Cannot find an object with identity: 'account'則服務帳戶不是 gMSA 帳戶。
    Get-ADServiceAccount -Identity 'yourGmsaName' -Properties PasswordLastSet
    

    如需詳細資訊,請 參閱檢查 gMSA 帳戶

  2. 在命令 提示 字元中執行下列命令,並檢查的 IsManagedAccount狀態。 所需的結果 為 true。 如果為 false,請繼續進行。

    sc qmanagedaccount <YourSQLServiceName>
    

    具名實例 SQLPROD SQL Server 範例:

    sc qmanagedaccount MSSQL$SQLPROD
    
  3. 視需要將旗標設定為 true。

    sc managedaccount <YourSQLServiceName> TRUE
    

    具名實例 SQLPROD SQL Server 範例:

    sc managedaccount MSSQL$SQLPROD TRUE
    
  4. 再次嘗試啟動服務。

參考的帳戶目前已鎖定,可能無法登入

事件記錄檔中的完整訊息專案如下所示:

Log Name:      System
Source:        Service Control Manager
Date:          <Datetime>
Event ID:      7038
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <Server name>
Description:
The MSSQLSERVER service was unable to log on as .\sqlsrvlogin with the currently configured password due to the following error:
The referenced account is currently locked out and may not be logged on to.

To ensure that the service is configured properly, use the Services snap-in in Microsoft Management Console (MMC).

若要修正此問題,請根據您的案例使用下列其中一種方法:

  • 如果 SQL Server 啟動帳戶是電腦上的本機使用者帳戶:

    1. 開啟 [計算機管理 ] (compmgmt.msc) 並移至 [本機 使用者和群組]。 然後選取 [ 使用者]
    2. 清除 [本機使用者和群組] 下 SQL Server 啟動帳戶的 [帳戶已鎖定] 複選框,然後選取 [確定]
    3. 重新啟動 SQL Server 服務。
  • 如果 SQL Server 啟動帳戶是 Windows 網域帳戶:

    1. 在域控制器上開啟 Active Directory 使用者和電腦
    2. [使用者] 下,按兩下 SQL Server 啟動帳戶,然後移至 [帳戶] 索引卷標。
    3. 檢查帳戶是否標示為已鎖定。
    4. 如果帳戶已鎖定,請選取 [ 解除鎖定帳戶] 方塊,然後選取 [ 確定],設定強密碼。
    5. 然後在 SQL Server 組態管理員、Services 和 SQL Server 中使用相同的認證 SQL Server 服務帳戶組態
    6. 重新啟動 SQL Server 服務。

指定的網域不存在或無法連絡

事件記錄檔中的完整訊息專案如下所示:

Log Name:      System
Source:        Service Control Manager
Date:          <Datetime>
Event ID:      7038
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <Server name>
Description:
The MSSQLSERVER service was unable to log on as xxx with the currently configured password due to the following error:
The specified domain either does not exist or could not be contacted.

To ensure that the service is configured properly, use the Services snap-in in Microsoft Management Console (MMC).

若要修正此問題,請根據您的案例使用下列其中一種方法:

  • 將特定 Windows 伺服器的 SQL Server 啟動設定為延遲啟動,以確保 NetLogon 等其他 Windows 服務會先完成,SQL Server 啟動時不會發生問題。 這是 SQL 安裝程式從 2022 SQL Server 開始的預設組態。

  • 如果延遲的開始選項無法解決您案例的問題,替代選項是變更 SQL Server 服務的復原選項。 指定 [重新啟動服務] 作為失敗選項的動作。 您可以使用熟悉的服務控制管理員介面,從系統管理工具的服務小程式執行此選項。

    • 不建議針對 SQL 故障轉移叢集實例 (FCI) 或可用性群組 (AG) 使用此選項,因為在自動故障轉移案例期間設定此選項可能會導致延遲。
  • 如果上述選項都不可行,您可以在提升許可權的命令行控制台中使用下列命令,將 SQL Server 服務設定為相依於 NETLOGON 服務:

    sc config <YourSQLServiceName> depend=keyiso/netlogon
    

    具名實例 SQLPROD SQL Server 範例:

    sc config MSSQL$SQLPROD depend=keyiso/netlogon