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:
- Stop all applications that are currently using the instance.
- Stop the Command Line Processor by running terminate commands
in each Command window.
- Stop the instance by running the db2stop command.
- 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.
- For Linux and UNIX operating systems only, log
off as the instance owner and log in as a user with root user authority.
- Issue the db2idrop command. For
example:
db2idrop InstName
where InstName is
the name of the instance being dropped. The db2idrop command
removes the instance entry from the list of instances and removes
the sqllib subdirectory under the instance owner's
home directory.
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.
- 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.
- 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 recreate the instance.
This
step is optional since the instance owner and the instance owner group
might be used for other purposes.