Export (0) Print
Expand All

How to: Manually Uninstall an Existing Instance of SQL Server 2005

SQL Server 2005

New: 17 July 2006

Follow these steps to uninstall an instance of Microsoft SQL Server 2005.

Aa337087.note(en-US,SQL.90).gifImportant:
To maintain or update an instance of SQL Server, you must be a local administrator with permission to log on as a service.

This article describes how to manually uninstall a stand-alone instance of Microsoft SQL Server 2005 By following the steps in this topic, you also prepare the system so that you can reinstall SQL Server.

For information about how to uninstall a SQL Server 2005 failover cluster, see How to: Manually Uninstall a SQL Server 2005 Failover Cluster or How to: Remove a SQL Server 2005 Failover Clustered Instance (Setup). For information about how to manually uninstall an instance of SQL Server 2000, see How to: manually remove SQL Server 2000 default, named, or virtual instance.

Consider the following important information before you use this procedure to uninstall SQL Server 2005:

  • We recommend that you use Add or Remove Programs in Control Panel 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, you can follow the steps in this topic to manually uninstall the instance.
  • This article contains information about how to modify the registry. Make sure that you back up the registry before you modify it, and know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, see Description of the Microsoft Windows registry in the Microsoft knowledge base.
  • On a computer that is running SQL Server 2005 along with previous SQL Server versions, Enterprise Manager and other programs that depend on SQL-DMO might be disabled. This can occur in the following situations:
    • Side-by-side installations of any combination of SQL Server 2005, SQL Server 2000, and SQL Server 7.0, where any one or more of these instances is uninstalled.
    • Side-by-side installations of SQL Server 2000 with SQL Server 2005, where SQL Server 2000 is installed after SQL Server 2005.
    This issue is due to removal of the registration for the SQL Server 2005 SQL-DMO COM library. To re-enable Enterprise Manager and other programs that have SQL-DMO dependencies, register SQL-DMO by running regsvr32.exe sqldmo.dll at the command prompt. For more information, see Troubleshooting an Installation of the SQL Server Database Engine.
  • Before you remove SQL Server 2005 components from a computer that has the minimum required amount of physical memory, you must make sure that the page file size is equal to two times the amount of physical memory. Sometimes, insufficient virtual memory can cause an incomplete removal of SQL Server 2005.
  • If you receive the following error message during SQL Server 2005 Setup, 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.

Before you remove SQL Server 2005, follow these steps:

  • 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. If either situation is true, make sure that back up the data before you uninstall SQL Server 2005. Alternatively, save a copy of all the data and log files in a folder other than the MSSQL folder. The MSSQL folder is deleted during uninstallation.
    The files that you must save include the following database files. 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 is the Reporting Services default database.)
    • ReportServer[$InstanceName]TempDB (This is the Reporting Services default temporary database.)
  • Delete the local security groups. Before you uninstall SQL Server 2005, delete the local security groups for SQL Server 2005 components.
  • Save or rename SQL Server Reporting Services folders. If you use the SQL Server installation together with Reporting Services, save or rename the following folders and subfolders:
    • <drive>\Microsoft SQL Server\Reporting Services
    • <drive>\Microsoft SQL Server\MSSQL\Reporting Services
    • <drive>\Microsoft SQL Server\<SQL Server instance name>\Reporting Services
    • <drive>\Microsoft SQL Server\90\Tools\Reporting Services
Aa337087.note(en-US,SQL.90).gifNote:
If you used the SSRS configuration tool to configure the installation, the names might differ from the names in this list. Additionally, the databases might be located on a remote computer that is running SQL Server.

  • 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.
  • 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.
Aa337087.Caution(en-US,SQL.90).gifCaution:
Incorrectly editing the registry can severely damage your system. Before making changes to the registry, we recommend that you back up any valued data on the computer.

Aa337087.note(en-US,SQL.90).gifNote:
You must perform the uninstallation steps listed here in the exact order given.

  1. Make sure that the SQL Server Setup Support Files component is installed.

    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, go to step 2.

    If Microsoft SQL Server Setup Support Files does not appear in the list, install this component before you continue. To do this, from the SQL Server 2005 installation media, double-click the Servers\setup\sqlsupport.msi file. In step 5 of this procedure, you will uninstall the Microsoft SQL Server Setup Support Files component.

  2. At the command prompt, run the following command to uninstall the SQL Server components:

    %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.

    Aa337087.note(en-US,SQL.90).gifNote:
    Add or Remove Programs also runs the ARPWrapper.exe program by using the /Remove option. However, the reference to the ARPWrapper.exe program might have been deleted.

    If you receive any of the following error messages, see the "If you experience problems" section that follows.

    Registry Enumeration Failed

    If you have an instance of SQL Server that has more than one server component, such as the Database Engine and Analysis Services installed, setup will fail, and you receive the following error message:

    The setup has encountered an unexpected error in datastore. The action is RestoreSetupParams.

    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 SQL Server Setup Support Files component (SqlSupport.msi). If you receive this error message, use one of the following methods to resolve the error:

    • Reinstall the 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.
    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}

    If you experience problems

    If you experience problems when you try to uninstall the SQL Server components, follow these steps:

    • Start Registry Editor, and then locate the following registry key:
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
    • 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.
    • For each GUID that you noted in the previous step, run the following command at the 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 the previous step.
    • If you receive the following error message, contact product support.
      The setup has encountered an unexpected error in datastore. Please contact a Customer Support representative.

    For a complete list of product support telephone numbers and for information about support costs, see the support contact information Microsoft Web site.

    • Open the file at C:\Sql_uninstall.log. Approximately 15 lines from 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 Tools -- Removal completed successfully.

    If the uninstallation failed, note the component name and the GUID, and then save the Sql_uninstall.log file.

  3. Use Add or Remove Programs to uninstall the support components in the following order:

    • MSXML 6.0 Parser
    • SQLXML4
    • SQL Server VSS Writer
    • SQL Server 2005 Backward Compatibility
    • Anything else that is related to SQL Server 2005, except for the SQL Server Native Client component and for the SQL Server Setup Support Files component.

    If the uninstallation fails for any one of the support components, you might receive the following error message:

    Setup failed due to missing prerequisites

    If you receive this error message, follow these steps:

    • Start Registry Editor, and then locate the following registry key:
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
    • 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.
    • For each GUID that you noted in the previous step, run the following command at a command prompt:
      start /wait msiexec /x {GUID} SKIPREDISTPREREQS=1 /l*v c:\sqlredist_uninstall.log
      
      In this command, replace GUID with the GUID that you noted in the previous step.
    • Open the file at C:\Sqlredist_uninstall.log. At 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 Backward compatibility -- Removal completed successfully.
      If the uninstallation failed, note the component name and the GUID, and then save the Sqlredist_uninstall.log file.
  4. If all the other steps were successful, uninstall the SQL Server Native Client component by using Add or Remove Programs.

    Do not uninstall the SQL Server Native Client component if you have SQL Server components installed.

  5. If all the other steps were successful, uninstall the SQL Server Setup Support Files component by using Add or Remove Programs.

    If these steps did not uninstall all the components and all the files that are related to the instance of SQL Server, contact product support. For a complete list of product support telephone numbers, see the Microsoft Help and Support Web site.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft