Informix

Informix

Connect with Db2, Informix, Netezza, open source, and other data experts to gain value from your data, share insights, and solve problems.

 View Only
Expand all | Collapse all

How to get open cursors by session

  • 1.  How to get open cursors by session

    Posted Tue February 25, 2020 01:43 PM
    Hi,

    I was investigating about how to get current opened (active) cursors in server. Preferably, getting a SQL query to sysmaster will be the best but also onstat command would work.

    Reason for this question is to make a quality assurance of a program and we're not sure this program closes cursors after consuming.

    I've been looking to onstat -g stm and also quering to syssqlcurses or sysconblock, but as this are undocumented tables I'm not sure if results I get are really "open cursors"

    Thanks all comunity.

    ------------------------------
    Sistemas Federacio Farmaceutica
    ------------------------------

    #Informix


  • 2.  RE: How to get open cursors by session

    Posted Tue February 25, 2020 03:39 PM
    Check out the syssdblock table in sysmaster. The sdb_name column contains the cursor name which you should be able to relate back to the application:

    > select * from syssdblock;

    sdb_sessionid       71
    sdb_sdbno           0
    sdb_iscurrent       Y
    sdb_name            slctcur
    sdb_id              0
    sdb_flags           65569
    sdb_executions      0
    sdb_cumtime         0.00
    sdb_bufreads        0
    sdb_pagereads       0
    sdb_bufwrites       0
    sdb_pagewrites      0
    sdb_totsorts        0
    sdb_dsksorts        0
    sdb_sortspmax       -1
    sdb_cb              1184452664
    sdb_cblist          1181604616
    sdb_heap            1199567928
    sdb_partnum         -1
    sdb_isfd            0
    sdb_recnum          0
    sdb_sqerrno         0
    sdb_sqiserrno       0
    sdb_sqoffset        0
    sdb_errstr           
    sdb_ntables         3
    sdb_sqttab          1200656936
    sdb_asynch_sqerrno  0
    sdb_asynch_sqiserr  0
    sdb_pool            0
    sdb_mutex           0
    sdb_tgcblist        0
    sdb_pdq_prio_req    0
    sdb_pdq_priority    0
    sdb_max_scans       0


    Art S. Kagel, President and Principal Consultant
    ASK Database Management


    Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference.  Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves.