Friday, March 10, 2006

Tracing

Another SQL script:

set echo off
set heading off
column trace new_val tracefilename
set autotrace off
select c.value '/' d.instance_name '_ora_' a.spid '.trc' trace
from v$process a, v$session b, v$parameter c, v$instance d where a.addr = b.paddr
and b.audsid = userenv('sessionid') and c.name = 'user_dump_dest'
/
set heading on
set echo on
alter session set events '10046 trace name context forever, level 12'
/
set timing on
set autotrace on
set echo off
prompt set autotrace traceonly
prompt if do not want rows returned


I have the file name set as an environment parameter in unix:
export traceme=/sql/traceme

I just run

SQL> @$traceme

This is a modification on the getrace.sql from Tom Kyte.
Boy... I am beginning to wonder if I am a Kyte Stalker??



No comments: