Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to get client machine name and client osuser name

User_DLBYEDec 25 2012 — edited Dec 25 2012
hello everybody,
the trigger shown below is working fine.But i want to get client machine name and client osuser name in the output of the same trigger shown below,how can i achieve this in the same trigger?any help higly appreciated .
thanks and regards.

trigger :
------------
CREATE TABLE logonaudit
(
user_id VARCHAR2(30),
sess_id NUMBER(10),
logon_time DATE,
host VARCHAR2(20));

Table created.

CREATE OR REPLACE
TRIGGER logon_audit
AFTER LOGON
ON DATABASE
DECLARE
V_program varchar2(120);
BEGIN
SELECT UPPER(program)
INTO v_program
FROM v$session
WHERE audsid = sys_context('USERENV','SESSIONID');
if (upper(v_program) like '%TOAD%' or upper(v_program) like '%SQLPLUS%')
then
INSERT
INTO logonaudit
VALUES(
user,
sys_context('userenv','sessionid'),
sysdate,
sys_context('userenv','host')
);
end if;
END;

the output showing sessionid,date,db user name,host as local server machine name.but i want client machine name and client osuser names as u all know clients login to database from their machines.how can i achieve this? any help highly appreciated.

Edited by: 938946 on Dec 25, 2012 12:15 AM
This post has been answered by jeneesh on Dec 25 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 22 2013
Added on Dec 25 2012
9 comments
21,850 views