The db2instance command is used to query the state of a DB2® instance.
In a DB2 pureScale® environment, the db2instance command can be run from any shell on the host on which the database server resides. In the event of database unavailability, reporting of some data is still possible if the cluster manager is still available on the host.
When root runs the db2instance command, the command can retrieve all information for any instance. You must specify the -instance instancename parameter before the -list parameter.
(1) >>-db2instance-- -instance-------instancename-------------------> .----------------------. V | >-- -list----+------------------+-+--+--------+---------------->< +- -cf-------------+ +- -h----+ +- -host--hostname-+ +- -help-+ +- -id--id---------+ '-?------' '- -member---------'
The output for the following examples is for a DB2 pureScale instance named db2inst1 with four members residing on hostA, hostB, hostC and hostD, and two cluster caching facilities (CF) residing on hostE and hostF:
db2instance -list
The following is a sample output when you run the command:
ID TYPE STATE HOME_HOST CURRENT_HOST ALERT PARTITION_NUMBER LOGICAL_PORT NETNAME
----- ------ ------- --------- ------------ ----- ---------------- ------------ ---------
0 MEMBER STARTED hostA hostA NO 0 0 hostA-ib0
1 MEMBER STARTED hostB hostB NO 0 0 hostB-ib0
2 MEMBER STARTED hostC hostC NO 0 0 hostC-ib0
3 MEMBER STARTED hostD hostD NO 0 0 hostD-ib0
128 CF PRIMARY hostE hostE NO 0 0 hostD-ib0
129 CF PEER hostF hostF NO 0 0 hostD-ib0
HOSTNAME STATE INSTANCE_STOPPED ALERT
-------- ------ ---------------- -----
hostA ACTIVE NO NO
hostB ACTIVE NO NO
hostC ACTIVE NO NO
hostD ACTIVE NO NO
hostE ACTIVE NO NO
hostF ACTIVE NO N0
db2instance -list -member
The following is a sample output when you run the command:
ID TYPE STATE HOME_HOST CURRENT_HOST ALERT PARTITION_NUMBER LOGICAL_PORT NETNAME
----- ------ ------- --------- ------------ ----- ---------------- ------------ ---------
0 MEMBER STARTED hostA hostA NO 0 0 hostA-ib0
1 MEMBER STARTED hostB hostB NO 0 0 hostB-ib0
2 MEMBER STARTED hostC hostC NO 0 0 hostC-ib0
3 MEMBER STARTED hostD hostD NO 0 0 hostD-ib0
db2instance -list -cf
The following is a sample output when you run the command:
ID TYPE STATE HOME_HOST CURRENT_HOST ALERT PARTITION_NUMBER LOGICAL_PORT NETNAME
----- ------ ------- --------- ------------ ----- ---------------- ------------ ----------
128 CF PRIMARY hostE hostE NO 0 0 hostD-ib0
129 CF PEER hostF hostF NO 0 0 hostD-ib0
db2instance -list -host hostC.yourdomain.com
The following is a sample output when you run the command:
ID TYPE STATE HOME_HOST CURRENT_HOST ALERT PARTITION_NUMBER LOGICAL_PORT NETNAME
----- ------ ------- --------- ------------ ----- ---------------- ------------ ----------
2 MEMBER STARTED hostC hostC NO 0 0 hostC-ib0
HOSTNAME STATE INSTANCE_STOPPED ALERT
-------- ------ ---------------- -----
hostC ACTIVE NO NO
db2instance -list -id 3
The following is a sample output when you run the command:
ID TYPE STATE HOME_HOST CURRENT_HOST ALERT PARTITION_NUMBER LOGICAL_PORT NETNAME
----- ------ ------- ---------- ------------- ----- ---------------- ------------ --------
3 MEMBER STARTED hostD hostD NO 0 0 hostD-ib0
ID TYPE STATE HOME_HOST CURRENT_HOST ALERT PARTITION_NUMBER LOGICAL_PORT NETNAME
----- ------ ------- --------- ------------ ----- ---------------- ------------ ---------
0 MEMBER ERROR hostA hostA YES 0 0 hostA-ib0
1 MEMBER STARTED hostB hostB NO 0 0 hostB-ib0
2 MEMBER STARTED hostC hostC NO 0 0 hostC-ib0
3 MEMBER STARTED hostD hostD NO 0 0 hostD-ib0
128 CF PRIMARY hostE hostE NO 0 0 hostD-ib0
129 CF PEER hostF hostF NO 0 0 hostD-ib0
HOSTNAME STATE INSTANCE_STOPPED ALERT
-------- ------ ---------------- -----
hostA ACTIVE NO NO
hostB ACTIVE NO NO
hostC ACTIVE NO NO
hostD ACTIVE NO NO
hostE ACTIVE NO NO
hostF ACTIVE NO N0
The cm action section of the db2cluster command syntax diagram illustrates the options used to list and clear alerts in a DB2 instance.
If the ALERT column has a YES entry, the db2cluster -cm -list -alert command can be used to find out more information about corrective action.