Database Administration (MOSC)

MOSC Banner

pl/sql loop to enable user tracing

edited Sep 26, 2013 10:01PM in Database Administration (MOSC) 9 commentsAnswered
I am trying to use a loop to enable tracing of specific users with dbms_moniter and a pl/sql loop.  the procedure will create and compile but when I try to execute it it fails.
create or replace procedure trace_session
is
begin
 for rec in ( select sid, serial#
                    from   v$session
                    where  username in ('UserA','UserB')
  loop
    execute immediate 'dbms_monitor.session_trace_enable('||rec.sid||','||rec.serial#||')';
  end loop;
end;



It will fail with sys.trace_session invalid sql.

Is is better to use dbms_system.set_ev  instead?

thanks

any help is appreicated.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center