db2_trace_connection - Trace a DB2 connection
db2_trace_connection -dbname <database> [ -user <userid> ] [ -agent <agent id> ] [ -time <wait time> ] [ -repeat ]
db2_trace_connection -dbname FOOBAR db2_trace_connection -dbname FOOBAR -user myuserid db2_trace_connection -dbname FOOBAR -agent 789
db2_trace_connection script is used to trace a DB2 connection. It runs two application snapshots in close succession, then shows application activity in between the snapshots.
When invoked with only a
-dbname parameter, it displays a list of users connected to the database. When the
-user parameter is added, it displays a list of database connections for that userid. The application snapshot is only collected when the
-agent parameter is specified.
This mandatory option specifies the database name. This must be a database name or alias defined in the local database directory.
If no other options are specified, the script will display a list of connected users.
This option specifies a userid for which connections should be listed. It is ignored in the presence of the
-agent option. When
-user is specified, the script will display a list of active connections for the application.
This option specifies the agent id to be traced.
This option specifies the delay between snapshots in seconds. The default is 5 seconds.
This option causes
db2_trace_connection to keep getting snapshots every few seconds and to display the incremental changes.
As it stands, this script only runs locally, i.e. on the database server. If you have SYSMON privilege and can map from database alias to instance name (based on the node directory), you can make it work remotely as well.