How to find all open/active connections in DB2 (8.x) – This article will take you through the common SQL errors that you might encounter while working with sql, db2, db2. The wrong arrangement of keywords will certainly cause an error, but wrongly arranged commands may also be an issue. SQL keyword errors occur when one of the words that the SQL query language reserves for its commands and clauses is misspelled. If the user wants to resolve all these reported errors, without finding the original one, what started as a simple typo, becomes a much bigger problem.
SQL Problem :
I’m currently working with Db2 Enterprise Server V 8.2 with FixPak 10
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?
Solution :
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 grep
to find only the threads currently executing or locked.
db2 list applications for database {dbName} show detail | grep -i "executing"
and
db2 list applications for database {dbName} show detail | grep -i "lock"
CLP:
db2 list applications
QUERY:
SELECT * FROM SYSIBM.APPLICATIONS
SELECT * FROM SYSIBM.SESSION
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.
Maybe you are searching for below query.
SELECT
AUTHID,
APPL_NAME,
CLIENT_NNAME,
AGENT_ID,
APPL_ID,
APPL_STATUS
FROM
SYSIBMADM.APPLICATIONS
Finding SQL syntax errors can be complicated, but there are some tips on how to make it a bit easier. Using the aforementioned Error List helps in a great way. It allows the user to check for errors while still writing the project, and avoid later searching through thousands lines of code.