Removing Db2 instances (Linux and UNIX)

This task explains how to remove some or all of the root instances on your system. Remove Db2 instances only if you are not planning to use your Db2 database products, or if you do not want to upgrade existing instances to a later version of the Db2 database product.

About this task

If you are removing your last Db2 Version 9 copy, you can remove the Db2 instances before you remove your database product. If you are removing a Version 9 copy, but have other Version 9 copies, you can run the db2iupdt command from the Db2 copy that you would like to have the instances associated with.

Once an instance is removed, you can use the Db2 databases owned by the instance if you catalog them under another instance of the same release. Even though you remove the instance, the databases are still intact and can be reused unless the database files are expressly deleted.

Upgrading requires that both the new and old Db2 database versions are still installed. You cannot upgrade an instance if the Db2 copy it is associated with has been removed.


Restrictions

This task does not apply to non-root installations. To remove a non-root instance, you must uninstall your Db2 database product.

Procedure

To remove an instance:

  1. Log in as a user with root user authority.
  2. Optional: If you are certain you no longer need the data in the associated databases, you can remove the database files from the systems or drop the databases before dropping the instance.
  3. Remove the instance by entering the following command:
    DB2DIR/instance/db2idrop InstName
    
    where DB2DIR is the location you specified during the Db2 database product installation. The default installation path for UNIX is /opt/IBM/db2/11.1. The default installation path for Linux® is /opt/ibm/db2/11.1.

    The db2idrop command removes the instance entry from the list of instances and removes the INSTHOME/sqllib directory, where INSTHOME is the home directory of the instance and where InstName is the login name of the instance. If you are storing any files in /sqllib directory, these files will be removed by this action. If you still need these files, you must make a copy of them before dropping the instance.

  4. Optional: As a user with root user authority, remove the instance owner's user ID and group (if used only for that instance). Do not remove these if you are planning to re-create the instance.
    Note: This step is optional since the instance owner and the instance owner group might be used for other purposes.