Users connected to a DB
Posted in 2006
Topics: General Discussion
Hi all
onstat -uor
querying sysmaster:syssessions
gives me a list of connected users to a server.
What if I want the list of users connected to a specific database?
onstat -g sql
________________________________
=
"=D0=E1=ED=F4=E5=EB=DE=F2 =CC=DC=E3=EA=EF=F2" =
<pas@logifer.gr> =
Sent by: =
To
ids-bounces@iiug. ids@iiug.org =
org =
cc
=
Subj=
ect
26/09/2006 10:47 Users connected to a DB [7541] =
=
=
Please respond to =
ids@iiug.org =
=
=
Hi all
onstat -uor
querying sysmaster:syssessions
gives me a list of connected users to a server.
What if I want the list of users connected to a specific database?
***********************************************************************=
********
Forum Note: Use "Reply" to post a response in the discussion forum.
=
I have a little script that provides that information and the session ID for
each connection. If you do not supply a database name on the command line, it
returns information on all databases in the instance. If you want to get
information for just one database, enter that after the script (e.g.,
dbwho.ksh mydatabase).
---------------------------------------------------
#!/usr/bin/ksh
# dbwho.ksh
if [ "$#" -gt 0 ]
then
export WHERE_CLAUSE="and odb_dbname='${1}'"
else
export WHERE_CLAUSE=""
fi
export WORKFILE=/tmp/dbwho.$$
echo " set isolation to dirty read;
unload to $WORKFILE delimiter ' '
select odb_dbname, username, odb_sessionid
from sysopendb, syssessions
where syssessions.sid = sysopendb.odb_sessionid
${WHERE_CLAUSE}" \\\\
| dbaccess sysmaster > /dev/null 2>&1
sort $WORKFILE
rm -f $WORKFILE
---------------------------------------------------
Rob Schmitz
Embarq Data Management
rob.b.schmitz@embarq.com
http://www.embarq.com/
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of ÐáíôåëÞò
ÌÜãêïò
Sent: Tuesday, September 26, 2006 3:48 AM
To: ids@iiug.org
Subject: Users connected to a DB [7541]
Hi all
onstat -uor
querying sysmaster:syssessions
gives me a list of connected users to a server.
What if I want the list of users connected to a specific database?
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
Bob, package it into a shell archive with a readme file and upload it to the
IIUG Repository (see the iiug web site for instructions - it's easy).
Art S. Kagel
----- Original Message -----
From: Rob B Schmitz <ids@iiug.org>
At: 9/26 8:39:43
I have a little script that provides that information and the session ID for
each connection. If you do not supply a database name on the command line, it
returns information on all databases in the instance. If you want to get
information for just one database, enter that after the script (e.g.,
dbwho.ksh mydatabase).
---------------------------------------------------
#!/usr/bin/ksh
# dbwho.ksh
if [ "$#" -gt 0 ]
then
export WHERE_CLAUSE="and odb_dbname='${1}'"
else
export WHERE_CLAUSE=""
fi
export WORKFILE=/tmp/dbwho.$$
echo " set isolation to dirty read;
unload to $WORKFILE delimiter ' '
select odb_dbname, username, odb_sessionid
from sysopendb, syssessions
where syssessions.sid = sysopendb.odb_sessionid
${WHERE_CLAUSE}" \\\\
| dbaccess sysmaster > /dev/null 2>&1
sort $WORKFILE
rm -f $WORKFILE
---------------------------------------------------
Rob Schmitz
Embarq Data Management
rob.b.schmitz@embarq.com
http://www.embarq.com/
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
6JPY±
ÆÜ ê ò
Sent: Tuesday, September 26, 2006 3:48 AM
To: ids@iiug.org
Subject: Users connected to a DB [7541]
Hi all
onstat -uor
querying sysmaster:syssessions
gives me a list of connected users to a server.
What if I want the list of users connected to a specific database?
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.