Обновление SQL Server завершается сбоем и возвращает ошибку 15173 или 15559
В этой статье показано, как устранить ошибку 15173 или 15559 при установке накопительного обновления (CU) или пакета обновления (SP) для Microsoft SQL Server. Ошибка возникает при выполнении скриптов обновления базы данных.
Симптомы
При применении cu или sp для SQL Server программа установки сообщает следующее сообщение об ошибке:
Ошибка при ожидании дескриптора восстановления компонента Database Engine. Проверьте журнал ошибок 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, выполните следующие действия:
Запустите SQL Server вместе с флагом трассировки (TF) 902. Дополнительные сведения см. в разделе "Действия по запуску SQL с флагом трассировки 902".
Подключитесь к 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. После запуска SQL Server без TF 902 скрипт обновления будет выполняться снова.
Если скрипт обновления завершится успешно, обновление sp или CU завершено. Чтобы проверить завершенную установку, можно проверить журнал ошибок SQL Server и папку начальной загрузки.
Если скрипт обновления снова завершается ошибкой, проверьте журнал ошибок SQL Server для получения дополнительных записей об ошибках, а затем устраните новые ошибки.