!hello

If u want to trap and find out the users who are accessing database by opening more then one session here it's help U. (TO FIND OUT THEM)


akram>desc more_session;
Name Null? Type
----------------------------- -------- --------------------
SID NUMBER
SERIAL# NUMBER
USER# NUMBER
USERNAME VARCHAR2(30)
STATUS VARCHAR2(8)
SERVER VARCHAR2(9)
OSUSER VARCHAR2(30)
MACHINE VARCHAR2(64)
TERMINAL VARCHAR2(16)
PROGRAM VARCHAR2(64)
LOGON_TIME VARCHAR2(30)

Trigger code:-
---------------

create or replace trigger more_session
after logon on database

declare

i v$session%rowtype;
begin
select sid,serial#,user#,username,status,server,osuser,machine,terminal,program,logon_time
into
i.sid,i.serial#,i.user#,i.username,i.status,i.server,i.osuser,i.machine,i.terminal,i.program,i.logon _time
from v$session where username =(select username from v$session group by username having count(username)>1)
and logon_time=(select max(logon_time) from v$session );

insert into more_session values ( i.sid, i.serial#,i.user#,
i.username,
i.status,
i.server,
i.osuser,
i.machine,
i.terminal,
i.program,
to_char(i.logon_time,'DD-MON-YYYY:HH24:MI:SS PM') ) ;
exception
when no_Data_found then
null;
end ;



by
akram_tri@yahoo.co.in