Link to home
Start Free TrialLog in
Avatar of hussainkhan22
hussainkhan22Flag for United States of America

asked on

Oracle database use

Hey how do I find if anyone accessing oracle 11g database on linux. I mean which users are accessing the database and what are there doing. I really appreciate your help. Thanks in advance
Avatar of anumoses
anumoses
Flag of United States of America image

V$Session
where status = 'ACTIVE'
select username,sid, status,program,server,type,serial#
from v$session order by username
where status = 'ACTIVE'

Try this instead of select * from
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

To get 'what' they are doing and when, you need to turn on auditing.

V$session will tell you who is currently logged in but not a history of who was logged in over time.

You can also look in the listener log file to see who has been connecting.
I find that having status='ACTIVE' actually filters out some users who are online but are currently not running anything.

This is what I use:

select a.username, b.sql_text, a.status
from v$session a, v$sqlarea b
where a.sql_address = b.address(+)
and a.username is not null;
ASKER CERTIFIED SOLUTION
Avatar of anumoses
anumoses
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
turn on auditting to get a historical list of activity

the results will be in DBA_AUDIT_TRAIL
I sometimes use this also

select sid, serial#, username, a.status
  from v$session a, v$sqlarea b
 where b.hash_value = a.prev_hash_value
 and a.username is not null;