Here's a good starting point. If you want I also have a unix shell script
driver for this that does a little more formatting.
set feedback off
set heading off
set timing off
set time off
set echo off
set term off
set pagesize 256
set space 1
column username format a8
column machine format a8
column terminal format a8
column logon_time format a18
column "SESSION ID" format a11
column module heading FORM format a20
spool /tmp/logged_in.lst
select username,
substr(machine,1,8),
substr(terminal,1,8),
to_char(logon_time,'DD-MON-YY HH:MI am') logon_time,
''''||sid||','||serial#||'''' "SESSION ID",
nvl(substr(module,1,20), 'Character session')
from v$session
where type = 'USER' and username != 'SYSTEM'
and username is not null and status != 'KILLED';
spool off
prompt
prompt
spool /tmp/logged_in2.lst
select 'Total Users currently logged in'||' '||count(*) from v$session
where type = 'USER'
and username != 'SYSTEM';
spool off
spool /tmp/logged_in3.lst
select 'GUI users logged in: '||' '||count(*)
from v$session
where machine != ('mufasa')
and username != 'SYSTEM';
spool off
exit
Joe LaCascio
Oracle DBA, Unix Administrator
Wheaton College, MA 508.286.3405
On Thu, 11 Apr 2002, Nguyen, David M wrote:
> How do I check who is currently logging into database, where he is accessing
> from and what he is doing?
>
> Thanks,
> David
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Nguyen, David M
> INET: [EMAIL PROTECTED]
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Joe LaCascio
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).