SQL Server のアップグレードが失敗し、エラー 15173 または 15559 が返される
この記事は、Microsoft SQL Server 用の累積的な更新プログラム (CU) または Service Pack (SP) をインストールするときに発生するエラー 15173 または 15559 のトラブルシューティングに役立ちます。 このエラーは、データベース アップグレード スクリプトが実行されるときに発生します。
現象
SQL Server に CU または SP を適用すると、セットアップ プログラムによって次のエラーが報告されます。
データベース エンジンの復旧ハンドルの待機に失敗しました。 考えられる原因については、SQL Server エラー ログを確認してください
SQL Server エラー ログを確認すると、次のいずれかのエラー エントリが表示されます。
エラー メッセージ セット 1:
Error: 15173, Severity: 16, State: 1.
Server principal '##MS_PolicyEventProcessingLogin##' has granted one or more permission(s). Revoke the permission(s) before dropping the server principal.
Error: 912, Severity: 21, State: 2.
Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 15173, state 1, severity 16. 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.
EventID 3417
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.
エラー メッセージ セット 2:
Dropping existing Agent certificate ...
Error: 15559, Severity: 16, State: 1.
Cannot drop certificate '##MS_AgentSigningCertificate##' because there is a user mapped to it.
Error: 912, Severity: 21, State: 2.
Script level upgrade for database 'master' failed because upgrade step 'sqlagent100_msdb_upgrade.sql' encountered error 15559, state 1, severity 16. 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.</br>
SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.
原因
この問題は、アップグレード スクリプトがサーバー プリンシパル ( ##MS_PolicyEventProcessingLogin##
または ##MS_AgentSigningCertificate##
) を削除できないために実行が停止したために発生します。 このエラーは、ユーザーがサーバー プリンシパルにマップされているために発生します。
CU または SP のインストール中に実行されるデータベース アップグレード スクリプトの詳細については、「 更新プログラムの適用時のアップグレード スクリプトのエラーを解決するを参照してください。
解決方法
15173 または 15559 エラーを解決するには、次の手順に従います。
トレース フラグ (TF) 902 と共に SQL Server を起動します。 詳細については、「 トレース フラグ 902 で SQL を開始する手順を参照してください。
SQL Server に接続し、エラー メッセージに記載されているサーバー プリンシパルに応じて、次のいずれかのクエリを実行します。
SELECT a.name, b.permission_name FROM sys.server_principals a INNER JOIN sys.server_permissions b ON a.principal_id = b.grantee_principal_id INNER JOIN sys.server_principals c ON b.grantor_principal_id = c.principal_id WHERE c.name = '##MS_PolicyEventProcessingLogin##'
SELECT a.name, b.permission_name FROM sys.server_principals a INNER JOIN sys.server_permissions b ON a.principal_id = b.grantee_principal_id INNER JOIN sys.server_principals c ON b.grantor_principal_id = c.principal_id WHERE c.name = '##MS_AgentSigningCertificate##'
クエリ結果に表示されるログインごとに、次のようなステートメントを実行して、それらのアクセス許可を取り消します。
たとえば、いずれかのクエリが次の結果を返す場合です。
名前: アクセス許可名 NT SERVICE\MSSQL$TEST: CONTROL
この場合は、次のいずれかのステートメントを実行します。
REVOKE CONTROL ON LOGIN::[##MS_PolicyEventProcessingLogin##] TO [NT SERVICE\MSSQL$TEST] AS [##MS_PolicyEventProcessingLogin##]
REVOKE CONTROL ON LOGIN::[##MS_AgentSigningCertificate##] TO [NT SERVICE\MSSQL$TEST] AS [##MS_AgentSigningCertificate]
スタートアップ パラメーターから TF 902 を削除し、SQL Server を再起動します。 TF 902 なしで SQL Server が起動すると、アップグレード スクリプトが再度実行されます。
アップグレード スクリプトが正常に完了すると、SP または CU のアップグレードが完了します。 SQL Server エラー ログとブートストラップ フォルダーを確認して、完了したインストールを確認できます。
アップグレード スクリプトが再度失敗した場合は、SQL Server エラー ログで追加のエラー エントリを確認し、新しいエラーのトラブルシューティングを行います。