SQL Server 2016安裝SP3補丁的時候報錯,由于升級步驟'msdb110_upgrade.sql'遇到錯誤200(狀態7,嚴重性25),因此數據庫'master'的腳本級別升級
廣告:
問題:今天在測試環境對SQL Server 2016安裝SP3補丁的時候報錯,然后再啟動數據庫服務的時候報下面的錯誤,重啟服務器錯誤仍舊存在。由于升級步驟 'msdb110_upgrade.sql' 遇到錯誤 200(狀態 7,嚴重性 25),因此數據庫 'master' 的腳本級別升級失敗。這是一種錯誤情況,可能會妨礙正常操作,且數據庫將脫機。如果在 'master' 數據庫升級過程中發生該錯誤,將阻止整個 SQL Server 實例啟動。請在以前的錯誤日志條目中檢查相關錯誤,采取相應的更正措施,然后重新啟動數據庫,以便完成腳本升級步驟。 無法恢復 master 數據庫。SQL Server 無法運行。請利用完整備份還原 master 數據庫,修復它,或者重新生成它。有關如何重新生成 master 數據庫的詳細信息,請參閱 SQL Server 聯機叢書。2022-08-19 20:50:45.50 spid9s Uploading data collector package from disk: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Install\SqlTraceCollect.dtsx2022-08-19 20:50:45.51 spid9s Uploading data collector package from disk: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Install\SqlTraceCollect.dtsx2022-08-19 20:50:45.51 spid9s Error: 2775, Severity: 17, State: 12.2022-08-19 20:50:45.51 spid9s The code page 65001 is not supported by the server.2022-08-19 20:50:45.51 spid9s Error: 912, Severity: 21, State: 2.2022-08-19 20:50:45.51 spid9s Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 200, state 7, 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.2022-08-19 20:50:45.51 spid9s Error: 3417, Severity: 21, State: 3.2022-08-19 20:50:45.51 spid9s 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.2022-08-19 20:50:45.51 spid9s SQL Server shutdown has been initiated2022-08-19 20:50:45.51 spid9s SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required
原因分析:按照報錯的信息,開始以為是在安裝補丁的時候報錯導致服務起不來。然后按照錯誤日志分析,可能是在安裝補丁,執行msdb110_upgrade.sql的腳本時出現了某些錯誤,導致無法啟動。通過/T902參數,跳過異常問題啟動數據庫,手動執行msdb110_upgrade.sql腳本時,再最后出現“消息 2775,級別 17,狀態 12,第 65143 行 服務器不支持代碼頁 65001”的錯誤。code page 65001對應的編碼為UTF-8,而數據庫排序規則為Chinese_PRC_CI_AS,對應的code page為936。也不知道誰在部署服務器的時候再“區域設置”勾選了支持UTF-8編碼,所以只需在 ControlPanel -> Region -> Administrative -> Change System Locale 下取消如下截圖的選項,重啟服務器后,問題解決
解決方案:1、啟動 SQL Server 服務啟跟蹤標志902
一般使用命令:
Net Start MSSQL$InstanceName /T902
如果是默認實例 Net Start MSSQLSERVER /T902
C:\Windows\system32>net start MSSQLSERVER /T902
The SQL Server (MSSQLSERVER) service is starting.The SQL Server (MSSQLSERVER) service was started successfully
2、通過SSMS登錄數據庫,找到msdb110_upgrade.sql所在的路徑(一般位于安裝目錄 \Program Files\Microsoft SQL Server\MSSQL13.MSSQL$InstanceName \MSSQL\Install下,例如這臺服務器位于C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Install目錄下),然后通過SSMS打開 msdb110_upgrade.sql,手動執行里面的腳本。執行的時候可能會報下面的錯誤: “消息 2775,級別 17,狀態 12,第 65143 行 服務器不支持代碼頁 65001。”
3、打開“控制面板”--“區域”--“管理”--“更改系統區域設置”,取消“Beta版”前面的勾,然后 重啟數據庫服務。
廣告: