Blog Post

SQL Server Support Blog
2 MIN READ

Cannot find SQL instance when applying patch

Bob_Cai's avatar
Bob_Cai
Icon for Microsoft rankMicrosoft
Sep 26, 2020

One customer had a SQL2016 SP1 instance. We can login this instance without any issue. But when we tried to apply SQL2016 SP2 in this server. We cannot find SQL instance in below panel. Only ‘Shared Features’ are listed.

 

I decompiled SQL setup dlls. It seems that SQL setup should check below registry key to Enumerate SQL Server features.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Unistall

 

We found below key was missing in customer’s environment. We tried to remove below key in my testing environment. We can reproduce the same issue.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 13

However, after adding back above key. SQL instance is still not found in patching in customer’s environment. So we still need to check the keys in ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Unistall’.

 

We found 2 product codes are related with SQL Server 2016 database Engine service.

 

 

But according to the name of msi package,  {51574D2C-DE28-4441-BDC2-967F0FFC0918} is the real database engine service product code.

We can also run PowerShell scripts to verify.

 

 

We found below registry keys have {0C457EC3-E998-4041-B856-908D5A2C1708} in "ProductCode". But it’s incorrect.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\Setup]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\Setup\SQL_Engine_Core_Inst]

 

We finally resolved this issue by making below changes. Those 2 wrong product codes caused this issue.

 

  1. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\Setup]
    "ProductCode"="{0C457EC3-E998-4041-B856-908D5A2C1708}"  change to {51574D2C-DE28-4441-BDC2-967F0FFC0918}

 

  1. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\Setup\SQL_Engine_Core_Inst]
    "ProductCode"="{0C457EC3-E998-4041-B856-908D5A2C1708}" change to {51574D2C-DE28-4441-BDC2-967F0FFC0918}
Published Sep 26, 2020
Version 1.0