Article ID: 909967 - View products that this article applies to.
Expand all | Collapse all

On This Page

Summary

This article describes how to manually uninstall a stand-alone instance of Microsoft SQL Server 2005. Complete the steps in this article only if you cannot uninstall SQL Server 2005 by using Add or Remove Programs. For more information about how to use Add or Remove Programs to uninstall SQL Server 2005, see How to: Uninstall an Existing Instance of SQL Server 2005 (Setup).

When you follow the steps in this article, you also prepare the system so that you can reinstall SQL Server 2008.

Note To maintain or to update an instance of SQL Server 2008, you must be a local administrator who has permission to log on as a service.

What to consider before you uninstall a stand-alone instance of SQL Server 2005

Collapse this imageExpand this image
assets folding start collapsed
  • We recommend that you use Add or Remove Programs to uninstall SQL Server 2005. However, if an installation fails or if Add or Remove Programs does not uninstall the instance of SQL Server 2005, follow the steps in this article to uninstall the instance manually.
  • On a computer that is running SQL Server 2008 together with earlier versions of SQL Server, Enterprise Manager and other programs that depend on SQL-DMO might be disabled. This issue may occur in the following situations:
    • Side-by-side installations of any combination of SQL Server 2008, SQL Server 2000, and Microsoft SQL Server 7.0 in which one or more of these instances is uninstalled
    • Side-by-side installations of SQL Server 2000 and SQL Server 2008 in which SQL Server 2000 is installed after SQL Server 2008
    This issue occurs when the registration for the SQL Server SQL-DMO COM library is removed.

    To re-enable Enterprise Manager and other programs that have SQL-DMO dependencies, register SQL-DMO. To do this, open a command prompt, type the following command, and then press ENTER:
    regsvr32.exe sqldmo.dll
  • Before you remove SQL Server components from a computer that has the minimum required amount of physical memory, make sure that the page file size is sufficient. The page file size must be equal to two times the physical memory. Insufficient virtual memory can cause an incomplete removal of SQL Server.
Collapse this imageExpand this image
assets folding end collapsed

Before you uninstall an instance of SQL Server 2008

Collapse this imageExpand this image
assets folding start collapsed
  • Back up your data.

    You might have databases that you want to save in their present state. You might also want to save changes that were made to the system databases. In either situation, make sure that you back up the data before you uninstall SQL Server. Or, save a copy of all the data and the log files in a folder other than the MSSQL folder. (The MSSQL folder is deleted during the uninstallation process.)

    The files that you must save include the following database files.
    Note These files are installed as part of SQL Server 2005.
    • Distmdl.*
    • Master.*
    • Mastlog.*
    • Model.*
    • Modellog.*
    • Msdbdata.*
    • Msdblog.*
    • Mssqlsystemresource.*
    • Northwind.* (This database is an optional installation.)
    • Pubs.*
    • Pubs_log.*
    • Tempdb.*
    • Templog.*
    • ReportServer[$InstanceName] (This file is the Reporting Services default database.)
    • ReportServer[$InstanceName]TempDB (This file is the Reporting Services default temporary database.)
  • Delete the local security groups.

    Before you uninstall SQL Server, delete the local security groups for SQL Server components. For more information, see Configure Windows Service Accounts and Permissions.
  • Save or rename Reporting Services folders.

    If you use the SQL Server installation together with Reporting Services, save or rename the following folders and subfolders:
    • Default path\Reporting Services
    • Default path\MSSQL\Reporting Services
    • Default path\SQL Server instance name\Reporting Services
    • Default path\90\Tools\Reporting Services
    Note The Default path placeholder represents for %ProgramFiles%\Microsoft SQL Server. If you used the Reporting Services Configuration tool to configure the installation, the names may differ from the names in this list. Also, the databases may be located on a remote computer that is running SQL Server.
  • Stop all SQL Server services.

    We recommend that you stop all SQL Server services before you uninstall SQL Server 2005 components. Active connections can prevent successful uninstallation.
  • Use an account that has the appropriate permissions.

    Log on to the server by using the SQL Server service account or by using an account that has equivalent permissions. For example, you can log on to the server by using an account that is a member of the local Administrators group.
Collapse this imageExpand this image
assets folding end collapsed

How to uninstall a stand-alone instance of SQL Server 2005 manually

Note SQL Server setup is a complicated process. SQL Server setup modifies lots of registry keys and DLL files. SQL Server setup also installs and updates permission entries and service registrations.

We test SQL Server setup procedures, both installation and uninstallation, in many configurations. However, we cannot test all configurations due to the number of third-party products and customer specific changes that can occur at the operating system level. Therefore, you may encounter rare circumstances that prevent successfully installing or uninstalling SQL Server by using the setup program.

