Re: What stupid mistake am I making with this onlogin trigger?

  • From: Kurt Franke <Kurt-Franke@xxxxxx>
  • To: Jay.Miller@xxxxxxxxxxxxxxxx, oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 26 Feb 2008 12:16:12 +0100

code addings inline

> 
> After going back an forth on this for a while today I figured a few more sets 
> of eyes couldn't hurt.
> 
> I need to track connections from a specific module (not SQL*Plus but that was 
> easiest for testing purposes).  This trigger compiles but does not create any 
> rows.  The insert statement works if run from a sql*plus prompt.  I'm sure 
> I'm missing something really obvious here...
> 
> Does the onlogin trigger possibly execute as the user logging in as opposed 
> to as sys?
> 
> Trigger created:
> SQL> create or replace trigger sys.trace_php_onlogin after  logon on database
DECLARE
  PRAGMA AUTONOMOUS_TRANSACTION;
begin
   insert into wsidba.php_logins
    select sid,username,module
      from sys.v_$session
      where sid = (select unique(sid) from v$mystat)
          and upper(module) like '%SQL%';
   commit;
EXCEPTION
  WHEN OTHERS THEN
    -- must close the autonomous transaction to get the correct error message 
outside
    ROLLBACK;
    RAISE;
end;
/
> 
> Trigger created.
> 
> 
> Doesn't enter any data to table:
> usnjc01urp001:/services/home/oracle<lass> $ sqlplus wsidba
> 
...
> 
> TIA,
> Jay Miller
> 

regards

kf



--
//www.freelists.org/webpage/oracle-l


Other related posts: