Capturing a database health snapshot using SQL table functions
You can capture database health snapshots using SQL table functions. Each available health snapshot table function corresponds to a health snapshot request type.
Important: The health monitor, health indicators, and related components have been deprecated in Version 9.7 and might be removed in a future release. Health monitor is not supported in Db2® pureScale® environments. For more information, see Health monitor has been deprecated.
To capture a database health snapshots using SQL table functions:
About this task
the SQL table function you plan to use. SQL table functions have two input parameters:
Note: The database manager snapshot SQL table functions are the only exception to this rule because they have only one parameter. The single parameter is for partition number. If you enter NULL for the database name parameter, the monitor uses the database defined by the connection through which the table function has been called.
- A VARCHAR(255) for the database name
- An INT for the partition number (a value between 0 and 999). Enter the integer corresponding to the partition number you want to monitor. To capture a snapshot for the currently connected partition, enter a value of -1. To capture a global snapshot, enter a value of -2.
the SQL statement. The following example captures a basic health snapshot for the currently connected partition, and on the database defined by the connection from which this table function call is made:
SELECT * FROM TABLE( HEALTH_DB_INFO( cast (NULL as VARCHAR(1)), -1)) as HEALTH_DB_INFOYou can also select individual monitor elements from the returned table. Each column in the returned table corresponds to a monitor element. Accordingly, the monitor element column names correspond directly to the monitor element names. The following statement returns only the db path and server platform monitor elements:
SELECT db_path, server_platform FROM TABLE( HEALTH_DB_INFO( cast (NULL as VARCHAR(1)), -1 ) ) as HEALTH_DB_INFO