Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: logon trigger with machine condition
Hi there
Have a look at the following=20
=09 , sys_context('USERENV',
'IP_ADDRESS')
=09 , Sys_context('USERENV', 'HOST')
=09 , Sys_context('USERENV',
'OS_USER')
=09 , Sys_context('USERENV',
'TERMINAL')
that will give you the host name.
I would suggest not hard coding the host name you want to monitor. Rather add it as a record in a table. That way you can add and removed records at will.
George
=20________________________________________________
George Leonard
Oracle Database Administrator
New Dawn Technologies @ Wesbank
E-mail:gleonard_at_wesbank.co.za
=20
You Have The Obligation to Inform One Honestly of the risk, And As a
Person
You Are Committed to Educate Yourself to the Total Risk In Any Activity!
Once Informed & Totally Aware of the Risk,
Every Fool Has the Right to Kill or Injure Themselves as They See Fit!
=20
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of jsb_at_digistar.com
Sent: 01 February 2005 21:35 PM
To: oracle-l_at_freelists.org
Subject: logon trigger with machine condition
I'm looking for a way to trace a session on logon with the condition
that
it be from a particular host. Wolfgang brought up a good point about
logon to a particular schema but in this case I need a database-wide
trigger.
I'm looking to do something like this below, but it does not work:
CREATE OR REPLACE TRIGGER trace_a_session
=20 AFTER LOGON ON DATABASE
BEGIN
=20 IF USER LIKE 'USER'
=20 THEN
=20 IF HOST LIKE 'SOMEHOST.DOMAIN.COM'
=20 THEN
=20 EXECUTE IMMEDIATE 'alter session set events ''10046 trace name=
context forever, level 12''';
=20 END IF;
=20 END IF;
END;
/
There apparently is no PL/SQL HOST function which is what I need, or a
way
to do it via a nested select and variables. I intend to purchase a book
or two after work tonight but I need some help now if anyone has dealt
with this situation before.
regards,
Jason
-- http://www.freelists.org/webpage/oracle-l _________________________________________________________________________= __________________________ The views expressed in this email are, unless otherwise stated, those of = the author and not those of the FirstRand Banking Group an Authorised Financial Service Provider o= r its management. The information in this e-mail is confidential and is intended solely for=Received on Wed Feb 02 2005 - 07:39:22 CST
=20the addressee.
Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribut= ion or any action taken or=20 omitted in reliance on this, is prohibited and may be unlawful. Whilst all reasonable steps are taken to ensure the accuracy and integrit= y of information and data=20 transmitted electronically and to preserve the confidentiality thereof, n= o liability or=20 responsibility whatsoever is accepted if information or data is, for what= ever reason, corrupted=20 or does not reach its intended destination.
=20 ________________________________
-- http://www.freelists.org/webpage/oracle-l