SQL Trace - TRACEFILE_IDENTIFIER

sql trace默认生成到user_dump_dest下,这个目录有可能存在很多sql trace,所以要找到你的trace文件有时候要费一些功夫。Oracle提供了一个有用的参数,可以让你快速的找到你的trace文件--TRACEFILE_IDENTIFIER

Oracle SQL Trace收集方法:

1. Set the tracefile identifier as you want, this will be appended to trace file name.
alter session set tracefile_identifier='ptian_sql_trace';

2. Enable your session level tracing
alter session set sql_trace=true;
alter session set events '10046 trace name context forever, level 12' ;

3. Execute your queries/statements...

DECLARE
BEGIN
END;


4. Turn-off tracing
alter session set events '10046 trace name context off';
alter session set sql_trace=false;

5. Check the user_dump_dest folder, execute linux command: ls *ptian_sql_trace*

and you will find a file name "SID_ora_nnnn_ptian_sql_trace.trc


你可能感兴趣的:(File)