Informix

 View Only
  • 1.  Find

    Posted Thu February 29, 2024 02:08 PM
    Edited by Indika Jinadasa Thu February 29, 2024 02:23 PM

    Dear All,

    Can we get the following details from a TABLE in the DB ? 

    1. USER who is accessing the table

    2. The HOSTNAME of the program where the table is accessing

    3. PROGRAM NAME  (e.g $INFORMIIXDR/bin/dbacces ) 

    4. SQL TYPE ( e.g INSERT/UPDATE/DELETE/SELECT etc ) 

    Thanks!

    Best Regards,

    Indika 



    ------------------------------
    Indika Jinadasa
    ------------------------------



  • 2.  RE: Find

    IBM Champion
    Posted Thu February 29, 2024 03:27 PM

    Indika:

    You could pipe onstat -g ses 0 into more or less and search for the table name. Alternatively in sysmaster:

    > select partnum from systabnames where dbsname = 'art' and tabname = 'extents';

       partnum  

      11534341

    1 row(s) retrieved.

    > select * from sysopendb where odb_dbname = 'art';

    odb_sessionid   756
    odb_odbno       0
    odb_dbname      art
    odb_iscurrent   Y
    odb_islog       Y
    odb_isansi      N
    odb_isolation   2
    odb_usrtype     D
    odb_prior       5
    odb_tmstamp     1
    odb_lc_collate   
    odb_dbflags     16384

    1 row(s) retrieved.

    > select * from syssessions where sid = 756; 

    sid         756
    username    art
    uid         1000
    pid         162778
    hostname    Elezar-II
    tty         /dev/pts/5
    connected   1709237490
    feprogram   /home/art/bin/sqlcmd
    pooladdr    1172414528
    is_wlatch   0
    is_wlock    0
    is_wbuff    0
    is_wckpt    0
    is_wlogbuf  0
    is_wtrans   0
    is_monitor  0
    is_incrit   0
    state       524289


    > select * from syssqexplain where sqx_sessionid = 756;



    sqx_sessionid     756
    sqx_sdbno         0
    sqx_iscurrent     Y
    sqx_executions    0
    sqx_cumtime       0.49264663065
    sqx_bufreads      101365
    sqx_pagereads     16
    sqx_bufwrites     0
    sqx_pagewrites    0
    sqx_totsorts      0
    sqx_dsksorts      0
    sqx_sortspmax     -1
    sqx_conbno        0
    sqx_ismain        Y
    sqx_selflag       SQ_SELECT
    sqx_estcost       41419
    sqx_estrows       876797
    sqx_seqscan       1
    sqx_srtscan       0
    sqx_autoindex     0
    sqx_index         0
    sqx_remsql        0
    sqx_mrgjoin       0
    sqx_dynhashjoin   0
    sqx_keyonly       0
    sqx_tempfile      0
    sqx_tempview      0
    sqx_secthreads    0
    sqx_sqlstatement  SELECT * FROM extents

    1 row(s) retrieved.


    1 row(s) retrieved.




    ------------------------------
    Art S. Kagel, President and Principal Consultant
    ASK Database Management Corp.
    www.askdbmgt.com
    ------------------------------