获得当前trace文件生成路径
SQL> select tracefile from v$process where addr in (select paddr from v$session where sid in (select sid from v$mystat));
开启当前session的trace
SQL> alter session set sql_trace=true;
转换trc文件内容为可读的输出结果 (trace文件存放在F盘)
C:\Documents and Settings\Administrator>tkprof f:\oracle\administrator\diag\rdbm
s\orcl\orcl\trace\orcl_ora_1160.trc output=c:\aa.txt
转换的trc文件包含sql执行计划 (trace文件存放在D盘根目录)
C:\Documents and Settings\Administrator>tkprof d:\gdprd_ora_9120_htmlpkg.trc
output=d:\htmlpkg.txt explain=apps/apps@dev3 sys=no