在 DB2 中获取计算机名/IP [英] Get ComputerName/IP in DB2

查看:37
本文介绍了在 DB2 中获取计算机名/IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取有关连接到我的 DB2 的用户的信息.如何获取(如果可以)该用户的计算机名称/登录名或 IP?我可以获得 host_namecurrent user 并登录到 DB2,但我想要更具体的信息,例如 IP 或计算机名称.我该怎么做?

I need to get info about user connected to my DB2. How can I get (if I can) computer name/login or IP of that user? I can get host_name, current user and login to DB2, but I want more specific information like IP or computer name. How I can do this?

推荐答案

您可以从 MON_GET_CONNECTION 表函数中获取该信息.

You can get that information from the MON_GET_CONNECTION table function.

表函数在上一个版本中发生了很大变化,因此取决于您的 DB2 版本您可以获得什么值.

The table functions have change a lot in the last versions, so it depends on your DB2 version what values you can get.

SELECT application_handle, 
       CLIENT_USERID,
       CLIENT_WRKSTNNAME, 
       CLIENT_HOSTNAME, 
       CLIENT_IPADDR
FROM TABLE(MON_GET_CONNECTION(cast(NULL as bigint), -2)) AS t 
ORDER BY rows_returned DESC;

例如 CLIENT_HOSTNAME 和 CLIENT_IPADDR 在 v9.7 中不起作用

For example CLIENT_HOSTNAME and CLIENT_IPADDR does not work in v9.7

http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0053938.html

这篇关于在 DB2 中获取计算机名/IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