Listing DB2 instances and checking/setting the current DB2 instance on Windows
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.
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.
No comments:
Post a Comment