Db2

 View Only
  • 1.  connect id for statement

    Posted Tue June 30, 2020 01:01 PM
    I have a strange request from a customer
    we are monitoring sql from mon_get_pkg_cache_stmt which gives a summary overview for a statement
    the customer asked if it is possible the connect_id that executed a statement or an identification to could inform us who initiated this query
    I know  that these table functions (MON_GET..) usually do not provide this
    the are present in mon_get_activity or similar, but it might be that when running this monitor the agent/appl is not present anymore
    would there be another possibility - maybe event monitor that could give a relation between stmt and agent
    thanks for all hints..

    ------------------------------
    Thank for all update/help
    Best Regards, Guy Przytula
    ------------------------------

    #Db2


  • 2.  RE: connect id for statement

    Posted Wed July 01, 2020 04:02 AM
    Hello Guy,

    To me it seems you could use mon_get_activity to capture both the statement and the connection information by utilizing the fields

    CLIENT_ACCTNG
    CLIENT_APPLNAME
    CLIENT_USERID
    CLIENT_WRKSTNNAME.

    If that does not deliver enough info you could consider joining it with mon_get_connection which has more fields. 

    The properties mentioned above can be set on the client and on the JDBC connection

    ------------------------------
    Kind regards

    Guido Verbraak
    IBM Data & AI Lab Services
    ------------------------------



  • 3.  RE: connect id for statement

    Posted Tue July 14, 2020 08:12 AM
    thanks for the update
    but mon_get_activity is only having about current active activity, I did this join and see a limited nbr of sql of active sessions/activity
    It is possible that running the sql from package cache the activity/connection is not existing anymore, so the join would not return this data

    ------------------------------
    Thanks for all answers
    Best Regards,
    Guy Przytula
    ------------------------------