SQL 如何在 DB2 (8.x) 中查找所有打开/活动连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/261512/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 00:08:38  来源:igfitidea点击:

How to find all open/active connections in DB2 (8.x)

sqldb2

提问by Kamal Joshi

I'm currently working with Db2 Enterprise Server V 8.2 with FixPak 10

我目前正在使用带有 FixPak 10 的 Db2 Enterprise Server V 8.2

And I want to retrieve list of all the open active connections with an instance.

我想用一个实例检索所有打开的活动连接的列表。

In Oracle there is a utility program called "Top Session" which does the similar task. Is there any equivalent in DB2?

在 Oracle 中有一个名为“Top Session”的实用程序,它执行类似的任务。DB2 中是否有任何等价物?

Thanks in advance, Kamal

提前致谢,卡马尔

回答by Kamal Joshi

To get more detailed information from list applications:

要从列表应用程序中获取更多详细信息:

db2 list applications for database {dbName} show detail

For applications with lots of active connections it is useful to pipe the results to grepto find only the threads currently executing or locked.

对于具有大量活动连接的应用程序,将结果通过管道传送grep到仅查找当前正在执行或锁定的线程是很有用的。

db2 list applications for database {dbName} show detail | grep -i "executing"

and

db2 list applications for database {dbName} show detail | grep -i "lock"

回答by Fuangwith S.

CLP:

中电:

db2 list applications

QUERY:

询问:

SELECT * FROM SYSIBM.APPLICATIONS
SELECT * FROM SYSIBM.SESSION

回答by Tamas Czinege

The command you seek is:

你寻求的命令是:

LIST APPLICATIONS

In the DB2 Command Center there is a tool which list the applications and displays them in a human friendly format as well.

在 DB2 Command Center 中,有一个工具可以列出应用程序并以人性化的格式显示它们。