Sunday 30 January 2011

List applications connected to the database (IBM DB2)

List applications connected to the testdb database
list applications for database testdb show detail

List the top heavy applications in details , for the currently connected
database on the currently connected partition

SELECT t2.APPL_NAME,
t2.APPL_ID,
t1.AGENT_ID,
t2.PRIMARY_AUTH_ID,
((t1.AGENT_USR_CPU_TIME_S + t1.AGENT_SYS_CPU_TIME_S)*1000000 +
t1.AGENT_USR_CPU_TIME_MS + t1.AGENT_SYS_CPU_TIME_MS) AS TOTAL_CPU_TIME,
(t1.AGENT_USR_CPU_TIME_S*1000000 + t1.AGENT_USR_CPU_TIME_MS) AS AGENT_USR_CPU_TIME,
(t1.AGENT_SYS_CPU_TIME_S*1000000 + t1.AGENT_SYS_CPU_TIME_MS) AS AGENT_SYS_CPU_TIME
FROM TABLE( SNAP_GET_APPL( '', -1 )) as t1,
TABLE( SNAP_GET_APPL_INFO( '', -1 )) as t2
WHERE t1.AGENT_ID = t2.AGENT_ID
ORDER BY TOTAL_CPU_TIME DESC, t2.APPL_NAME;

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.