Friday, April 8, 2011

A New Record!

Most irritating "fix" thus far. For my 396th failure installing SQL Server, this is the "error message" (being generous):

SQL Server Setup has encountered thefollowing error:

MsiGetProductlnfo failed to retrieve ProductVersion for package with Product Code = {36F70DEE-

1EBF-4707-AFA2-E035EEAEBAA1}’. Error code: 1605


Googling turns up very little, including this on MSDN:

SOLUTION (Worked at my end)

*********************************

Get the Product Code = '{0826F9E4-787E-481D-83E0-BC6A57B056D5}' from the error message that you are getting.

Byte reverse the first part from 0826F9E4 to 4E9F6280. [emphasis added]

Search in the registry under HKEY_CLASSES_ROOT\Installer\UpgradeCodes and try to find a match.

Take a backup of the registry and delete the parent key.

Re-run the Upgrade and if it fails again for a different GUID, then repeat the steps stated above.

In my case, I had to repeat these steps thrice as there were 3 other locations where I needed to change the product code. Then the setup was successful.


With this choice addendum:

Note: This post should not be treated as the Microsoft’s Recommendation or Resolution to the problem, it is only a workaround which worked in our environment and so we would like to share it.

Is that not a truly hideous incantation? Omidog. Naturally, anyone can "byte reverse" on the thumbs of one hand, right? Oh how casually we toss out these wonders of technical-ness.

Googling THAT turned up very little. I wrote code for 20 minutes, failed to reproduce the result above (0826F9E4 to 4E9F6280) and gave up, intending to fail again some other day.

Thursday, April 7, 2011

Uninstall Hell

Once again, SQL Server Developer Edition (real SQL Server) isn't working. So I try to uninstall. I can't uninstall this or that, because other things are installed:

Microsoft SQL Server 2008 R2 Setup (English)
Warning 26003. Microsoft SQL Server 2008 R2 Setup
Following products are installed:
SQL Server 2008 R2 Common Files
SQL Server 2008 R2 Database Engine Shared

So... how do I delete those? They don't appear in the Windows Programs and Features list!!?? Is there some magic incantation?

Googling around, I come across this obvious (sarcasm) straightforward
(sarcasm) and fool-proof (sarcasm) way to solve the problem. From a MS support person (who was just trying to be helpful, he's not to blame):

If you have already used msizap.exe or msicuu2.exe (which calls msizap) there may be things still left around on your machine, including services, assemblies, registry keys and shortcuts.

MSIZap and MSICuu2 should only be used as a last resort after exhausting all other available options. For completeness, these are the steps that I would recommend to try *before* resorting to MSIZap or MSICuu2 (jump below the second horizontal line for cleanup steps after resorting to MSIZap or MSICuu2)


Steps to manually remove all of SQL Server 2005 from a machine (Last resort prior to reinstalling the OS)

  1. Go to ARP and look for "Microsoft SQL Server Setup Support Files". If it is there, continue. If it is not there, find your original media and install it by double clicking on Servers\setup\sqlsupport.msi

  1. Run "%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\ARPWrapper.exe" /Remove and keep uninstalling things until everything is gone. (This is the same tool that gets run from the Add/Remove Control panel, but users may have already deleted the reference to it) If you get an immediate error saying "Registry Enumeration Failed", then you don't have anything to uninstall here. Continue on to step 3 to uninstall redists and SQL Support Files.

    You will need to uninstall just one item at a time. If you have an instance with more than one server (SQL, AS or RS), setup will fail with the error “The setup has encountered an unexpected error in datastore. The action is RestoreSetupParams”. This is expected at this point due to some refcounting issues. You will just need to keep reinstalling SQL Support Files again for each server in the instance and after every successful uninstall in step 2.

    To work around the refcounting issue without having to keep reinstalling, we can temporarily refcount SqlSupport.msi to itself. Look at step 3 and search for “Microsoft SQL Support Files” after you have installed it. Make a note of the GUID. Then go back to regedit and create/modify the following key:

    KeyName: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Bootstrap\MSIRefCount
    Value: Uninstall
    Type: REG_SZ
    Data: {11111111-1111-1111-1111-111111111111},{GUID}

    where {GUID} is the GUID of SQLSupport Files
    e.g. for English x86 SQL Support Files:
    Data:
    {11111111-1111-1111-1111-111111111111},{53F5C3EE-05ED-4830-994B-50B2F0D50FCE}

  1. If you encounter problems with uninstalling in step 2, try the following:
    1. Open RegEdit and go to HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
    2. Click on each of the GUIDs in the left pane. Look at the display name in the right hand pane. Look for anything that matches "Microsoft SQL Server 2005 *". Make a note of the GUID from the left pane.
    3. For each of the GUIDs noted in 4b)

