Enable Tracing For A Particular Program
Hi,
I am using the following LOGON trigger, in order to get the SQL TRACING enable for the session, which is currently running EXCEL.EXE Program.
But in this way, the SQL TRACING for other sessions were also enable, when they logon to the database using other program rather than EXCEL.
Because, we only need to enable the SQL TRACING, for the session which is running the EXCEL PROGRAM, not for other programs/sessions.
I am looking forward to an advice .
Chuck
CREATE OR REPLACE TRIGGER testtrg
AFTER LOGON ON DATABASE
DECLARE
v_sid number;
v_serial# number;
v_username VARCHAR2(30);
v_program VARCHAR2(64);
v_time date;
BEGIN
select username,sid,serial#,program,logon_time into v_username,v_sid,v_serial#,v_program,
v_time from v$session s
where sys_context('userenv','SESSIONID')=s.audsid and s.program='EXCEL.EXE';
if (v_program = 'EXCEL.EXE') then
execute immediate
'exec dbms_system.set_sql_trace_in_session(v_sid,v_serial#,true)' ;
END IF;
else
null;
END;
/
ENABLE SQL TRACING FOR A PARTICULAR SESSION
Hi Everyone,
The logon trigger which I posted earlier has been compiled succesfully.
The problem is that it enables SQL TRACING for all the session.
However I wanted to enable sql tracing For a particular session which is using EXCEL.
WHAT PART OF CODE I CHANGE IN ORDER TO ENABLE SQL TRACING FOR THAT PARTICULAR SESSION WHICH IS USING EXXCEL.
Only comments from serious people.
Thanks
Chuck
Re: ENABLE SQL TRACING FOR A PARTICULAR SESSION
Quote:
Originally posted by Chuck
The logon trigger which I posted earlier has been compiled succesfully.
No it hasn't. There's an obvious syntax error that prevents compilation.