Tuesday, 12 July 2011

Oracle - Check Users Connected to Database

To find how many users are on the database issue the following:
SQL> SELECT username
FROM v$session;

Show what users are running

SQL> SELECT a.sid
, a.serial#
, a.username
, b.sql_text
FROM v$session a
, v$sqlarea b
WHERE a.sql_address=b.address;
You can add the following to the script if you have a lot of users and want to find one specific users code, but you will need to remove a.username from the above script:
AND a.username = '<username>';

No comments:

Post a Comment

Please feel free to leave a comment