原文地址:?http://www.2cto.com/database/201210/159305.html
Oracle查看trace文件步骤
?
1.获得当前trace文件生成路径
SQL> select tracefile from v$process where addr in (select paddr from v$session where sid in (select sid from v$mystat));
?
TRACEFILE ?
-------------------------------------------------------------------------------------------------------------------------------
f:\oracle\administrator\diag\rdbms\orcl\orcl\trace\orcl_ora_1160.trc
?
2.开启当前session的trace
SQL> alter session set sql_trace=true;
SQL> select count(*) from t1;
?
3.转换trc文件内容为可读的输出结果
?
C:\Documents and Settings\Administrator>tkprof f:\oracle\administrator\diag\rdbm
s\orcl\orcl\trace\orcl_ora_1160.trc output=c:\aa.txt
?
TKPROF: Release 11.2.0.1.0 - Development on 星期六 10月 6 23:51:07 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. ?All rights reserved.
?
4.打开c:\aa.txt, 就会看到关于SQL语句 ‘ select count(*) from t1;’ 的执行计划
[sql]?
*******************************************************************************