今天看到群友问了两个问题:
1 怎么确认我的db2是否由root安装的呢?
其实从DB2UDB V9.1有了db2ls这个命令后,这个问题就简单多了,我们只需要简单的跑下db2ls,然后看输出的Installer UID是否为0(rootuid),如下图所示:
[db2v975@db2udb ~]$ db2ls
InstallPath Level Fix Pack Special Install Number InstallDate Installer UID
---------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V10.1 10.1.0.2 2 edNov 20 02:27:07 2013PST 0
/opt/ibm/db2/V9.1 9.1.0.8 8 Sun Dec 1 23:14:06 2013PST 0
/opt/ibm/db2/V9.5 9.5.0.6 6a Sun Dec 1 23:17:40 2013PST 0
/opt/ibm/db2/V9.7 9.7.0.5 5 Sun Dec 1 23:21:11 2013PST 0
[db2v975@db2udb install]$ id root
uid=0(root)gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
[db2v975@db2udb install]$
可以看到我虚拟机上的四个db2都是有root安装的。
2 怎么知道我装的是db2的什么产品(db2ese,connect,client,aese…etc)呢?
这个问题同样可以用db2ls来解决,这次我们需要用到db2ls的几个参数:
-q
Signifies that the query is to list installed DB2 productsand features. By default, only the visible components (features) are displayedunless the -a parameter is also specified.
-p
Lists products only. This will give a brief list of whichproducts the customer has installed rather than listing the features.
-b base-install-path
When using the global db2ls command in /usr/local/bin, youneed to specify which directory you are querying. The global db2ls command willsimply call the db2ls from that install path and pass in the rest of theparameters.
DB2的db2ls能列指定安装目录下的db2是什么产品。
Example :
[db2v975@db2udb install]$ db2ls-q -p -b /opt/ibm/db2/V10.1
Install Path : /opt/ibm/db2/V10.1
Product Response File ID Level Fix Pack Product Description
---------------------------------------------------------------------------------------------------------------------
ENTERPRISE_SERVER_EDITION 10.1.0.2 2 DB2 EnterpriseServer Edition
[db2v975@db2udb install]$
附:db2ls- List installed DB2 products and features command