You are on page 1of 5

1.

Uninstalling DB2 on UNIX or Linux


Use these steps to uninstall DB2 on UNIX or Linux systems. To uninstall DB2 on UNIX and Linux, follow these steps. This example applies to DB2 V9.7. 1. As the DB2 instance user (typically db2inst1), drop the databases and stop DB2. a. If you are the user with root authority, run su - db2inst1 to switch the user to the DB2 instance user. Otherwise, log in as the DB2 instance user. b. Run db2 list db directory to list any databases that might not have been removed by the Tivoli Storage Productivity Center uninstallation program. c. For each database name listed by the command in the previous step, run db2 drop db database_name. For example: d. Command: e. $ db2 drop db tcpdb

f. Response: g. h. DB20000I The DROP DATABASE command completed successfully.

$ db2 drop db ibmcdb

i. Response: DB20000I j. The DROP DATABASE command completed successfully.

Run db2stop force. The following messages are displayed: k. 08/10/2010 21:46:13 was successful. SQL1064N 0 0 SQL1064N DB2STOP processing

DB2STOP processing was successful.

l.

Run db2 terminate. The following message is displayed: DB20000I The TERMINATE command completed successfully.

m. Run exit to close the su shell or log out. 2. Drop the DB2 instance. Note: This step must be performed as a user with root authority and run in a shell that has not had the db2profile sourced. a. Log in as a user with root authority. b. Change to the DB2 instance directory. The default path depends on your operating system.

On AIX, run cd /opt/IBM/db2/V9.7/instance. On Linux, run cd /opt/ibm/db2/V9.7/instance. c. Run ./db2ilist to list the db2instance name (typically db2inst1). d. Run ./db2idrop -f db2inst1 where "db2inst1" is the instance name reported by the db2ilist command in the previous step. The following messages are displayed: e. DBI1324W Support of the -f command is deprecated. For more information, f. DBI1070I see the DB2 Information Center. Program db2idrop completed successfully.

3. As the DB2 administration server (DAS) user (typically dasusr1), stop DAS. a. If you are the user with root suthority, run su - dasusr1 to switch user to the DAS user. Otherwise, log in as the DAS user. b. Run db2admin stop. The following message is displayed: SQL4407W The DB2 Administration Server was stopped successfully. c. Run exit to close the su shell or log out. 4. Remove the DB2 administration server. You must remove the DB2 administration server before you remove the DB2 product. a. Log in as a user with root authority. b. Change to the DB2 instance directory. The default path depends on your operating system. On AIX, run cd /opt/IBM/db2/V9.7/instance. On Linux, run cd /opt/ibm/db2/V9.7/instance. c. Run ./dasdrop. The following messages are displayed: d. SQL4410W The DB2 Administration Server is not active. DBI1070I Program dasdrop completed successfully. 5. Uninstall DB2. Use the db2_deinstall command to remove DB2 products or DB2 components. The db2_deinstall command removes all DB2 products from your system. a. Change to the DB2 installation directory. The default path depends on your operating system.

On AIX, run cd /opt/IBM/db2/V9.7/instance. On Linux, run cd /opt/ibm/db2/V9.7/instance. b. Run ./db2_deinstall -a. The following messages are displayed: c. DBI1016I Program db2_deinstall is performing uninstallation. d. Please wait. e. The execution completed successfully. f. For more information see the DB2 uninstallation log at "/tmp/db2_deinstall.log.pid". 6. Delete DB2 users and groups. The default user and group names are shown in the commands below. a. Run the following commands to remove the users: b. userdel -r dasusr1 c. userdel -r db2inst1 userdel -r db2fenc1 d. Run the appropriate commands for your operating system to remove the groups. On AIX run the following commands: rmgroup dasadm1 rmgroup db2iadm1 rmgroup db2fadm1 On Linux run the following commands: groupdel dasadm1 groupdel db2iadm1 groupdel db2fadm1 7. Remove the DB2 directory. a. Run cd. b. Run the command to remove the DB2 directory on your operating system: On AIX, run rm -r /opt/IBM/db2. On Linux, run rm -r /opt/ibm/db2. 8. Remove any DB2 definitions from /etc/services.

2 Removing DB2
To remove DB2 from your workstation cleanly, perform the following steps: 1. Log in as root. 2. List all DB2 instances:
bash# /usr/IBMdb2/V7.1/instance/db2ilist

3. Drop each instance listed in the previous step with the following command:
bash# /usr/ibmdb2/v7.1/instance/db2idrop instance-name

4. Drop the DB2 administration server:


bash# /usr/IBMdb2/V7.1/instance/dasidrop `/usr/IBMdb2/V7.1/instance/dasilist`

5. Uninstall all of the DB2 packages on your system using the db2deinstall command on your DB2 CD-ROM:
bash# /mnt/cdrom/db2/db2_deinstall -n

3. Removing DB2 database products using the db2_deinstall or doce_deinstall command (Linux and UNIX)
This task provides steps for removing DB2 database products or DB2 database components using the db2_deinstall command. Before you begin You cannot remove DB2 database products using a native operating system utility, such as rpm or SMIT. Before you remove DB2 database products from your system:

Ensure that you have performed all steps outlined in "Uninstalling your DB2 product". You must have root user authority to remove DB2 database products.

About this task The db2_deinstall command removes all DB2 database products from your system. The doce_deinstall command removes the DB2 Information Center that is in the same install path as the doce_deinstall tool. This command is only available on the Linux operating systems. Procedure To remove all DB2 database products from a specific path: 1. 2. 3. Log in as user with root user authority. Access the path where the DB2 database products are located. To locate the path of the DB2 database product to remove, see Listing DB2 products installed on your system. Run the db2_deinstall -a command from the DB2DIR/install directory or the doce_deinstall -a command from the DB2DIR/doc/install directory, where DB2DIR is the location that you specified when you installed your DB2 database product.

You might also like