sql_trace

SQL_TRACE

Property Description
Parameter type Boolean
Default value false
Modifiable ALTER SESSIONALTER SYSTEM
Range of values true | false

SQL_TRACE enables or disables the SQL trace facility. Setting this parameter to true provides information on tuning that you can use to improve performance.

Caution:

Using this initialization parameter to enable the SQL trace facility for the entire instance can have a severe performance impact. Enable the facility for specific sessions using the  ALTER SESSION statement. If you must enable the facility on an entire production environment, then you can minimize performance impact by:
  • Maintaining at least 25% idle CPU capacity

  • Maintaining adequate disk space for the USER_DUMP_DEST location

  • Striping disk space over sufficient disks


C:\Documents and Settings\Administrator> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 12月 17 13:45:41 2013
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> alter session set sql_trace=true;
会话已更改。

SQL> select count(*) from dba_objects;

  COUNT(*)
----------
     74463

SQL> alter session set sql_trace=false;
会话已更改。

SQL> select * from v$diag_info where name like 'Default%';

   INST_ID       NAME                                                               VALUE
    ----------        ------------------------------------------------------  ----------

             1         Default Trace File                                            e:\app\administrator\diag\rdbms\primary\orcl\trace\orcl_ora_7396.trc


C:\Documents and Settings\Administrator> tkprof e:\app\administrator\diag\rdbms\primary\orcl\trace\orcl_ora_7396.trc      orcl.ora_7396.sql
TKPROF: Release 11.2.0.1.0 - Development on 星期二 12月 17 14:56:15 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

(TKPROF 使用方法:http://blog.csdn.net/perfect_db/article/details/8846226)

在C:\Documents and Settings\Administrator 下打开orcl.ora_7396.sql 即可;


你可能感兴趣的:(sql_trace)