db2 uninstall

在db2的安装目录中,例如:/opt/ibm/db2/v9.5/install中执行db2_deinstall命令,尝试卸载已经安装的db2可能遇到如下错误:

—————————————————————————————————————————————–

ERROR:There still exists DB2 instances related to the current installation directory where DB2 files are going to be completely uninstalled. The deinstallation process can’t continue because of this. If the deinstallation is for moving up or down DB2 level for the current DB2 installation, you need to use installFixPack in the DB2 images of the desired DB2 Level to update the current DB2 installation. If the purpose is to just uninstall DB2 in the current location, you need to drop the DB2 instances related to the installation directory if they are not needed any more. Or you need to update the DB2 instances to other DB2 installation location for the same version of DB2 and then restart db2_deinstall.

——————————————————————————————————————————————

解决的方法可以参考ibm官网的一些page,如下:

http://www-01.ibm.com/support/docview.wss?uid=swg21469364

Problem(Abstract)

When uninstalling an unused DB2 installation path after an upgrade to a new version or fix pack the db2_deinstall command fails stating instances still exist for the install path you wish to uninstall.

Symptom

The following message is seen:
ERROR:There still exists DB2 instances related to the current installation directory where DB2 files are going to be completely uninstalled. The deinstallation process can’t continue because of this. If the deinstallation is for moving up or down DB2 level for the current DB2 installation, you need to use installFixPack in the DB2 images of the desired DB2 Level to update the current DB2 installation. If the purpose is to just uninstall DB2 in the current location, you need to drop the DB2 instances related to the installation directory if they are not needed any more. Or you need to update the DB2 instances to other DB2 installation location for the same version of DB2 and then restart db2_deinstall.

Cause

The profiles.reg file in the installation path still contains references to the upgraded instance.

 

Environment

This is applicable to DB2 V9.1 and V9.5. Starting in V9.7 the profiles.reg file as been removed.

 

Diagnosing the problem

First, check to make sure your instance does not belong to the level you wish to uninstall by running “db2level” as the instance owner. You can also use “db2greg -dump” to verify the current level of the instance. If the instance no longer appears to be on the level you wish to uninstall then view the profiles.reg file to see if the instance is listed. The profiles.reg file is located under the DB2 installation path.

Example:

/opt/ibm/db2/V9.5

 

Resolving the problem

Remove the entry in the profiles.reg file using an editor, such as vim. Or, you can rename the file and create a new, blank profiles.reg file. Example:

 

mv /opt/ibm/db2/V9.5/profiles.reg /opt/ibm/db2/V9.5/profiles.bak

touch /opt/ibm/db2/V9.5/profiles.reg