SQL SERVER – Service Pack Failure: MissingRegistryKeyException

To fix something, it should be broken first. I keep playing with my lab and eventually end up breaking stuff. This time, while patching my own lab environment with latest service pack, I ran into below error about MissingRegistryKeyException.

The registry key System\CurrentControlSet\Services\MSSQLSERVER\Performance is missing.

I opened the error stack from detail.txt. It goes from bottom to top. If I arrange them in the right order, it looks like below.

  • SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute
  • SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction
  • SqlServer.Configuration.SqlEngine.SqlEngineSetupPrivate.Patch
  • SqlServer.Configuration.SqlEngine.SqlEngineSetupPrivate.PatchPerfmonCounters
  • SqlServer.Configuration.SqlEngine.PerfmonRegistration.NeedToPatch
  • SqlServer.Configuration.SqlEngine.PerfmonRegistration.GetDLLNameFromRegistry
  • SqlServer.Configuration.SqlEngine.Globals.GetSqlRegistryKeyHKLM

Here is the exception:

Microsoft.SqlServer.Configuration.SqlEngine.MissingRegistryKeyException: The registry key System\CurrentControlSet\Services\MSSQLSERVER\Performance is missing.

If we read the function names, it’s clear that the setup is trying to patch performance counters and error message also makes sense.


  • User regedit.exe (Start > Run > RegEdit) and go to System\CurrentControlSet\Services\MSSQLSERVER\Performance to verify if this registry key is missing. If it is missing, take a backup of the whole registry (just to be on the safer side) and manually create the registry key as shown below:
    SQL SERVER - Service Pack Failure: MissingRegistryKeyException sp3-err-perf-01
  • Follow below blog to recreate the performance counters. SQL SERVER – Performance Counter Missing: How to Get Them Back?

After that I installed patch again and it worked like a charm.

Let me know if you have faced any such issues in the future.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Registry, SQL Error Messages, SQL Server
Previous Post
SQL SERVER – Startup Error: 17190, Severity: 16 – Initializing the FallBack Certificate Failed with Error Code: 1, State: 20
Next Post
SQL SERVER – Installation Error – Updating Permission Setting for File Failed

Related Posts

1 Comment. Leave new

  • Thanks for sharing this. Simply adding the registry key worked like a charm for the March 2020 SQL 2012 SP4 Cumulative Update.


Leave a Reply