none
Uninstalling SQL 2005 Completely RRS feed

  • Question

  • hi all,

    i have gone through the thread which had the same subject but still it didn't work out..

    i have even removed SQL 2005 install bits using msicuu2.exe but still i can find SQL 2005 in my programs list in start menu....

    Can anyone please let me know how i can remove SQL 2005 completely when it does not show up in Add/Remove programs and WindowsInstaller Cleanup Tool but i can still find it if i navigate to Start --> All programs --> Microsoft SQL Server 2005......

    regards,

     

    Tuesday, April 18, 2006 11:05 AM

Answers

  • 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.<InstanceID>

    Microsoft SQL Server\<InstanceName>

    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”

    Wednesday, April 19, 2006 8:48 PM

All replies

  • 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.<InstanceID>

    Microsoft SQL Server\<InstanceName>

    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”

    Wednesday, April 19, 2006 8:48 PM
  • can you show me how through my email thanks
    Sunday, September 3, 2006 6:05 PM
  • All my attempts till step 2 gave me error message "registry enumeration failed". But when I tried step 3 I am getting some other error message:

    "The Setup has encountered an unexpected error in datastore. The action is RestoreSetupParams. The Error is : Source File Name : datastore\machineconfigscopeproperties.cpp Compiler Timestamp: Wed Oct 26 16:37:21 2005 Function Name: SqlInstallConfigScope.ProductCode Source Line Number: 186

    -----------------------------------------------------------------------------

    Exception (re)thrown "

    What could be done for this problem?

    • Proposed as answer by tinerco Friday, April 10, 2009 12:52 PM
    Thursday, November 30, 2006 5:51 AM
  • hi

    Im new in Msdn Forums and my first message in here so this isnt a important message.
    Friday, April 10, 2009 12:54 PM
  • I just completed all of the steps that you provided, minus the recounting work-around, and it allowed an install of Microsoft Outlook 2007 Business Contact Manager to progress to completion.

    I first had to use the Windows Install Clean Up utility, msicuu2.exe, using the article http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/493b5a95-1af6-4ec1-aa24-92875e4497c0 to remove MSXML 6.0 Parser, but then your directions worked and allowed SQL Express to install properly.

    Thank you
    Thursday, November 12, 2009 7:19 PM
  • I have the same challenge - SQL 2005 is still there after resorting to every means that I can find.

    When I run "%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\ARPWrapper.exe" /Remove, it shows the instance of SQL 2005 server and integration and analysis serverices instances.  After they are selected and next is clicked, the wizard seems to scan something for one or two seconds, then it exits showing no error message at all.

    I cannot find any MS SQL server GUID under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall.

    Any tip will be greatly appreciated.


    hz
    Tuesday, May 4, 2010 12:55 PM
  • Out of desperation, I completely rid of SQL Server 2005 on my machine that has bothered me for over a year by brute force as following:
    1. Stop all SQL server services (totally 3 or 4).
    2. Delete directory "C:\Program Files\Microsoft SQL Server".
    3. Delete every key referring to any subdirectory of "C:\Program Files\Microsoft SQL Server".  There are  literally hundreds. The registry is overused if not abused by SQL server.  I am not the only person with this opinion.

     

    When I was installing SQL Server 2008, I still encountered an error but I found the solution luckily.  

     

    If I had known that so many hours would be needed to clean SQL server 2005, I would have wiped out the HD and reinstalled Windows and other applications which are not many on this particular machine.


    hz
    Wednesday, May 5, 2010 2:05 PM
  • Thank you very much. i used MSICuu2 to uninstall then followed all your steps from deleting services,registry keys and folders. it worked great. i was able to re-install sql server on my machine again. 
    Friday, May 14, 2010 9:38 AM
  • thanks Jeffry- this was very helpful in my case. This cleaned up the remants left over from an old SQL cluster node. I appreciate it!

     

    Sincerly,

    Brian

    Wednesday, March 30, 2011 6:13 PM
  • If Add/Remove program cnn't show the program, i recommend you use a professional uninstaller. it can show all the installed program on its list.
    Thursday, June 16, 2011 8:21 AM
  • I was puzzaled by the problem about "Uninstalling SQL 2005 Completely", too. Did it be solved by your self?
    Thursday, January 5, 2012 8:35 AM
  • Hi,

    For that you have to uninstall manually. Even from the registry too.

    Cheers,

     


    - Sekilha
    Monday, January 9, 2012 5:05 AM
  •  it helps me thanks ..

    my search for uninstalling and reinstalling sql server 2005 end after your steps . 

    Wednesday, August 8, 2012 11:32 AM
  • This is very useful up until step 2

    2. Run "%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\ARPWrapper.exe" /Remove and keep uninstalling things until everything is gone

    What do you do if this just does not work? The application loads and you click next - it goes to a screen showing there are no SQL instances. You select Workstation Components and click Next.

    You get another screen that briefly pops up and then dissappears - then nothing.

    Then what?

    Sunday, March 9, 2014 10:14 AM