RE: logon trigger with machine condition

  • From: "Leonard, George" <GLeonard@xxxxxxxxxxxxx>
  • To: <jsb@xxxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 2 Feb 2005 14:36:13 +0200

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@xxxxxxxxxxxxx
=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@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of jsb@xxxxxxxxxxxx
Sent: 01 February 2005 21:35 PM
To: oracle-l@xxxxxxxxxxxxx
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
--
//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=
=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                              ________________________________
--
//www.freelists.org/webpage/oracle-l

Other related posts: