查看警报的详细信息

如果其中一个 成员集群高速缓存工具 报告警报,那么您可以使用 DB2_INSTANCE_ALERTS 管理视图来查看有关该警报的更多信息。 或者,作为实例所有者,您可以将 db2cluster 命令与 [-cm] -list -alert 参数配合使用。 同样,以 root 用户身份,将 db2cluster 命令与 [-cm] -list -alert <instance> 配合使用,并将 <instance> 作为相关实例。

关于本任务

此任务假定您已经确定实例中的一台主机发出了警报。 Db2 pureScale® 实例中的一台主机发出了警报。 例如, LIST INSTANCE 命令可能显示了某个 成员的警报:

ID     TYPE    STATE   HOME_HOST CURRENT_HOST ALERT
------ ------- ------- --------- ------------ -----
     0 MEMBER  STARTED 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     -            NO   
   129 CF      PEER    hostF     -            NO   

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               NO
在此情况下, member 0 将显示警报。

过程

要查找有关实例中的警报的更多信息,请执行以下操作:

  1. 制定一个使用 DB2_INSTANCE_ALERTS 管理视图的 SQL 语句:
    SELECT * FROM SYSIBMADM.DB2_INSTANCE_ALERTS
  2. 运行此 SQL 语句。

结果

根据成员 0 上的问题的特性,DB2_INSTANCE_ALERTS 管理视图返回的信息有所不同。 例如,您可能会接收到类似如下的消息:
MESSAGE           
--------------------------------------------------------------------------------------------------------
Could not restart light Db2 member '0' on hosts 'hostA'. Check the db2diag.log for messages concerning a restart light or database crash recovery failure on the indicated hosts for Db2 member '0'.

ALERT_ACTION
-----------------------------------------------------------------------------------------
This alert must be cleared manually with the command: 'db2cluster -clear -alert -member 0'

IMPACT
---------------------------------------------------------------------------------------------------
Db2 member '0' will not be able to restart light on host 'hostC' until this alert has been cleared.

示例

示例 1:使用 db2cluster 命令来查看警报信息
在此示例中,db2instance -list 命令返回以下信息:
$ db2instance -list
ID        TYPE             STATE           HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----           ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           ERROR                 HostA                      HostA              YES                  0                   0          -
1       MEMBER           STARTED               HostB                      HostB               NO                  0                   1          -
2       MEMBER           STARTED               HostC                      HostC               NO                  0                   2          -
128     CF               PRIMARY               HostD                      HostD               NO                  -                   0          -
129     CF               PEER                  HostE                      HostE               NO                  -                   0          -

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
   HostA                  ACTIVE                              NO          YES
   HostB                  ACTIVE                              NO           NO
   HostC                  ACTIVE                              NO           NO
   HostD                  ACTIVE                              NO           NO
   HostE                  ACTIVE                              NO           NO

There is currently an alert for a member, CF, or host in the data-sharing instance. For more information on the alert, its impact,
and how to clear it, run the following command: 'db2cluster [-cm] -list -alert'
表 2中包含的信息中,您可以看到 db2instance -list 的输出显示 member 0 无法在任何主机上启动。 (如果它已在访客主机上启动,那么状态将为STARTED,并且当前主机将显示其运行所在的主机的名称。)
使用 db2cluster -cm -list -alert 命令将显示以下消息:
$ db2cluster -cm -list -alert

Alert: Db2 member '0' failed to start on its home host 'Host A'. The cluster manager will 
attempt to restart the Db2 member
in restart light mode on another host. Check the db2diag.log for messages concerning failures 
on hosts 'HostA' for member '0'.

Action: This alert must be cleared manually with the command: 'db2cluster [-cm] -clear -alert'.

Impact: Db2 member '0' will not be able to service requests until this alert has been cleared 
and the Db2 member returns to its home host.

后续操作

执行 DB2_INSTANCE_ALERTS 管理视图或 db2cluster 命令返回的信息中指定的调查或操作。