IBM Support

Listing DB2 instances and checking/setting the current DB2 instance on Windows

Troubleshooting


Problem

This technote includes information on how to find and set the currently attached DB2 database instance from the command line.

Cause

When there multiple DB2 instances created and a command needs to be run directly against the ISDS database instance, you may need to attach to a different instance to be able to run the commands.

Resolving The Problem

1) Start up a db2cmd.exe window (it's a standard cmd.exe window with the DB2 environment sourced); select "Command Window" from the "Command Line Tools" group from the DB2 start menu (or just type 'db2cmd' from the Windows Run dialog)

2) List all the DB2 instances on the current system:

db2ilist

3) List the current DB2 instance:

echo %DB2INSTANCE%

4) Change the current DB2 instance (if required):

set DB2INSTANCE=LDAPDB2

5) Check if the desired database is contained in this instance:

db2 list db directory

Here's an example with screenshots of navigating to the correct DB2 instance:

a) listing DB2 instances:



b) Listing the current DB2 instance:



This shows that the standard default DB2 instance ('DB2') has been created, and is the default DB2 instance the user is attached to when starting a DB2 command window.

c) Listing the databases in the current instance:


This shows that the sample database has been created, and is the only database contained in the default DB2 instance.

d) Changing the current DB2 instance:


We've switched from the default 'DB2' instance to our LDAP instance called 'LDAPDB2'.

e) Checking to see that the instance has been set correctly:



f) List the databases contained in the ITDS database instance:



OK, this instance contains our the ITDS backend database. We can now connect to it, and run any DB2 commands against it.

[{"Product":{"code":"SSVJJU","label":"IBM Security Directory Server"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General","Platform":[{"code":"PF033","label":"Windows"}],"Version":"6.0;6.1;6.2;6.3;6.3.1;6.4","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}}]

Product Synonym

ITDS TDS Secureway LDAP

Document Information

Modified date:
16 June 2018

UID

swg21268793