[Oracle] how to trace a session

–step 1.check the session information

col username format a8
col machine format a16
col osuser format a8
col program format a12
select sid,serial#,username,osuser,machine, program, to_char(LOGON_TIME,'yyyymmdd hh24:mi:ss')
from v$session
where username like 'DAZEL%'
order by logon_time;

–get the sid, serial#

–step 2. start trace
exec dbms_system.set_sql_trace_in_session(68,36341,true);

–step 3. stop trace
exec dbms_system.set_sql_trace_in_session(68,36341,false)

–step 4.use oracle tool tkprof convert the trc file to txt file.

D:\Oracle\ORA1020\BIN\tkprof mis20p_ora_5708.trc mis20p_ora_5708_1.txt

check the txt file for detail or may send the trace/txt file to the oracle support.

by the way, if you want trace your current session, use this sql
exec dbms_system.set_sql_trace_in_session(true)
exec dbms_system.set_sql_trace_in_session(false)


0 条评论。


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>