Db2 – Can scripting be done on DB2 Connect instance


I need to get the number of connections passing through connect server for 1 week.

  • Can we write a script to get the details?

  • Can we only pull the data manually?

  • Is there any way to script it?

I am not authorized to use cron on the server.

Best Answer

As you mentioned cron, I'm assuming your Db2-Connect runs on some flavour of Unix/Linux. For those environments scripting in ksh or bash is ideal for Db2 products because they are very script friendly.

Check also if such work would be redundant, as some sites have host based (z/os or i-series) methods for monitoring activity from remote Db2-connect servers.

See also this link

Your options include:

  • Get access to cron for the Db2-connect instance-owner to schedule the script

  • Use an alternative enterprise scheduler product for scheduling, if available

  • Use a nohup job that runs as the Db2-connect instance-owner for a week, which uses sleep , and wakes up periodically to pull the data.

The script can attach to the instance and use list dcs applications show detail (or variations of that command) appending the output to a log file that you parse later, and detach.

There's also variations of get snapshot for all dcs applications or get snapshot for all dcs databases depending on your requirements.

The monitoring table functions may help to examine activity depending on your version of Db2-connect.