拿掉預設使用者權力之後,SQL Server 安裝失敗

本文可協助您解決在您加強安全性之後安裝或升級 Microsoft SQL Server 時所發生的問題。

適用於:SQL Server

徵狀

請考慮您在 Windows 中執行 Microsoft SQL Server 的案例。 若要加強安全性,請從本機系統管理員群組移除一些預設用戶權力。 若要在系統上設定 SQL Server,請將安裝帳戶新增至本機系統管理員群組。

在此案例中,如果您嘗試安裝或升級 SQL Server,安裝程式就會失敗,而且您可能會收到類似下列其中一則訊息的錯誤訊息:

  • 案例 1: 如果新的安裝失敗,您會收到下列錯誤訊息:

    Access is denied
    

    您也可能在 Detail.txt 檔案中收到類似下列的錯誤訊息:

    2009-01-02 13:00:17 SQLEngine: --SqlServerServiceSCM: Waiting for nt event 'Global\sqlserverRecComplete$NIIT' to be created  
    2009-01-02 13:00:20 SQLEngine: --SqlServerServiceSCM: Waiting for nt event 'Global\sqlserverRecComplete$NIIT' or sql process handle to be signaled  
    2009-01-02 13:00:20 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC.  
    2009-01-02 13:00:20 Slp: Access is denied  
    2009-01-02 13:00:20 Slp: Configuration action failed for feature SQL_Engine_Core_Inst during timing ConfigRC and scenario ConfigRC.  
    2009-01-02 13:00:20 Slp: System.ComponentModel.Win32Exception: Access is denied  
    2009-01-02 13:00:20 Slp:    at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)  
    2009-01-02 13:00:20 Slp:    at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited)  
    2009-01-02 13:00:20 Slp:    at System.Diagnostics.Process.OpenProcessHandle()  
    2009-01-02 13:00:20 Slp:    at System.Diagnostics.Process.get_Handle()  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerServiceBase.WaitSqlServerStart(Process processSql)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerServiceSCM.StartSqlServer(String[] parameters)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlServerStartup.StartSQLServerForInstall(String sqlCollation, String masterFullPath, Boolean isConfiguringTemplateDBs)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.ConfigSQLServerSystemDatabases(EffectiveProperties properties, Boolean isConfiguringTemplateDBs, Boolean useInstallInputs)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.DoCommonDBStartConfig(ConfigActionTiming timing)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineDBStartConfig.Install(ConfigActionTiming timing, Dictionary<string, string> actionData, PublicConfigurationBase spcb)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.PrivateConfigurationBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, Dictionary<string, string> actionData, PublicConfigurationBase spcbCurrent)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SqlFeatureConfigBase.Execute(ConfigActionScenario scenario, ConfigActionTiming timing, Dictionary<string, string> actionData, PublicConfigurationBase spcbCurrent)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction(String actionId)  
    2009-01-02 13:00:20 Slp:    at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute(String actionId, TextWriter errorStream)  
    2009-01-02 13:00:20 Slp: Exception: System.ComponentModel.Win32Exception.  
    2009-01-02 13:00:20 Slp: Source: System.  
    2009-01-02 13:00:20 Slp: Message: Access is denied.  
    
  • 案例 2:如果 Microsoft SQL Server 2012 或 Microsoft SQL Server 2008 R2 的新安裝失敗,您會收到下列其中一個錯誤訊息:

    Rule "Setup account privileges" failed.  
    
    The account that is running SQL Server Setup doesn't have one or all of the following rights: the right to back up files and directories, the right to manage auditing and the security log and the right to debug programs. To continue, use an account with both of these rights.
    
  • 案例 3:如果在指定備份目錄位置的網路共用 (UNC 路徑) 時,SQL Server 2012 或更新版本的安裝失敗,您會收到下列錯誤訊息:

    SQL Server setup account does not have the `SeSecurityPrivilege` on the specified file server in the path *\<UNC backup location>*. This privilege is required to set folder security in the SQL Server setup program. To grant this privilege, use the Local Security Policy console on this file server to add SQL Server setup account to **Manage auditing and security log** policy. This setting is available in the **User Rights Assignments** section under Local Policies in the Local Security Policy console.
    

    注意事項

    發生此問題的原因是 SQL Server 設定帳戶沒有SeSecurityPrivilege裝載網路共用之檔伺服器的許可權。

原因

如果您是以本機系統管理員身分執行安裝程式,則需要下列使用者權力,安裝程式才能順利執行:

本機 群組原則對象顯示名稱 用戶權力
備份文件和目錄 SeBackupPrivilege
偵錯程式 SeDebugPrivilege
管理稽核和安全性記錄 SeSecurityPrivilege

注意事項

