Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> ENABLE TRACING FOR A SELECTED 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 .
David
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;
/
Received on Mon Mar 15 2004 - 10:50:21 CST