db2idrop - Remove instance command

Removes a Db2® instance that was created by db2icrt.

You can only drop instances that are listed by the db2ilist command for the same Db2 copy where you are issuing the db2idrop command from. You can also use the db2idrop command to drop a Db2 pureScale® instance.

On Linux® and UNIX operating systems, this utility is located in the DB2DIR/instance directory, where DB2DIR represents the installation location where the current version of the Db2 database system is installed. On Windows operating systems, this utility is located under the DB2PATH\bin directory where DB2PATH is the location where the Db2 copy is installed.

Note: A non-root-installed Db2 instance, on Linux and UNIX operating systems, cannot be dropped using this command. The only option is to uninstall the non-root Db2 copy. See the following Usage notes section for more details.

Authorization

Root user or non root user authority is required on Linux and UNIX operating systems. Local Administrator authority is required on Windows operating systems.

Command syntax

For root installation on Linux and UNIX operating systems
Read syntax diagramSkip visual syntax diagramdb2idrop -d -h -?Db2 pureScale optionsOutside Of Db2 pureScale optionsInstName
Db2 pureScale options
Read syntax diagramSkip visual syntax diagram-g
Outside Of Db2 pureScale options
Read syntax diagramSkip visual syntax diagram-f
For a non-root thin server instance on Linux and AIX operating systems
Read syntax diagramSkip visual syntax diagramdb2idrop -d -h -?
For root installation on Windows operating systems
Read syntax diagramSkip visual syntax diagramdb2idrop InstName -f -h

Command parameters

For root installation on Linux and UNIX operating systems
-d
Enters debug mode, for use by Db2 database support.
-h | -?
Displays the usage information.
-g
This parameter is required when db2idrop is used with a Db2 pureScale instance. Specifies that you want to drop the Db2 pureScale instance on all hosts.
This parameter requires all Db2 members and all cluster caching facilities are stopped on all the hosts in the Db2 pureScale instance. This option will be ignored for dropping any other instance type
-f
This parameter is deprecated.

Specifies the force applications flag. If this flag is specified all the applications using the instance will be forced to terminate. This parameter is not supported on a Db2 pureScale environment.

InstName
Specifies the name of the instance.
For a non-root thin server instance on Linux and AIX operating systems
-d
Enters debug mode, for use by Db2 database support.
-h | -?
Displays the usage information.
For root installation on Windows operating systems
-f
Specifies the force applications flag. If this flag is specified all the applications using the instance will be forced to terminate.
-h
Displays usage information.
InstName
Specifies the name of the instance.

Examples

If you created db2inst1 on a Linux or UNIX operating system by issuing the following command:
/opt/IBM/db2/copy1/instance/db2icrt -u db2fenc1 db2inst1
To drop db2inst1, you must run the following command:
/opt/IBM/db2/copy1/instance/db2idrop db2inst1

Usage notes

  • Before an instance is dropped, ensure that the Db2 database manager has been stopped on all hosts and that Db2 database applications accessing the instance are disconnected and terminated. Db2 databases associated with the instance can be backed up, and configuration data saved for future reference if needed.
  • The db2idrop command does not remove any databases. Remove the databases first if they are no longer required. If the databases are not removed, they can always be cataloged under another Db2 copy of the same release and continued to be used.
  • If you want to save Db2 Text Search configurations and plan to reuse instance databases, you need to take the extra step of saving the config directory (on UNIX: instance_home/sqllib/db2tss/config and on Windows: instance_profile_path\instance_name\db2tss\config) or config directory contents before issuing the db2idrop command. After the new instance is created, the config directory can be restored. However, restoring the config directory is only applicable if the new instance created is of the same release and fix pack level.
  • A non-root-installed instance cannot be dropped on Linux and UNIX operating systems. To remove this Db2 instance, the only option available to the user is to uninstall the non-root copy of Db2 by running db2_deinstall -a.
  • On Linux and UNIX operating systems, if you are using the su command instead of the login command to become the root user, you must issue the su command with the - option to indicate that the process environment is to be set as if you had logged in to the system using the login command.
  • On Linux and UNIX operating systems, you must not source the Db2 instance environment for the root user. Running db2idrop when you sourced the Db2 instance environment is not supported.
  • In a Db2 pureScale environment, the -g parameter is mandatory. In this case, the instance is dropped on all hosts. However, the IBM® General Parallel File System (GPFS) on the installation-initiating host (IIH) is not deleted, nor is the GPFS file system. You must manually remove the file system and uninstall GPFS.
  • On Windows operating systems, if an instance is clustered with Microsoft Cluster Service (MSCS), then you can uncluster that instance by issuing the db2mscs or db2iclus command before dropping the instance.
  • On AIX® 7.1 (or higher), when running this command from a shared Db2 copy in a system workload partition (WPAR) global environment, this command must be run as the root user. WPAR is not supported in a Db2 pureScale environment.