Because of these complexities, the SQL Server Support team may recommend that you reinstall the operating system if the procedures outlined in this article do not help perform a clean uninstall of the SQL Server program. This helps provide a clean platform to reinstall SQL server on your system.

If you receive the following error message during the SQL Server 2005 Setup process, a SQL Server 2005 component was not uninstalled from the computer:
A component that you have specified in the ADD_LOCAL property is already installed. To upgrade the existing component, refer to the template.ini and set the UPGRADE property to the name of the component.

Step 1: Make sure that the Microsoft SQL Server Setup Support Files component is installed

Collapse this imageExpand this image
assets folding start collapsed
In Add or Remove Programs, make sure that Microsoft SQL Server Setup Support Files appears in the list of installed programs. If Microsoft SQL Server Setup Support Files appears in the list, skip this step.

If Microsoft SQL Server Setup Support Files does not appear in the list, install this component before you continue. To install this component, follow these steps:
  1. Locate the original SQL Server 2005 installation media.
  2. To install the support files, double-click the Servers\setup\sqlsupport.msi file.
Note In the "Step 5: Uninstall the Microsoft SQL Server Setup Support Files component" section, you will uninstall this component.
Collapse this imageExpand this image
assets folding end collapsed

Step 2: Run the command to uninstall the SQL Server components

Collapse this imageExpand this image
assets folding start collapsed
At a command prompt, run the following command:
"%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\ARPWrapper.exe /Remove"
Uninstall the SQL Server components one at a time until all the SQL Server components are uninstalled.

Note Add or Remove Programs also runs the ARPWrapper.exe program by using the /Remove option. However, the reference to the ARPWrapper.exe program may have been deleted.

