I'm trying to setup tracing by user_id on login. Here is the trigger,
yet it seems to ignore the the IF statement and enables tracing for
ALL logins any ideas?
CREATE OR REPLACE TRIGGER ENABLE_TRACE_ON_DTRAQ AFTER logon ON
DATABASE
DECLARE
p_session_user varchar2(64);
p_session_sid varchar2(64);
p_session_serial varchar2(64);
p_database_name varchar2(8);
string_1 varchar2(2000);
BEGIN
/* Set Variables*/
SELECT UPPER(SYS_CONTEXT('USERENV', 'SESSION_USER')) INTO
p_session_user FROM DUAL;
SELECT UPPER(SYS_CONTEXT('USERENV', 'SID')) INTO p_session_sid FROM
DUAL;
SELECT serial# INTO p_session_serial FROM v$session WHERE SID =
p_session_sid;
SELECT sys_context('USERENV', 'DB_NAME') INTO p_database_name FROM
dual;
string_1 := 'alter session set TRACEFILE_IDENTIFIER = ''trace_'||
p_session_user||'''';
EXECUTE IMMEDIATE string_1;
IF (p_session_user = 'DTRAQ') THEN
DBMS_MONITOR.SESSION_TRACE_ENABLE
(p_session_sid,p_session_serial,TRUE,TRUE);
END IF;
END;
/
THanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---