IBM Support

Uninstalling and removing DB2 for Windows

Technote (FAQ)


How to uninstall and remove DB2 from Windows


There are five methods of removing DB2 for Windows outlined below in order of preference.

  1. Control Panel -> Add/Remove Programs or Control Panel-> Programs and Features
  2. Running db2unins from DB2 installation media
  3. Running SETUP from the original source
  4. Using the FORCE_UNINSTALL option
  5. Manually remove and clean-up DB2 from Windows

The primary option (Control Panel -> Add/Remove Programs) of uninstalling DB2 should be the ONLY option attempted. The subsequent methods should only be attempted after the DB2 Service team has been contacted and determined that the uninstallation through the primary method cannot be remedied.


1) Control Panel - Add/Remove Programs or Control Panel->Programs and Features (Windows Vista/7/2008/2012)

Uninstalling through the Add/Remove Programs facility of the Windows Control Panel is the preferred method. Depending on the specific Windows platform, the DB2 product in Add/Remove Programs may have a "Remove" and/or "Change" button. Either of these options can be used for removal purposes.

At the first screen of the DB2 uninstallation process, the Next button is grayed out while Windows Installer performs various functions in the background to ensure that DB2 is prepared to be uninstalled. Once the Windows Installer is ready to proceed, the Next button will be enabled and the user can proceed. In the event that the uninstallation fails, the user should contact the service team to receive instructions for taking an uninstallation log and trace to determine the cause of the problem.

2) Running db2unins from installation media

Download the DB2 SERVER fixpack (see Download DB2 Fix Packs by version in Related URL) which contains this executable and batch file db2unins. Always download the newest fix pack available for the release to be uninstalled to ensure the newest version of db2unins is used. After downloading, uncompress the installation media then execute db2unins.

To Uninstall ALL DB2 Products: db2unins -f
Note: This must be run from installation media!

If there are multiple installations of DB2:

Display DB2 products installed: db2unins -d

Selectively uninstall only DB2 Server install: db2unins -p "SERVER"


The following Uninstall options should ONLY be attempted if the Primary Option fails.

3) Running SETUP from the original source

Unfortunately, DB2 can’t always be removed by using the Control Panel’s Add/Remove Programs facility. In this situation, the first action that should be attempted is to run 'setup' from the original install source location (either CD or network drive).

Remember to make sure that it is the same DB2 product (ie. ESE, ADMCL, WSE, etc.) and level (ie. GA, FP2, V9.7, etc.) as the DB2 product installed. Windows Installer should recognize that it is already installed, and present you with three options - Repair, Modify and Remove. Simply click the radio button REMOVE and continue, to remove product.

Another possible problem is if Windows Installer asks for the original .msi file. In this case, the original install source should be pointed to, and the .msi file should be selected from [source]\db2\Windows\[DB2 product].msi.


The inability to remove DB2 can also be the result of a number of factors, such as user tampering with the system registry, DB2 files, or directory structure. In this situation, the FORCE_UNINSTALL uninstallation method should be attempted to remove DB2 if the methods above are unsuccessful.

This uninstallation option combines the use of the msiexec Windows Installer function with manual cleanup procedures. To carry out the uninstall using this method:

1) Stop all DB2 Services.
2) From a Windows Command Window navigate to the windows Installer directory such as c:\Windows\Installer or c:\WinNT\Installer and execute the following:

msiexec /x {product code} FORCE_UNINSTALL=Y

{product code} can be located from the Windows registry under one of the following locations depending if you have a single or multiple product installation:

HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\InstalledCopies\<Copy Name>\<Product>\CurrentVersion

HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\DB2 Enterprise Server Edition\CurrentVersion
HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\InstalledCopies\DB2COPY1\DB2 Workgroup Server Edition\CurrentVersion

Using DB2 ESE v9.7 as an example the command syntax would be as follows:

msiexec /x {814D6DAC-E778-40EC-961E-312B354D12BC} FORCE_UNINSTALL=Y

If this command does not complete then proceed to the Manual Uninstallation section below. Otherwise, continue on with the following steps:

3) Perform Windows Environment cleanup (refer to DB2 Environment Variables Clean-up section below).
4) Perform Windows Registry Cleanup (refer to DB2 Windows Registry Clean-up section below).
5) Remove any DB2 Service entries from the Windows System Services file ([Windows]\system32\drivers\etc).
6) Remove the SQLLIB directory.
7) Remove DB2 shortcuts

Look for the “IBM DB2” shortcut folder, in the 'All Users' profiles in the ‘Start Menu/Programs’ folder, and delete it.
Then delete any DB2 links in the ‘Startup’ folder (such as “First Steps”).

5) Manual Removal and Clean-up of DB2 from Windows

The following procedure can be used if there is a severe problem with DB2 uninstallation caused by a Windows Installer error and the FORCE_UNINSTALL option does not help.

NOTE: For new releases of DB2 such as v9.7, v10.1, v10.5, etc... the installer creates at least several hundred unique registry entries for each machine it is installed on. Thus this method will not clean up all of the Windows registry entries containing SQLLIB or DB2.

Steps to manually remove a DB2 product are as follows:

1) Stop all DB2 Services.
2) Remove the SQLLIB directory.
3) Remove all shortcuts and folders.
4) Remove all updates to Windows environment variables (refer to DB2 Environment Variables Clean-up section below).
5) Remove DB2 references from the Windows Registry (refer to DB2 Windows Registry Clean-up section below).
6) Restart Windows.

DB2 Environment Variables Clean-up

From Control Panel navigate to My Computer -> Properties -> Advanced -> Environment Variables and remove any DB2 specific listed environment variables as well any any references to the DB2 install directory from the following:


DB2 Windows Registry Clean-up

First create a backup of the Windows Registry before modifying any settings as changes made to the registry will have an immediate impact. Then identify the {product code} and {registry key} for the target DB2 installation that is to be removed.

The {product code} can be located from the Windows registry under one of the following locations depending if you have a single or multiple product installation:

HKEY_LOCAL_MACHINE\SOFTWARE\IBM\DB2\InstalledCopies\<Copy Name>\<Product>\CurrentVersion

The {registry key} is derived from the {product code} by reversing the first three segments of the product code.

Example: ProductCode for DB2 ESE v9.7 is {814D6DAC-E778-40EC-961E-312B354D12BC}

Reverse the first 3 segments individually (CAD6D418-877E-CE04), remove all dashes, and we are left with the following key:


Now that we have the {product code} and {registry key} proceed to:

1) Delete the following:
    HKEY_LOCAL_MACHINE\Software\Classes\Installer\Features\{registry key}
    HKEY_LOCAL_MACHINE\Software\Classes\Installer\Products\{registry key}
    HKEY_LOCAL_MACHINE\Software\Classes\Installer\UpgradeCodes\{registry key}

2) Remove all DB2 services under:

3) Remove any folder names containing sqllib under:

4) For DB2 v8.2, all components that start with 000182B and need to be deleted from:

5) Finally delete the following entries:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{product code}

Related information

Download DB2 Fix Packs by version for DB2

Document information

More support for: DB2 for Linux, UNIX and Windows
OTHER - Uncategorised

Software version: 8.2, 9.1, 9.5, 9.7, 10.1, 10.5, 11.1

Operating system(s): Windows

Software edition: All Editions

Reference #: 1104569

Modified date: 04 February 2005

Translate this page: