How about using sysopendb and sysrstcb.
select odb_sessionid, odb_dbname, odb_iscurrent, username
from sysopendb, sysrstcb
where odb_sessionid = sid
and odb_iscurrent = 'Y'
Remember to read your sysmaster.sql file for all the possibilities.
Steve Berg
spb@nb.com
On Wed, 15 Jul 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
>