如需安裝 SQL Server 所需權限的詳細資訊,請參閱下列文章中的一節:

如果資料目錄或其他目錄的記憶體選項 (用戶資料庫目錄、使用者資料庫記錄目錄、TempDB 目錄、TempDB 記錄目錄或備份目錄) 使用 SMB 檔案共享,安裝程式帳戶在 SMB 檔案伺服器上需要下列額外許可權,如使用 SMB 檔案共用記憶體安裝 SQL Server 中所述。

SMB 網路共享資料夾 FULL CONTROL SQL 安裝程式帳戶
SMB 網路共享資料夾 FULL CONTROL SQL Server 和 SQL Server Agent 服務帳戶
SMB 檔案伺服器 SeSecurityPrivilege SQL 安裝帳戶

解決方案

若要將許可權新增至安裝帳戶,請遵循下列步驟:

  1. 以系統管理員身分登入。
  2. 取 [開始>執行],輸入 Control admintools,然後選取 [ 確定]
  3. 按兩下 [ 本機安全策略]
  4. 在 [ 本機安全性設定 ] 對話框中,選取 [ 本機原則],開啟 [用戶權力指派],然後按兩下 [備份文件和目錄]
  5. 在 [ 備份文件和目錄屬性 ] 對話框中,選取 [ 新增使用者或群組]
  6. 在 [ 選取使用者或群組 ] 對話框中,輸入您要用於設定的使用者帳戶,然後選取 [ 確定 ] 兩次。

    注意事項

    若要新增偵錯 程式 的使用者帳戶和管理稽核 和安全性記錄 原則,請執行步驟 1 到 6 。

  7. [檔案] 功能表中,開啟 [ 本機安全性設定 ] 對話框,然後選取 [ 結束 ] 關閉。

常見問題 (常見問題)

SeSecurityPrivilege為什麼 UNC 共用上的備份目錄需要在檔案伺服器上?

需要此許可權,才能擷取預設備份目錄上的 存取控制 清單 (ACL) ,以確保 SQL Server 服務帳戶具有資料夾的完整許可權。 如果 SQL 服務帳戶缺少許可權,服務帳戶也會設定 ACL,以便執行目錄的備份。 安裝程式會針對預設備份目錄執行這些檢查,如此一來,如果在安裝後執行備份,您就不會因為遺漏) 的許可權而發生錯誤 (。

注意事項

SeSecurityPrivilege 需要 從目錄與子資料夾變更 get/set ACLs 。 即使在目錄上具有 FULL CONTROL 許可權的用戶沒有來自目錄的許可權 get/set OWNER 和稽核資訊,也是如此。

為什麼案例 3 中所述的錯誤只會在 Microsoft SQL Server 2012 和更新版本中發生?

從 2012 SQL Server 開始,Microsoft 支援 SMB 檔案共用上的數據和記錄檔。 在此改進過程中,安裝體驗會進一步增強,以加強安全性檢查,讓客戶不會因為安裝后許可權不足而遇到錯誤或問題。 在 SQL Server 2012 之前的版本中,如果 SQL 服務帳戶沒有執行備份的許可權,使用者仍然可以設定備份目錄的網路共享路徑。 不過,在這種情況下,這些使用者會在安裝後遇到錯誤。 當您在網路共享上啟動 SQL 2012 安裝檢查時,現在會防止這些案例。

其他相關資訊

  • 若要檢查目前與安裝帳戶相關聯的許可權清單,請使用 AccessChk.exe 工具。 若要下載此工具,請參閱 AccessChk v6.13

    使用方式accesschk.exe- a \<setup account> *

    例如:c:\tools\accesschk.exe -a testdc\setupaccount *

      Sample output:
             SeSecurityPrivilege
              SeBackupPrivilege
              SeRestorePrivilege
              SeSystemtimePrivilege
              SeShutdownPrivilege
              SeRemoteShutdownPrivilege
              SeTakeOwnershipPrivilege
              SeDebugPrivilege
              SeSystemEnvironmentPrivilege
              SeSystemProfilePrivilege
              SeProfileSingleProcessPrivilege
              SeIncreaseBasePriorityPrivilege
              SeLoadDriverPrivilege
              SeCreatePagefilePrivilege
              SeIncreaseQuotaPrivilege
              SeChangeNotifyPrivilege
              SeUndockPrivilege
              SeManageVolumePrivilege
              SeImpersonatePrivilege
              SeCreateGlobalPrivilege
              SeTimeZonePrivilege
              SeCreateSymbolicLinkPrivilege
              SeInteractiveLogonRight
              SeNetworkLogonRight
              SeBatchLogonRight
              SeRemoteInteractiveLogonRight
    
  • 如需詳細資訊, 請參閱設定 Windows 服務帳戶和許可權