Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> SESSION INFO VIA AUDITING + LOGON TRIGGERS

SESSION INFO VIA AUDITING + LOGON TRIGGERS

From: AMIT <kumar_929_at_yahoo.co.uk>
Date: 16 Mar 2004 03:27:25 -0800
Message-ID: <6f94b59f.0403160327.38b3bf87@posting.google.com>


Hi,

I am using the following logon trigger to store the session information into a table "client_info"
When ever the user logon , his session information stores in the client_info table.
And when the session logoff its information will be deleted from the table client_inf via Logoff trigger.

But the problem is that, the information will not be deleted from the client info table , if the user logoff abnormally from the database. How to overcome this issue?
I heard that if we use views instead of the table &#8220;client_info&#8221;, which I am using, we could manage this issue.
Could someone explain how should we do that?

I am using auditing + logon and logoff trigger in order manage the session info.  

Regards

Amit

CREATE TABLE CLIENT_INFO(session_id number,client_name VARCHAR2(30),sid number,
serial# number,workstation varchar2(30), host_name varchar2(30),logon_time date, Description varchar2(4000));

CREATE OR REPLACE TRIGGER trg_client_info AFTER LOGON ON DATABASE    BEGIN execute immediate

'INSERT INTO client_info(session_id,client_name,sid, serial#,workstation,host_name,logon_time , description) select a.sessionid,a.username , b.sid, b.serial#, a.os_username, b.machine,b.logon_time,a.comment_text from user_Audit_trail a , V$session b
where a.sessionid = b.audsid
and a.username = b.username
and a.sessionid=userenv(''sessionid'')';

  commit;

  END;
/

CREATE OR REPLACE TRIGGER logoff_session

    BEFORE LOGOFF ON DATABASE BEGIN DELETE from client_info where session_id = userenv('sessionid');

commit;

END;
/ Received on Tue Mar 16 2004 - 05:27:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US