Cannot find SQL instance when applying patch
Published Sep 25 2020 05:12 PM 6,991 Views
Microsoft

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.

Bob_Cai_1-1601078963691.png

 

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

Bob_Cai_2-1601078963761.png

 

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.

Bob_Cai_3-1601078963789.png

 

Bob_Cai_4-1601078963806.png

 

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.

Bob_Cai_5-1601078963846.png

 

Bob_Cai_6-1601078963901.png

 

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}
1 Comment
Version history
Last update:
‎Sep 25 2020 05:12 PM
Updated by: