SQL SERVER – Service Pack Failure: MissingRegistryKeyException. The Registry Key is Missing

One of my blog readers contacted me and informed that he is getting the same error as mentioned in below blog SQL SERVER – Service Pack Failure: MissingRegistryKeyException. Note that it had the same error message, but that did not help him here. In this blog, we would learn how to fix MissingRegistryKeyException while installing SQL Server service pack. Let us fix the error registry key is missing.

Below is the trimmed version of log (Detail.txt)

Microsoft.SqlServer.Configuration.SqlEngine.MissingRegistryKeyException: The registry key System\CurrentControlSet\Services\MSSQLSERVER\Performance is missing.
Microsoft.SqlServer.Configuration.SqlEngine.Globals.GetSqlRegistryKeyHKLM
Microsoft.SqlServer.Configuration.SqlEngine.PerfmonRegistration.GetDLLNameFromRegistry
Microsoft.SqlServer.Configuration.SqlEngine.PerfmonRegistration.NeedToPatch
Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineSetupPrivate.PatchPerfmonCounters
Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineSetupPrivate.Patch
Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction
Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute
Exception: Microsoft.SqlServer.Configuration.SqlEngine.MissingRegistryKeyException.
Source: Microsoft.SqlServer.Configuration.SqlServer_ConfigExtension.

Since he already tried following my earlier blog, I was wondering what to do next. A thought of running a REPAIR of SQL Server instance came to my mind. I quickly checked what all actions do a REPAIR take care.

One of the points mentioned in the above article was, And, this brought a smile on my face.

All missing or corrupt registry keys are replaced.

Here is the repair option from LandingPage in setup. Below image is taken from SQL Server 2017 setup media bit option remains same (SQL 2008 onwards)

SQL Server Repair Tool.

SOLUTION/WORKAROUND

I suggested him to go ahead and use SQL Server REPAIR using the RTM Media and asked to re-run the patch. He sent me an email that he again tried to run the service pack after repair and it was completed without any errors.

Have you used Repair option in SQL Server setup? When did you use, and did it help? Please let me know via comments.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

Registry, SQL Error Messages, SQL Log, SQL Server, SQL Server Installation, SQL Service Pack
Previous Post
PowerShell – Get Maximum Memory of Server with dbatools
Next Post
SQL SERVER – Installation Error – Unable to Open Windows Installer File – 2147286960

Related Posts

1 Comment. Leave new

  • I have recently faced an issue while applying latest CU for SQL 2016 sp2.
    The scenario I faced is, While applying patch on passive node, it got failed. Post that, when I performed failover of SQL services, SQL services failed to come up on passive node. When I fail back SQL services on active node, It is still failing, although patch is not applied on it. After I performed repair of SQL installation from installation media, SQL services came up without any issue.

    I was just wondering if there is any way, we can get details of actions performed (Which missing files and registry values it repaired) by Repair operation in logs some where?

    Thank you,
    Anshul

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.