简体   繁体   English

如何检查 db2 版本

[英]How to check db2 version

How to check db2 version on Z/OS using only SQL commands?如何仅使用 SQL 命令检查 Z/OS 上的 db2 版本?

Thanks, Melita谢谢,梅丽塔

You can try the following query:您可以尝试以下查询:

SELECT service_level, fixpack_num FROM TABLE
  (sysproc.env_get_inst_info())
  as INSTANCEINFO

It works on LUW, so I can't guarantee that it'll work on z/OS, but it's worth a shot.它适用于 LUW,所以我不能保证它适用于 z/OS,但值得一试。

SELECT GETVARIABLE('SYSIBM.VERSION') FROM SYSIBM.SYSDUMMY1

There is also the env_inst_info admin view.还有 env_inst_info 管理视图。 As with CanSpice I can only vouch for LUW, but there should at least be a similar view available for Z/OS.与 CanSpice 一样,我只能保证 LUW,但至少应该有类似的视图可用于 Z/OS。

SELECT * FROM SYSIBMADM.ENV_INST_INFO

I used我用过

SELECT * FROM TABLE(SYSPROC.ENV_GET_INST_INFO()); 

from tyranitar and that worked on Z/OS.来自 tyranitar 并且在 Z/OS 上工作。 Here's what I got:这是我得到的:

SERVICE_LEVEL
DB2 v9.7.0.6

I'd vote up if I could!如果可以,我会投票! Thanks!!谢谢!!

There is a typo in your SQL.您的 SQL 中存在拼写错误。 Fixed version is below:固定版本如下:

SELECT GETVARIABLE('SYSIBM.VERSION') FROM SYSIBM.SYSDUMMY1;

I ran this on the IBM Mainframe under Z/OS in QMF and got the following results.我在 QMF 中 Z/OS 下的 IBM 大型机上运行它并得到以下结果。 We are currently running DB2 Version 8 and upgrading to Ver 10.我们目前正在运行 DB2 版本 8 并升级到版本 10。

DSN08015  -- Format seems to be DSNVVMMM
-- PPP IS PRODUCT STRING 'DSN'
-- VV IS VERSION NUMBER E.G. 08
-- MMM IS MAINTENANCE LEVEL E.G. 015

To find out the fixpak information using command prompt: db2level使用命令提示符查找修订包信息: db2level

To find out the version and license information using command prompt: db2licm -l使用命令提示符查找版本和许可证信息: db2licm -l

C:\Users\Administrator>db2level
DB21085I  This instance or install (instance name, where applicable: "DB2")
uses "64" bits and DB2 code release "SQL10051" with level identifier
"0602010E".
Informational tokens are "DB2 v10.5.100.63", "s130816", "IP23521", and Fix Pack

"1".
Product is installed at "C:\SQLLIB" with DB2 Copy Name "DB2COPY1".


C:\Users\Administrator>db2licm -l
Product name:                     "IBM Data Server Client"
Product identifier:               "db2client"
Version information:              "10.5"

You can query for the built-in session variables with SQL.您可以使用 SQL 查询内置会话变量。 To identify the version of DB2 on z/OS, you need the SYSIBM.VERSION variable.要识别 z/OS 上的 DB2 版本,您需要SYSIBM.VERSION 变量。 This will return the PRDID - the product identifier .这将返回PRDID - 产品标识符 You can look up the human-readable version in the Knowledge Center .您可以在知识中心 中查找人类可读的版本。

SELECT GETVARIABLE('SYSIBM.VERSION')
FROM SYSIBM.SYSDUMMY1;

-- for example, the above returns DSN10015
-- DSN10015 identifies DB2 10 in new-function mode (see second link above)

Try the first or the second:尝试第一个或第二个:

SELECT * FROM TABLE(SYSPROC.ENV_GET_INST_INFO());
SELECT * FROM TABLE(SYSPROC.ENV_GET_PROD_INFO());
SELECT * FROM TABLE(SYSPROC.ENV_GET_SYS_INFO());

Both worked for me.两者都为我工作。

SELECT * FROM TABLE(SYSPROC.ENV_GET_INST_INFO());

or

SELECT * FROM SYSIBMADM.ENV_INST_INFO;

Another one in v11: v11 中的另一个:

select CURRENT APPLICATION COMPATIBILITY from sysibm.sysdummy1

Result:结果:

V11R1

It's not the current version, but the current configured level for the application.它不是当前版本,而是应用程序的当前配置级别。

In z/OS while on version 10, use of CURRENT APPLICATION COMPATIBILITY is not allowed.在 z/OS 版本 10 中,不允许使用CURRENT APPLICATION COMPATIBILITY You will have to resort to:您将不得不求助于:

SELECT GETVARIABLE('SYSIBM.VERSION') AS VERSION,
       GETVARIABLE('SYSIBM.NEWFUN')  AS COMPATIBILITY
FROM SYSIBM.SYSDUMMY1;

Here is a link to all the variables available: https://www.ibm.com/support/knowledgecenter/SSEPEK_12.0.0/sqlref/src/tpc/db2z_refs2builtinsessionvars.html#db2z_refs2builtinsessionvars这是所有可用变量的链接: https : //www.ibm.com/support/knowledgecenter/SSEPEK_12.0.0/sqlref/src/tpc/db2z_refs2builtinsessionvars.html#db2z_refs2builtinsessionvars

对于DB2

"SELECT * FROM SYSIBMADM.ENV_INST_INFO" - SERVICE_LEVEL

In AIX you can try:在 AIX 中,您可以尝试:

db2level

Example output:示例输出:

db2level
DB21085I  This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL09077" with level
identifier "08080107".
Informational tokens are "DB2 v9.7.0.7", "s121002", "IP23367", and Fix Pack
"7".
Product is installed at "/db2_09_07".

db2ls command will display the db2level along with the install path and install date. db2ls 命令将显示 db2level 以及安装路径和安装日期。

To determine the specific product installed:要确定安装的特定产品:

db2ls -p -q -b <installpath>

on db2ls command.db2ls命令上。

The following will appear:将出现以下内容:

Install Path       Level   Fix Pack   Special Install Number   Install Date    Installer UID
--------------------------------------------------------------------------------------------
/opt/ibm/db2/V9.7  9.7.0.7        7                      Thu Aug  1 12:25:53 2013 CDT     0

visit IBM Website访问IBM 网站

SELECT GETVARIABLE(('SYSIBM.VERSION')
 FROM SYSIBM.SYSDUMMY1;
-- PPP IS PRODUCT STRING 'DSN'
-- VV IS VERSION NUMBER E.G., 10, 11
-- M IS MAINTENANCE LEVEL E.G. 5

-DISPLAY GROUP
 THIS WILL DISPLAY THE LEVEL CM, ENFM, N

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM