DB2可以通过SQL语句查询操作系统信息,比如操作系统类型、主机名、操作系统版本、内存大小等。也可以通过SQL查询实例名、DB2版本等信息。
方法主要是通过 SYSIBMADM.ENV_SYS_INFO ,以及SYSIBMADM.ENV_INST_INFO等视图
1. SYSIBMADM.ENV_SYS_INFO
可以查询以下操作系统信息(表格源自DB2信息中心):
Column name | Data type | Description |
---|---|---|
OS_NAME | VARCHAR(256) | Name of the operating system. |
OS_VERSION | VARCHAR(256) | Version number of the operating system. |
OS_RELEASE | VARCHAR(256) | Release number of the operating system. |
HOST_NAME | VARCHAR(256) | host_name - Host name monitor element |
TOTAL_CPUS | INTEGER | The number of processors on this host. |
CONFIGURED_CPUS | INTEGER | Number of configured physical CPUs on the system. |
TOTAL_MEMORY | INTEGER | Total amount of memory on the system (in megabytes). |
OS_FULL_VERSION | VARCHAR(256) | os_full_version - Operating system full version monitor element |
OS_KERNEL_VERSION | VARCHAR(256) | os_kernel_version - Operating system kernel identifier monitor element |
OS_ARCH_TYPE | VARCHAR(256) | os_arch_type - Operating system architecture type monitor element |
2. SYSIBMADM.ENV_INST_INFO
可以查询以下实例信息(表格源自DB2信息中心)
Column name | Data type | Description |
---|---|---|
INST_NAME | VARCHAR(128) | Name of the current instance. |
IS_INST_PARTITIONABLE | SMALLINT | Indicates whether or not the current instance is a partitionable database server instance. Possible return values are 0 if it is not a partitionable database server instance, and 1 if it is a partitionable database server instance. |
NUM_DBPARTITIONS | INTEGER | Number of database partitions. If it is not a partitioned database environment, returns a value of 1. |
INST_PTR_SIZE | INTEGER | Bit size of the current instance (32 or 64). |
RELEASE_NUM | VARCHAR(128) | Internal release number, as returned by the db2level command; for example, 03030106. |
SERVICE_LEVEL | VARCHAR(128) | service_level - Service Level monitor element |
BLD_LEVEL | VARCHAR(128) | Build level, as returned by the db2level command; for example, n041021. |
PTF | VARCHAR(128) | Program temporary fix (PTF) identifier, as returned by the db2level command; for example, U498350. |
FIXPACK_NUM | INTEGER | Fix Pack number, as returned by the db2level command; for example, 9. |
NUM_MEMBERS | INTEGER | The number of members on this instance. |
参考资料:
Environment routines and views