--traceUser.sql - Trace Current User
--SAMPLE OUTPUT Go to Script 
-------------------------------------------------
--SQL > @traceUser
--Enter User to create trace on: SCTBXS
--TURNON
-------------------------------------------------
--exec sys.dbms_system.set_ev(11,5,10046,12,'');
--TURNOFF
-------------------------------------------------
--exec sys.dbms_system.set_ev(11,5,10046,0,'');
--SCRIPT Go to Top 

--============= inicio ======================================================================
set verify off
SET LINESIZE 132
SET PAGESIZE 100
COL VALUES FORMAT A60
PROMPT
PROMPT
PROMPT LOG DE TRACE SERA GERADO EM 
SELECT VALUE FROM V$PARAMETER WHERE NAME='user_dump_dest'
/
ACCEPT tuser PROMPT 'Enter User to create trace on: '
PROMPT
PROMPT 'ABAIXO SEQUENCIA PARA ATIVAR O TRACE'
PROMPT
select 'exec sys.dbms_system.set_ev('||sid||','||serial#||','||'10046,12,'''||''');' TurnOn
from V$SESSION where username=UPPER('&tuser') and status='ACTIVE';
PROMPT 'ABAIXO SEQUENCIA PARA DESATIVAR O TRACE'
PROMPT
select 'exec sys.dbms_system.set_ev('||sid||','||serial#||','||'10046,0,'''||''');' TurnOff
from V$SESSION where username=UPPER('&tuser') and status='ACTIVE';

--============= final ========================================================================

hostgator