Search This Blog

Thursday, December 9, 2010

How to set AUTOTRACE in Oracle 10g.

[root@localhost ~]# su - oracle
[oracle@localhost ~]$ export ORACLE_SID=orcl
[oracle@localhost ~]$ sqlplus

username:system
password:password

SQL>@?/rdbms/admin/utlxplan
NOTE: For 11g execute the above command
      in each relevant users schema.
      (Have to create plan_table independently
       for each schema.)
SQL>grant all on plan_table to public; 
(The above is command not necessary for 11g.) 
SQL>exit

[oracle@localhost ~]$ export ORACLE_SID=orcl
[oracle@localhost ~]$ sqlplus
username: / as sysdba

SQL>@?/sqlplus/admin/plustrce
SQL>grant plustrace to public;


AUTOTRACE OPTIONS: -

1)SET AUTOTRACE OFF - No AUTOTRACE report is generated.
This is the default. Queries are run as normal.

2)SET AUTOTRACE ON EXPLAIN - The query is run as normal,
and the AUTOTRACE report shows only the optimizer
execution path.

3)SET AUTOTRACE ON STATISTICS - The query is run as normal,
and the AUTOTRACE report shows only the SQL statement
execution statistics.

4)SET AUTOTRACE ON - The query execution takes place,
and the AUTOTRACE report includes both the optimizer
execution path and the SQL statement execution statistics.

5)SET AUTOTRACE TRACEONLY - Like SET AUTOTRACE ON, but
suppresses the printing of the query output, if any.

6)SET AUTOTRACE TRACEONLY STATISTICS - Like SET AUTOTRACE
TRACEONLY,but suppresses the display of the query plan.
It shows only the execution statistics.

7)SET AUTOTRACE TRACEONLY EXPLAIN - Like SET AUTOTACE
TRACEONLY,but suppresses the display of the execution
statistics,showing only the query plan. This setting
does not actually execute the query. It only parses
and explains the query.

0 comments:

Post a Comment