SQL Server 升級失敗,執行更新資料庫腳本時發生錯誤 5133
本文可協助您針對 SQL Server 的累積更新 (CU) 或 Service Pack (SP) 報告執行資料庫升級腳本時發生錯誤 5133 的問題進行疑難解答並加以解決。
徵兆
當您套用 CU 或 SP 時,安裝程式可能會回報下列錯誤:
等候 Database Engine 復原控制代碼失敗。 請檢查 SQL Server 錯誤記錄檔以了解潛在原因。
當您檢閱 SQL Server 錯誤記錄檔時,您可能會注意到下列錯誤訊息:
Error: 5133, Severity: 16, State: 1
Directory lookup for the file "<path>\MSSQL10.<Instancename>\MSSQL\Data\temp_MS_AgentSigningCertificate_database.mdf" failed with the operating system error 3(The system cannot find the path specified.).
Error: 1802, Severity: 16, State: 1.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Error: 912, Severity: 21, State: 2.
Script level upgrade for database 'master' failed because upgrade step 'sqlagent100_msdb_upgrade.sql' encountered error 598, state 1, severity 25.
This is a serious error condition which might interfere with regular operation and the database will be taken offline.
If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting.
Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.
Error: 3417, Severity: 21, State: 3.
Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
原因
SQL Server 會在嘗試判斷檔案目錄時發生操作系統錯誤時回報錯誤 5133。 SQL Server 會在執行 CREATE DATABASE 或 ALTER DATABASE 語句時報告錯誤 598。
注意
從 資料庫引擎 事件和錯誤,您可以看到 Error 598: An error occurred while executing CREATE/ALTER DB. Please look at the previous error for more information
。
錯誤 598 之前的專案可以提供失敗原因的詳細資訊。 例如,在本文中,上述錯誤是 1802,因為升級腳本無法在預設數據路徑中建立暫存資料庫而發生。 安裝程式會針對在更新程式期間執行的各種作業使用暫存資料庫。 如需在 CU 或 SP 安裝期間執行之資料庫升級腳本的詳細資訊,請參閱 針對套用更新時的升級腳本失敗進行疑難解答。
解決方法
確認 Data Path 屬性已在 SQL Server 中設定有效且正確的值。
從 SQL Server 組態管理員:
開啟 [SQL Server 組態管理員],並選取 [SQL Server 服務] 。
以滑鼠右鍵按兩下 SQL Server 實體,然後選取 [ 屬性]。
選取 [進階] 索引標籤,並確認 [數據路徑] 的值正確無誤,而且沒有任何錯字或額外的字元。 (若要驗證值,您可以複製它,並嘗試使用 Windows 檔案總管加以存取。
從 Windows 註冊表編輯器:
在任務欄的 [ 搜尋 ] 方塊中,輸入 regedit 以開啟 註冊表編輯器。
流覽至預設數據路徑的登錄機碼。 然後,驗證路徑是否正確,而且沒有額外的空格或字元。 預設資料路徑的登入機碼為
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.<Instance Name>\Setup\SQLDataRoot
。如果登錄機碼具有正確的數據路徑,而且您繼續收到錯誤,請遵循下列步驟:
流覽至登錄機碼:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.<Instance Name>\MSSQLServer\Parameters
。檢閱並變更數據路徑的值,以符合 中的
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.<Instance Name>\Setup\SQLDataRoot
值。
重新啟動 SQL Server 執行個體。
SQL Server 實例啟動時,將會再次執行升級腳本。
- 如果 SP 或 CU 升級文本順利完成,您可以檢查 SQL Server 錯誤記錄檔和啟動程式資料夾以確認。
- 如果升級腳本再次失敗,請檢查 SQL Server 錯誤記錄檔中是否有其他錯誤,並針對新的錯誤進行疑難解答。