DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Logon Trigger question

Hybrid View

  1. #1
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586

    Logon Trigger question

    I used this trigger in 8i to do some tracing on a unix db and it has wroked but for some reason in 9i it doesnt work.

    I wanted to trace a specific user's whose session id I cannot figure out due to to the fact that it the process connects and disconnects often..

    any clues?

    CREATE OR REPLACE TRIGGER LOG_TRIGGER AFTER
    LOGON ON DATABASE begin
    if user = 'OPS$KFOO' then
    execute immediate 'alter session set sql_Trace=true';
    end if;
    end;
    "High Salaries = Happiness = Project Success."

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Any errors? (check your alert.log)
    Jeff Hunter

  3. #3
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586
    marist, i didnt see any error messages...do you have an alternative method of tracing user sessions?
    "High Salaries = Happiness = Project Success."

  4. #4
    Join Date
    Sep 2002
    Location
    England
    Posts
    7,334
    this works for me
    Code:
    create or replace trigger login_trigger after logon on database
    declare
    x varchar2(20);
    y number;
    z number;
    begin
    select sys_context('USERENV','SESSION_USER') into x from dual;
    if x = 'XXX' THEN
    select sid into y from v$mystat where rownum < 2;
    select serial# into z from v$session where sid = y;
    dbms_system.set_ev(y,z,10046,4,'');
    end if;
    end;
    /

  5. #5
    Join Date
    Aug 2000
    Location
    Chicago IL
    Posts
    586
    Thanks davy...
    "High Salaries = Happiness = Project Success."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width