DB2 10.5 for Linux, UNIX, and Windows

Dropping instances

To drop a root instance, issue the db2idrop command. To drop non-root instances, you must uninstall your DB2® database product.

Procedure

To remove a root instance using the command line:

  1. Stop all applications that are currently using the instance.
  2. Stop the Command Line Processor by running terminate commands in each Command window.
  3. Stop the instance by running the db2stop command.
  4. Back up the instance directory indicated by the DB2INSTPROF registry variable.

    On Linux and UNIX operating systems, consider backing up the files in the INSTHOME/sqllib directory (where INSTHOME is the home directory of the instance owner). For example, you might want to save the database manager configuration file, db2systm, the db2nodes.cfg file, user-defined functions (UDFs), or fenced stored procedure applications.

  5. For Linux and UNIX operating systems only, log off as the instance owner and log in as a user with root user authority.
  6. Issue the db2idrop command. For example:
    db2idrop InstName 
    where InstName is the name of the instance being dropped.
    For non DB2 pureScale® instances, on UNIX and Linux operating systems, the db2idrop command removes:
    • The instance entry from the list of instances. To view the list of instances, use the db2ilist command.
    • The global registry record (global.reg) for the instance. To view the global registry record, use the db2greg command.
    • The sqllib subdirectory under the instance owner's home directory (INSTHOME/sqllib).
    • The instance port entry from the services file found in the /etc/services directory.
    On Windows operating systems, the db2idrop command removes:
    • The directory, which contains the instance configuration file that is created under the DB2INSTPROF path. To view the DB2INSTPROF path, use the db2set -all command.
    • Windows Service for the instance.
    • All the registry entries for the instance.
    • All service entries that are related to the instance in the C:\WINDOWS\system32\drivers\etc\services file.
    Note: On Linux and UNIX operating systems, if you issue the db2idrop command and receive a message stating that the INSTHOME/sqllib subdirectory cannot be removed, one reason could be that the INSTHOME/adm subdirectory contains files with the .nfs extension. The adm subdirectory is an NFS-mounted system and the files are controlled on the server. You must delete the *.nfs files from the file server from where the directory is being mounted. Then you can remove the INSTHOME/sqllib subdirectory.
  7. For Windows operating systems, if the instance that you dropped was the default instance, set a new default instance by issuing the db2set command:
    db2set db2instdef=instance_name -g
    where instance_name is the name of an existing instance.
  8. For Linux and UNIX operating systems, 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.

    This step is optional since the instance owner and the instance owner group might be used for other purposes.