i. run the following command from a command line (replace {GUID} with the GUID)
start /wait msiexec /x {GUID} /l*v c:\sql_uninstall.log
e.g.
start /wait msiexec /x {90A40409-6000-11D3-8CFE-0150048383C9} /l*v c:\sql_uninstall.log

ii. Open the file c:\sql_uninstall.log and look at the bottom of the file (about 15 lines from the bottom). Look for a line similar to
MSI (s) (EC:F8) [12:52:18:007]: Product: Microsoft SQL Server 2005 Tools -- Removal completed successfully.

iii. If the removal was not successful, make a note of the name and the GUID for later and save off the sql_uninstall.log file.

  1. If you succeeded in uninstalling all of the items in step 2 or 3, you can now remove the redists. Try to uninstall from the Add/Remove Programs Control panel in the following order:
    1. “MSXML 6.0 Parser”, “SQLXML4”, “Microsoft SQL Server VSS Writer”, “Microsoft SQL Server 2005 Backwards Compatibility”, and anything else that claims it is Microsoft SQL Server 2005 *except* for "Microsoft SQL Server Native Client" and "Microsoft SQL Server Setup Support Files" If any of these fails because of missing pre-requisites, do the following:

i. Open RegEdit and go to HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall

ii. Click on each of the GUIDs in the left pane. Look at the display name in the right hand pane. Look for anything that matches the name of the redist. Make a note of the GUID from the left pane.

iii. run the following command from a command line (replace {GUID} with the GUID)
start /wait msiexec /x {GUID} SKIPREDISTPREREQS=1 /l*v c:\sqlredist_uninstall.log
e.g.
start /wait msiexec /x {90A40409-6000-11D3-8CFE-0150048383C9} SKIPREDISTPREREQS=1 /l*v c:\sqlredist_uninstall.log

· Open the file c:\sqlredist_uninstall.log and look at the bottom of the file. Look for a line similar to
MSI (s) (EC:F8) [12:52:18:007]: Product: Microsoft SQL Server 2005 Backward compatibility -- Removal completed successfully.

· If the removal was not successful, make a note of the name and the GUID for later and save off the sqlredist_uninstall.log file.

    1. (only if all other steps were successful) Microsoft SQL Server Native Client
    2. (only if all other steps were successful) Microsoft SQL Server Setup Support Files


