Thursday, June 9, 2011

SQL Server updates not applying

I recently had a client call up saying that every night, Microsoft Update would try to apply Service Pack 4 to their SQL Server 2005 instance, however it would fail.  Unfortunately, the Windows Event Log didn't provide any useful information. 
So, I started digging and found the SQL update log in: %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\
This indicated that a failure was occurring, similar to this error... "Couldn't find local patch 'C:\WINDOWS\Installer\9be677.msp'. Looking for it at its source."
So, after a quick search, I came across this page at blogs.msdn.com:  http://bit.ly/jNPidS.  
Basically, the cause is that at some stage, the various Installer and Service Pack files that get backed up to "C:\WINDOWS\Installer\" when a product and its related service pack is installed, have been deleted.  The client confirmed that at some stage they had performed a cleanup of the disk space and removed some of the larger files from this directory.  Unfortunately, this included the installer files for SQL 2005 itself, SP2, SP3 and other Cumulative Updates in between.  
To resolve, we simply have to copy the .msi files from the SQL install source, and re-download and extract the patch files from the Microsoft Download site.  The difficult part is that the .msi and .msp files don't have nice, easy to understand filenames.  EG:  9be677.msp doesn't mean much to anyone, however, it means something to the Registry.  The article explains to search the registry for "Microsoft SQL Server 2005".  That is a good start.  Using the Patch Code and GUID from the error log is also key to finding the exact app and patch that needs to be re-applied.  
You should use the registry key as mentioned in the article to find the product details and confirm what patch to download...
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\<GUID>\Patches\<PatchCode>
You should also confirm the details of the patch file name in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\<patchcode>
The rest is fairly straight forward, download the relevant patch, extract it and copy the relevant .msp file to "C:\Windows\Installer"
Once the files are all downloaded, the Service Pack can be installed.  
NOTE:  SQL Server has multiple components that are upgraded, EG: Database Engine, Tools, Analysis Services, etc.  Each of these have their own msi and msp packages.  So, you may have to go through and try the upgrade of each item one by one if multiple packages are missing from the "C:\Windows\Installer" location.
I also don't see why this couldn't also apply to other applications such as Windows, other SQL Server products and other Microsoft applications.  


Hope this helps someone!

No comments:

Post a Comment