Additionally, if you have uninstalled SQL Server Reporting Services, you must do the following:
  • Delete the Reporting Services virtual directories
    Use Microsoft Internet Information Services (IIS) Manager to delete the following virtual directories:
    • ReportServer[$InstanceName
    • Reports[$InstanceName
  • Delete the ReportServer application pool
    Use IIS Manager to delete the ReportServer application pool.
Errors that you may encounter during this step
Collapse this imageExpand this image
assets folding start collapsed
Error message 1: Registry Enumeration Failed

Collapse this imageExpand this image
assets folding start collapsed
If you receive the "Registry Enumeration Failed" error, follow these steps to uninstall the SQL Server redistributed files and the SQL Server support files:
  1. Start Registry Editor, and then locate the following registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  2. In the left pane, click each GUID. For each GUID that you click, look for a display name in the right pane that includes "Microsoft SQL Server 2005." For example, look for the following names:
    • Microsoft SQL Server 2005
    • Microsoft SQL Server 2005 Analysis Services
    • Microsoft SQL Server 2005 Reporting Services
    • Microsoft SQL Server 2005 Notification Services
    • Microsoft SQL Server 2005 Integration Services
    • Microsoft SQL Server 2005 Tools
    • Microsoft SQL Server 2005 Books Online
    When you see a display name that includes "Microsoft SQL Server 2005," note the GUID that you clicked in the left pane.
  3. For each GUID that you noted in step 2, run the following command at a command prompt:
    start /wait msiexec /x {GUID} /l*v c:\sql_uninstall.log
    Notes
    • In this command, replace GUID with the GUID that you noted in step 2.
    • If you receive the following error message, contact Microsoft Customer Support Services:
      The setup has encountered an unexpected error in datastore.
  4. Open the following file:
    C:\Sql_uninstall.log
    Approximately 15 lines from the bottom of the file, locate a line that resembles the following line:
    MSI (s) (EC:F8) [12:52:18:007]: Product: Microsoft SQL Server 2005 Tools -- Removal completed successfully.
    If the process did not complete successfully, note the component name and the GUID, and then save the Sql_uninstall.log file.
Collapse this imageExpand this image
assets folding end collapsed
Error message 2: The setup has encountered an unexpected error in datastore

Collapse this imageExpand this image
assets folding start collapsed
If you have an instance that has more than one server, the Setup program fails, and you receive the following error message:
The setup has encountered an unexpected error in datastore. The action is RestoreSetupParams.
For example, you may have an instance that has SQL Server 2005 Database Engine, SQL Server 2005 Analysis Services, and SQL Server 2005 Reporting Services.

This error is expected because of refcounting. A refcount is used to track how many programs use the same .dll file or the same .msi file. When a program is uninstalled, the program decrements the refcount for an .msi file by one. When the last program is uninstalled, the .msi file is deleted. In this case, the .msi file is the Microsoft SQL Server Setup Support Files component (SqlSupport.msi). If you receive this error message, use one of the following methods to resolve this error:
  • Reinstall the Microsoft SQL Server Setup Support Files component (SqlSupport.msi) before you uninstall each component in the instance.
  • Temporarily refcount the SqlSupport.msi file to itself. To do this, follow these steps:
    1. Obtain the GUID for the Microsoft SQL Server Setup Support Files component. To obtain the GUID, follow steps 1 and 2 from the "If you experience problems" section below.
    2. Use Registry Editor to create or to modify the following registry key with these values:
      Key Name:
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Bootstrap\MSIRefCount

      Value: Uninstall
      Type: REG_SZ
      Data: {11111111-1111-1111-1111-111111111111},{GUID}
      Note GUID is a placeholder for the GUID of the SQL Server support files. For example, the GUID of the English x86 SQL Server support files is as follows:
      Data: {11111111-1111-1111-1111-111111111111},{53F5C3EE-05ED-4830-994B-50B2F0D50FCE}
Collapse this imageExpand this image
assets folding end collapsed
Collapse this imageExpand this image
assets folding end collapsed
Collapse this imageExpand this image
assets folding end collapsed

Step 3: Uninstall the support components

Collapse this imageExpand this image
assets folding start collapsed
Use Add or Remove Programs to uninstall the support components in the following order:
  • MSXML 6.0 Parser
  • SQLXML4
  • Microsoft SQL Server VSS Writer
  • Microsoft SQL Server 2005 Backward Compatibility
  • Anything else that is related to SQL Server 2005, except for the Microsoft SQL Server Native Client component and the Microsoft SQL Server Setup Support Files component
If the process fails for any one of the support components, you may receive the following error message:
Setup failed due to missing prerequisites.

To resolve this issue, follow these steps:  
  1. Start Registry Editor, and then locate the following registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  2. In the left pane, click each GUID. For each GUID that you click, look for a display name in the right pane that matches the name of the redistributable file. When you see a display name that matches the name of the redistributable file, note the GUID that you clicked in the left pane.
  3. For each GUID that you noted in step 2, run the following command at a command prompt:
    start /wait msiexec /x {GUID} SKIPREDISTPREREQS=1 /l*v c:\sqlredist_uninstall.log
    Note In this command, replace GUID with the GUID that you noted in step 2.
  4. Open the following file:
    C:\Sqlredist_uninstall.log
    At the bottom of the file, locate a line that resembles the following:
    MSI (s) (EC:F8) [12:52:18:007]: Product: Microsoft SQL Server 2005 Backward compatibility -- Removal completed successfully.
    If the process did not complete successfully, note the component name and the GUID, and then save the Sqlredist_uninstall.log file.
Collapse this imageExpand this image
assets folding end collapsed

Step 4: Uninstall the Microsoft SQL Server Native Client component

Collapse this imageExpand this image
assets folding start collapsed
If all other steps were successful, uninstall the Microsoft SQL Server Native Client component by using Add or Remove Programs.

Note Do not uninstall the Microsoft SQL Server Native Client component if you have SQL Server 2000 components installed.
Collapse this imageExpand this image
assets folding end collapsed

Step 5: Uninstall the Microsoft SQL Server Setup Support Files component

Collapse this imageExpand this image
assets folding start collapsed
If all other steps were successful, uninstall the Microsoft SQL Server Setup Support Files component by using Add or Remove Programs.
Collapse this imageExpand this image
assets folding end collapsed

If these steps did not uninstall all the components

If the previous steps did not uninstall all the components, follow these steps:
  1. In the "How to uninstall a stand-alone instance of SQL Server 2005 manually" section, follow all steps in Step 1: Make sure that the Microsoft SQL Server Setup Support Files component is installed.
  2. In Add or Remove Programs, uninstall all SQL Server 2005 components in the following order:
    • SQL Server 2005
    • SQL Server 2005 Analysis Services
    • SQL Server 2005 Reporting Services
    • SQL Server 2005 Notification Services
    • SQL Server 2005 Integration Services
    • SQL Server 2005 Tools
    • SQL Server 2005 Books Online
    • MSXML 6.0 Parser
    • SQLXML4
    • SQL Server VSS Writer
    • SQL Server 2005 Backward Compatibility
    • Anything else that is related to SQL Server 2005
    • SQL Server Native Client
    • SQL Server setup support files
If these steps did not uninstall all the components and all files that are related to the instance of SQL Server 2005, contact Microsoft Support.

Additional Resources

For more information about how to manually uninstall a SQL Server 2005 failover cluster, see How to manually uninstall a SQL Server 2005 failover cluster.
For more information about how to uninstall an instance of SQL Server 2000 manually, see How to manually remove SQL Server 2000 default, named, or virtual instance.

Properties

Article ID: 909967 - Last Review: December 24, 2014 - Revision: 19.0
Applies to
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Standard X64 Edition
  • Microsoft SQL Server 2005 Standard Edition for Itanium-based Systems
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Enterprise X64 Edition
  • Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Express Edition
Keywords: 
kbsqlsetup kbinfo kbsql2005setup kbexpertiseinter kbexpertiseadvanced kbtshoot kbcip KB909967

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com