RE: Q:How to find list user sessions with database
Posted in 1998
CONWAY Graham wrote:
Hi,
>
> Please excuse me if this is obvious.
>
> Does anyone have a simple way (sysmaster query or onstat option) of =
listing
> the sessions on a server and the database they are currently connected =
to.
>
> I have a script that does it by going through the onstat -u output and
> calling onstat -g sess <sessid> for each session, but there must be a
> quicker way.
>
> Thanks,
>
> Graham Conway
> OAMI Alicante
>
Graham,
If all you want is session-id and database, just use "onstat -g sql". =
Its output looks like:
$ onstat -g sql
INFORMIX-OnLine Version 7.14.UD2X7 -- On-Line -- Up 03:06:34 -- 413336 =
Kbytes
Sess SQL Current Iso Lock SQL ISAM F.E.
Id Stmt type Database Lvl Mode ERR ERR Vers
109 UPDATE mdss CR Wait 0 0 7.12
108 SELECT INTO mdss DR Wait 0 0 6.02
107 SELECT mdss CR Wait 0 0 6.02
87 - mdss CR Not Wait 0 0 7.14
65 INSERT mdss CR Wait 0 0 7.12
64 - mdss CR Not Wait 0 0 6.02
55 - mdss CR Wait 0 0 7.12
11 - - - Not Wait 0 0 7.14
Hope that helps
RET
+------------------------------------------+
| Richard Thomas |
| DBA - Marketing Information Systems |
| Optus IT |
| email: richard_thomas@yes.optus.com.au |
| Ph: +61 2 9342 7188 |
| "My opinions are my opinions" |
+------------------------------------------+