Uninstalling your Db2 database product (Windows)

This task provides steps for completely removing your Db2 database product from your Windows operating system. Only perform this task if you no longer require your existing Db2 instances and databases.

About this task

If you are uninstalling the default Db2 copy, and you have other Db2 copies on your system, use the db2swtch command to choose a new default copy before you proceed with the uninstallation. Also, if your Db2 Administration Server (DAS) is running under the copy being removed, move your DAS to a copy that is not being removed. Otherwise, re-create the DAS using the db2admin create command after the uninstall, and you reconfigure the DAS for some function to work.


To remove your Db2 database product from Windows:

  1. Optional: Drop all databases using the drop database command.
    Be sure that you no longer need these databases. If you drop your databases, all of your data will be gone.
  2. Required: If your Db2 instance is configured for HA with Microsoft Cluster Server (MSCS), you need to decluster the instance before you uninstall your Db2 product by running the db2mscs -u instance-name command.
  3. Stop all Db2 processes and services.
    This can be done through the Windows Services panel or by issuing the db2stop command. If Db2 services and processes are not stopped before attempting to remove your Db2 database product, you will receive a warning containing a list of processes and services that are holding Db2 DLLs in memory. If you will use Add/Remove Programs to remove your Db2 database product, this step is optional.
  4. You have two options for removing your Db2 database product:
    • Add/Remove Programs

      Accessible through the Windows Control Panel, use the Add/Remove Programs window to remove your Db2 database product. Refer to your operating system's help for more information about removing software products from your Windows operating system.

    • db2unins command

      You can run the db2unins command from the DB2DIR\bin directory to remove your Db2 database products, features, or languages. Using this command, you can uninstall multiple Db2 database products at the same time using the /p parameter. You can use a response file to uninstall Db2 database products, features, or languages using /u parameter.

What to do next

Unfortunately, your Db2 database product cannot always be removed by using the Control Panel > Add/Remove Programs facility or using the db2unins /p command or the db2unins /u command. The following uninstallation option must ONLY be attempted if the previous method fails.

To forcefully remove all Db2 copies from your Windows system, run the db2unins /f command. This command will perform a brute force uninstallation of ALL Db2 copies on the system. Everything except user data, such as Db2 databases, will be forcefully deleted. Before running this command with the /f parameter, see the db2unins command for details.

If you did not successfully remove the Microsoft Cluster Service Instance, entries are left behind in the registry. These entries can prevent successful reinstallation of Db2, or switching between ESE and WSE. You can edit the registry to manually remove these entries. Using the regedit tool, remove the Db2 entries from the following locations:

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
Attention: Using the regedit must be done with care as it can cause your computer to become unusable.