Results 1 to 5 of 5

Thread: Use of Auto trace in Query

  1. #1
    Contributing Member
    Join Date
    May 2006
    Answers
    71

    Use of Auto trace in Query

    What is auto trace used for? Is this a command or a function? Someone highlight me on this.


  2. #2
    Contributing Member
    Join Date
    May 2006
    Answers
    82

    Re: Use of Auto trace in Query

    When auto trace is set to on it will cause each query that is getting executed to display the execution path along with the query. Auto trace is a command that can be set on or off as per the needs of the user.


  3. #3
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Use of Auto trace in Query

    it is a command which is used to display the execution path of the under lined query.


  4. #4
    Junior Member
    Join Date
    Nov 2007
    Answers
    22

    Re: Use of Auto trace in Query

    autotrace is used for to see the actual execution of sql.

    it shows the all the path and how your query goes.

    it mostly use for the tunning point of view.

    Thanks and regard

    Dhiraj Pande.


  5. #5
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: Use of Auto trace in Query

    The autotrace utility is a very underutilized feature of SQL*Plus. It offers statement tracing and instant feedback on any successful SELECT, INSERT, UPDATE or DELETE statement. The utility requires a plan table (for the Explain Plan) under the current user’s schema. In addition, it requires the plustrace or DBA role for the user executing the trace. The source for the PLUSTRACE role can be found in
    $ORACLE_HOME/sqlplus/admin/plustrce.sql.

    Tracing is enabled via the set autotrace command in SQL*Plus:

    SQL> set autotrace on
    SQL> select ename from emp where empno = 1122;

    no rows selected

    Execution Plan
    ----------------------------------------------------------
    0 SELECT STATEMENT Optimizer=CHOOSE
    1 0 TABLE ACCESS (BY INDEX ROWID) OF 'EMP'
    2 1 INDEX (UNIQUE SCAN) OF 'PK_EMP' (UNIQUE)


    Statistics
    ----------------------------------------------------------
    83 recursive calls
    0 db block gets
    21 consistent gets
    3 physical reads
    0 redo size
    221 bytes sent via SQL*Net to client
    368 bytes received via SQL*Net from client
    1 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    0 rows processed

    autotrace provides instantaneous feedback including the returned rows, execution plan, and statistics. The user doesn’t need to be concerned about trace file locations and formatting since the output is displayed instantly on the screen. This is very important data that can be used to tune the SQL statement.

    autotrace supports the following options:

    • on – Enables all options.

    • on explain – Displays returned rows and the explain plan.

    • on statistics – Displays returned rows and statistics.

    • trace explain – Displays the execution plan for a select statement without actually executing it.
    set autotrace trace explain

    • traceonly – Displays execution plan and statistics without displaying the returned rows. This option should be used when a large result set is expected.

    autotrace is so easy to use that it should be the first tracing utility used for most SQL performance tuning issues. tkprof can be used for more detailed analysis.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact