db2instance - Query state of Db2 instance command
The db2instance command is used to query the state of a Db2 instance.
Scope
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.
Authorization
- SYSADM
- SYSCTRL
- SYSMAINT
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.
Command syntax
Command parameters
- -instance instancename
- Required specification if the db2instance command
is run as the
root
user. This parameter is not valid for users who are notroot
. - -list
- Returns the host information as well as a list of members and CFs for
the specified Db2 instance.
- -cf
- Returns a list of the CFs.
- -host hostname
- Returns a list of all the members and CFs that are associated with a specific host.
- -id id
- Returns the member or CF with the same ID.
- -member
- Returns a list of the members.
- -h | -help | ?
- Returns command help information.
Examples
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:
- To list the host information as well as a list of members and CFs, use the following
db2instance command:
db2instance -list
The following is a sample output when you run the command:
Output (continued):ID TYPE STATE HOME_HOST CURRENT_HOST ALERT ... ----- ------ ------- --------- ------------ ----- ... 0 MEMBER STARTED hostA hostA NO ... 1 MEMBER STARTED hostB hostB NO ... 2 MEMBER STARTED hostC hostC NO ... 3 MEMBER STARTED hostD hostD NO ... 128 CF PRIMARY hostE hostE NO ... 129 CF PEER hostF hostF NO ...
Output (continued):... PARTITION_NUMBER LOGICAL_PORT NETNAME ... ... ---------------- ------------ --------- ... ... 0 0 hostA-ib0 ... ... 0 0 hostB-ib0 ... ... 0 0 hostC-ib0 ... ... 0 0 hostD-ib0 ... ... 0 0 hostD-ib0 ... ... 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
- To list the members associated with
the specified Db2 instance, use the following db2instance
command:
db2instance -list -member
The following is a sample output when you run the command:
Output (continued):ID TYPE STATE HOME_HOST CURRENT_HOST ALERT ... ----- ------ ------- --------- ------------ ----- ... 0 MEMBER STARTED hostA hostA NO ... 1 MEMBER STARTED hostB hostB NO ... 2 MEMBER STARTED hostC hostC NO ... 3 MEMBER STARTED hostD hostD NO ...
... PARTITION_NUMBER LOGICAL_PORT NETNAME ... ---------------- ------------ --------- ... 0 0 hostA-ib0 ... 0 0 hostB-ib0 ... 0 0 hostC-ib0 ... 0 0 hostD-ib0
- To list the CFs associated with the
specified Db2
instance, use the following db2instance
command:
db2instance -list -cf
The following is a sample output when you run the command:
Output (continued):ID TYPE STATE HOME_HOST CURRENT_HOST ALERT ... ----- ------ ------- --------- ------------ ----- ... 128 CF PRIMARY hostE hostE NO ... 129 CF PEER hostF hostF NO ...
... PARTITION_NUMBER LOGICAL_PORT NETNAME ... ---------------- ------------ ---------- ... 0 0 hostD-ib0 ... 0 0 hostD-ib0
- To list the members and CFs that are associated
with a specific host, use the following db2instance
command:
db2instance -list -host hostC.yourdomain.com
The following is a sample output when you run the command:
Output (continued):ID TYPE STATE HOME_HOST CURRENT_HOST ALERT ... ----- ------ ------- --------- ------------ ----- ... 2 MEMBER STARTED hostC hostC NO ...
Output (continued):... PARTITION_NUMBER LOGICAL_PORT NETNAME ... ... ---------------- ------------ ---------- ... ... 0 0 hostC-ib0 ...
... HOSTNAME STATE INSTANCE_STOPPED ALERT ... -------- ------ ---------------- ----- ... hostC ACTIVE NO NO
-
To list the members or CFs with the same ID, use
the following db2instance
command:
db2instance -list -id 3
The following is a sample output when you run the command:
Output (continued):ID TYPE STATE HOME_HOST CURRENT_HOST ALERT ... ----- ------ ------- ---------- ------------- ----- ... 3 MEMBER STARTED hostD hostD NO ...
... PARTITION_NUMBER LOGICAL_PORT NETNAME ... ---------------- ------------ -------- ... 0 0 hostD-ib0
- The following is an example of one of the values in the ALERT column being a YES when you run
the command
db2instance -list
:
Output (continued):ID TYPE STATE HOME_HOST CURRENT_HOST ALERT ... ----- ------ ------- --------- ------------ ----- ... 0 MEMBER ERROR hostA hostA YES ... 1 MEMBER STARTED hostB hostB NO ... 2 MEMBER STARTED hostC hostC NO ... 3 MEMBER STARTED hostD hostD NO ... 128 CF PRIMARY hostE hostE NO ... 129 CF PEER hostF hostF NO ...
Output (continued):... PARTITION_NUMBER LOGICAL_PORT NETNAME ... ... ---------------- ------------ --------- ... ... 0 0 hostA-ib0 ... ... 0 0 hostB-ib0 ... ... 0 0 hostC-ib0 ... ... 0 0 hostD-ib0 ... ... 0 0 hostD-ib0 ... ... 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
Usage notes
The cm action
section
of the db2cluster command syntax diagram illustrates
the options used to list and clear alerts in a Db2 instance.
- -cf
- -host
- -id
- -member
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.