DB2 10.5 for Linux, UNIX, and Windows

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

One of the following authorities:
  • SYSADM
  • SYSCTRL
  • SYSMAINT
Before displaying any information, the db2instance command will check for SYSADM, SYSCTRL, and SYSMAINT privileges to ensure the user has a right to access the instance information.

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

Read syntax diagramSkip visual syntax diagram
                           (1)                  
>>-db2instance-- -instance-------instancename------------------->

           .----------------------.               
           V                      |               
>-- -list----+------------------+-+--+--------+----------------><
             +- -cf-------------+    +- -h----+   
             +- -host--hostname-+    +- -help-+   
             +- -id--id---------+    '-?------'   
             '- -member---------'                 

Notes:
  1. Mandatory specification if the command is run by a root user.

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 not root.
-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:

  1. 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:

    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
  2. 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:

    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   
  3. 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:

    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   
  4. 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:

    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
    
  5. 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:

    ID    TYPE   STATE   HOME_HOST  CURRENT_HOST  ALERT PARTITION_NUMBER LOGICAL_PORT NETNAME
    ----- ------ ------- ---------- ------------- ----- ---------------- ------------ --------
        3 MEMBER STARTED hostD      hostD         NO                   0            0 hostD-ib0
  6. The following is an example of one of the values in the ALERT column being a YES when you run the command db2instance -list:
    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

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.

To specify any of the following options, the -list parameter must precede the option:
  • -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.