by-nc-sa     개발자, DBA가 함께 만들어가는 구루비 지식창고!

자동화에 대한 아이디어




TRACE 자동화


-- trace_on.sql
alter session set events '&1 trace name context forever, level &2';

-- trace_off.sql
alter session set events '&1 trace name context off';

-- trace_file.sql
-- trace_file_name
column trace_file_name new_value trace_file

select
  d.value||'/'||p.value||'_ora_'||s.spid||'.trc'
  as trace_file_name
from
  (
  select value
  from v$parameter
  where name = 'instance_name'
  ) p,
  (
  select value
  from v$parameter
  where name = 'user_dump_dest'
  ) d,
  (
  select spid
  from v$process
  where addr = (
    select paddr
    from v$session
    where sid = (select sid from v$mystat where rownum = 1)
    )
  ) s
;

prompt &trace_file

-- tkprof
host tkprof &trace_file &1

문서에 대하여

문서정보

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.