If you have resorted to MSIZap or MSICuu2 (for whatever reason, I don't really recommend them, but sometimes they are necessary/useful), you may have some stuff left over.

  1. Service Deletion

You will need to delete a number of services using either the Services control panel or the sc.exe “delete” command:

(SQL Server Active Directory Helper)

MSSQLServerADHelper

(SQL Server Browser)

SQLBrowser

(SQL Server Integration Services)

MsDtsServer

(SQL Server)

MSSQL

MSSQL$Instance

(SQL Server Agent)

SqlAgent

SqlAgent$Instance

(SQL Server Analysis Services)

MSOLAP

MSOLAP$Instance

(SQL Server Reporting Services)

ReportServer

ReportServer$Instance

(SQL Server FullText Search)

Msftesql

Msftesql$Instance

  1. Delete SQL Server Assemblies

if exist "%windir%\assembly\GAC\*SQLServer*" del /s /q /f "%windir%\assembly\GAC\*SQLServer*"

if exist "%windir%\assembly\GAC_32\*SQLServer*" del /s /q /f "%windir%\assembly\GAC_32\*SQLServer*"

if exist "%windir%\assembly\GAC_MSIL\*SQLServer*" del /s /q /f "%windir%\assembly\GAC_MSIL\*SQLServer*"

  1. Delete files on disk

if exist "%ProgramFiles%\Microsoft SQL Server\90" rmdir /S /Q "%ProgramFiles%\Microsoft SQL Server\90"

if exist "%USERPROFILE%\Local Settings\Application Data\Microsoft\Microsoft SQL Server" rmdir /S /Q "%USERPROFILE%\Local Settings\Application Data\Microsoft\Microsoft SQL Server"

if exist "%USERPROFILE%\Application Data\Microsoft\Microsoft SQL Server" rmdir /S /Q "%USERPROFILE%\Application Data\Microsoft\Microsoft SQL Server"

if exist "%USERPROFILE%\..\All Users\Application Data\Microsoft\Microsoft SQL Server" rmdir /S /Q "%USERPROFILE%\..\All Users\Application Data\Microsoft\Microsoft SQL Server"

There are also files in the %ProgramFiles%\Microsoft SQL Server\MSSQL.* that should be removed.

  1. Registry Removal

reg delete "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\90" /f

reg delete "HKCU\SOFTWARE\Microsoft\Microsoft SQL Server\90" /f

There are other keys under HKLM\SOFTWARE\Microsoft\Microsoft SQL Server, but they may be 80 keys.

e.g.

Microsoft SQL Server\90

Microsoft SQL Server\BC

Microsoft SQL Server\BOL

Microsoft SQL Server\ExceptionMessageBox

Microsoft SQL Server\Instance Names

Microsoft SQL Server\MSSQL.

Microsoft SQL Server\

Microsoft SQL Server\Services

Microsoft SQL Server\SQLXML4

  1. Shortcut Removal

del /s /q “C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft SQL Server 2005”


Simple, right? Has anyone actually gone through that process, aside from Rainman maybe?

Entrepreneurs! There's an opportunity here!

Create a utility that will uninstall SQL Server
.

It's a challenge, I agree. Microsoft can't do it. You could charge huge bucks, like those people who will recover data from your crashed drive.

OK, not that huge -- but what would you pay to have SQL Server
actually working on your computer? Especially, given that you've installed a billion programs and customized a zillion features, and you're in that familiar zone where you can't install or uninstall.

You're stuck in SQL Server hell and you'll have to wipe your drive, in order to get SQL Server to install!!!

You'd fork up some real money to avoid that, right?

I sure hope I'm not in that state. If I never post again, assume the worst.


Saturday, March 26, 2011

Brilliantly unhelpful error messages

SQL Server is not working, as usual. It was working, praise Dog. Then it stopped, yet again.

I go to the SQL Server Configuration Manager and see that the SQL Server Agent is stopped, despite the fact that it's start mode automatic. I try to start the service, and after an annoying delay, I get the error message:
The request failed or the service did not respond in a timely fashion.
Consult the event log or other applicable error logs for details.
A nice error message would provide a link to said log. A mediocre message would have suggested where this log might exist. The crappy message provided tells me squat. So I turn to Google (which does a MUCH better job of searching Microsoft forums than the forums' built-in facility).

Happy Day! Eventually I find a log that has my SQL Server error logged! Calloo! Callay!

It turns out that the magic incantation is:

Control Panel ->
Administrative Tools ->
Event Viewer ->
Windows Logs ->
Application.
Later, I notice that Event Viewer -> Custom Views -> Adminstrative Events is probably more efficient; it appears to show just the errors and warnings.

Happy that my random clicking around the Event Viewer has led me to the promised land, I click the SQL Server error to get that vital bit of information that will finally allow me to get this POS working. Revealed:
SQLServerAgent could not be started (reason: Error creating a new session).
Which, of course, conveys nothing useful -- not useful to me, anyway. What a shock.

It's yet another victory for the Microsoft frustration-spewing machine called SQL Server.

A wonderful, hilarious book is Good Omens by Neal Gaiman and Terry Pratchett. The relevant passage has a Demon of Hell bragging about a spectacularly jammed highway system. "That was one of ours." The horrible traffic causes thousands of people to think uncharitable thoughts and even take The Lord's name in vain, every day.

I have to imagine a demon saying, with a very self-satisfied tone: "SQL Server. Oh yeah, that was one of ours."