DB2可以通过SQL语句查询操作系统信息,比如操作系统类型、主机名、操作系统版本、内存大小等。也可以通过SQL查询实例名、DB2版本等信息。
方法主要是通过 SYSIBMADM.ENV_SYS_INFO ,以及SYSIBMADM.ENV_INST_INFO等视图
1. SYSIBMADM.ENV_SYS_INFO
可以查询以下操作系统信息(表格源自DB2信息中心):
Column nameData typeDescriptionOS_NAMEVARCHAR(256)Name of the operating system.OS_VERSIONVARCHAR(256)Version number of the operating system.OS_RELEASEVARCHAR(256)Release number of the operating system.HOST_NAMEVARCHAR(256)host_name - Host name monitor elementTOTAL_CPUSINTEGERThe number of processors on this host.CONFIGURED_CPUSINTEGERNumber of configured physical CPUs on the system.TOTAL_MEMORYINTEGERTotal amount of memory on the system (in megabytes).OS_FULL_VERSIONVARCHAR(256)os_full_version - Operating system full version monitor elementOS_KERNEL_VERSIONVARCHAR(256)os_kernel_version - Operating system kernel identifier monitor elementOS_ARCH_TYPEVARCHAR(256)os_arch_type - Operating system architecture type monitor element
2. SYSIBMADM.ENV_INST_INFO
可以查询以下实例信息(表格源自DB2信息中心)
Column nameData typeDescriptionINST_NAMEVARCHAR(128)Name of the current instance.IS_INST_PARTITIONABLESMALLINTIndicates 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_DBPARTITIONSINTEGERNumber of database partitions. If it is not a partitioned database environment, returns a value of 1.INST_PTR_SIZEINTEGERBit size of the current instance (32 or 64).RELEASE_NUMVARCHAR(128)Internal release number, as returned by the db2level command; for example, 03030106.SERVICE_LEVELVARCHAR(128)service_level - Service Level monitor elementBLD_LEVELVARCHAR(128)Build level, as returned by the db2level command; for example, n041021.PTFVARCHAR(128)Program temporary fix (PTF) identifier, as returned by the db2level command; for example, U498350.FIXPACK_NUMINTEGERFix Pack number, as returned by the db2level command; for example, 9.NUM_MEMBERSINTEGERThe number of members on this instance.
参考资料:
Environment routines and views