Indika:
I'm not sure exactly what you are asking, but if Mike's interpretation is correct, then so is his response. In my case I was the only users at the time so it was easy and I knew what database and what table and there was only one session that I had to examine. In the more general case, there will be dozens or hundreds of users connected to your specific database. You will know what table you are interested in, however. So, you could:
select sqx_serssionid from syssqexplain where sqx_sqlstatement matches '*my_table*';
To see what sessions are currently accessing that specific table. Then query syssessions for each of those sessions to get the details of host, user, and application name. There are more details about the session in syssesprof, sysrstcb, and sysscblst.
Art
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com------------------------------
Original Message:
Sent: Thu February 29, 2024 10:09 PM
From: Indika Jinadasa
Subject: Find table accessing information
Thank you, Mike and Art,,
How do you map PARTMUM from sysmaster and sysopndb to get only the specified table information? In your case 'extents' ?
Thanks !
Best Regards,
Indika
------------------------------
Indika Jinadasa
Original Message:
Sent: Thu February 29, 2024 03:29 PM
From: Art Kagel
Subject: Find table accessing information
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
------------------------------
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
Original Message:
Sent: Thu February 29, 2024 02:25 PM
From: Indika Jinadasa
Subject: Find table accessing information
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
------------------------------