Reg:Tkprof, awr, explain plan, autotrace analysis

hi friends.
can any one give description about below subject..........
Tkprof,
awr,
explain plan,
autotrace analysis
if possible kindly mentioned some example for each OR provide some to read.
regards,
Rajnish

They're all described in the Oracle Documentation, example:
http://www.oracle.com/pls/db112/search?remark=quick_search&word=AWR&partno=
Look in the [Performance Tuning Guide|http://download.oracle.com/docs/cd/E11882_01/server.112/e10821/toc.htm] for examples/exaplanations.
Randolf Geist sums it all up very nice here: http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html
More examples can be found on http://asktom.oracle.com
and on this forum by simply doing a search.

Similar Messages

  • Explain plan/autotrace for stored procedure

    Hello,
    I have an stored procedure executing a select statement. I would like to use autotrace or explain plan or something to check how my select statement is executed.
    So far I've only accomplished to use autotrace on statements i write in sql*plus. The problem here is that my select statement uses some user defined types (lists of numbers and dates). Also if possible I would like my application to call the procedure providing the parameters. I feel kind of lost here.
    My query is something like this:
    int_list list_of_numbers;
    int_list2 list_of_numbers;
    date_list list_of_dates;
    select * from table1, table(int_list) i1, table(int_list2) i2, table(date_list) d1 where ....

    No, i do not have a "close cursor" procedure, but I just leave the tracing on for now. When in production I will turn it off.
    This is just a test system so I have full control over everything.
    Yes, I granted execute on dbms_session and alter session to my user, because I received an error when trying to execute the stored procedure. But with dbms_support and monitor I can't even compile my stored procedure.
    I granted execute on dbms_monitor to my user and the procedure compiled fine! When trying to grant execute on dbms_support sql*plus complained on not even finding that package/procedure/whatever.
    Thank you for all your help!

  • Explain Plan results analysis

    I have EXPLAIN PLAN results for some SELECT queries. What is the difference between INDEX UNIQUE SCAN and INDEX RANGE SCAN?

    btw it depend not only of your compare operation
    but also on index type. See difference for equality between simple index and unique index:
    SQL> desc a
    Name                                      Null?    Type
    A                                                  NUMBER
    SQL> create index aidx on a (a);
    Index created.
    SQL> set autot traceonly explain
    SQL> select * from a where a = 1;
    Execution Plan
    Plan hash value: 3649445643
    | Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |      |     1 |    13 |     1   (0)| 00:00:01 |
    |*  1 |  INDEX RANGE SCAN| AIDX |     1 |    13 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("A"=1)
    SQL> drop index aidx;
    Index dropped.
    SQL> create unique index aidx on a (a);
    Index created.
    SQL> select * from a where a = 1;
    Execution Plan
    Plan hash value: 2717653437
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |      |     1 |    13 |     0   (0)| 00:00:01 |
    |*  1 |  INDEX UNIQUE SCAN| AIDX |     1 |    13 |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("A"=1)
    SQL> Of course even with unique index >, <, between will have range scan:
    SQL> select * from a where a>1;
    Execution Plan
    Plan hash value: 3649445643
    | Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |      |     1 |    13 |     0   (0)| 00:00:01 |
    |*  1 |  INDEX RANGE SCAN| AIDX |     1 |    13 |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - access("A">1)
    SQL> In general index range scan might expect back more than 1 row, while index unique scan usually expect 1 row, however of course in both cases you might get zero rows back.
    See my blog entry Where bad performance starts at http://gplivna.blogspot.com/2007/03/where-bad-performance-starts-my.html
    it has many links aboput b-tree index internals, I'm quite sure some of them explained these operations more as well.
    Gints Plivna
    http://www.gplivna.eu

  • EXPLAIN PLAN option disabled

    Hi,
    When I take an Explain Plan using TKPROF it gives the following error:
    Error in CREATE TABLE of EXPLAIN PLAN table: APPS.prof$plan_table
    ORA-00955: name is already used by an existing object
    parse error offset: 18
    EXPLAIN PLAN option disabled.
    And the Explain Plan is snot displayed in the o/p file for all the queries.
    Can any one help me on this.
    Thanks,
    Kiran

    Hi kiran
    When I take an Explain Plan using TKPROF it gives the following error:
    Error in CREATE TABLE of EXPLAIN PLAN table: APPS.prof$plan_table
    ORA-00955: name is already used by an existing object
    parse error offset: 18
    EXPLAIN PLAN option disabled.
    ********************************************************************************What is your Db verssion and EBS? What is your kprof syntax. By the way please check those doc adn see its helpful:
    Run Adadmin To Recreate Grants And Synonyms ORA-20000 ORA-00955 In Synonyms Loop:create_synonym(GL,PLAN_TABLE,APPS,PLAN_TABLE) [ID 437714.1]
    TKPROF With Explain Fails With ORA-00903 invalid table name [ID 257294.1]
    OERR: ORA 955 is already used by an existing object [ID 18549.1]
    Also check:
    Re: TKPROF and Explain Plan
    Regard
    Helios

  • [8i] Can someone help me on using explain plan, tkprof, etc.?

    I am trying to follow the instructions at When your query takes too long ...
    I am trying to figure out why a simple query takes so long.
    The query is:
    SELECT COUNT(*) AS tot_rows FROM my_table;It takes a good 5 minutes or so to run (best case), and the result is around 22 million (total rows).
    My generic username does not (evidently) allow access to PLAN_TABLE, so I had to log on as SYSTEM to run explain plan. In SQL*Plus, I typed in:
    explain plan for (SELECT COUNT(*) AS tot_rows FROM my_table);and the response was "Explained."
    Isn't this supposed to give me some sort of output, or am I missing something?
    Then, the next step in the post I linked is to use tkprof. I see that it says it will output a file to a path specified in a parameter. The only problem is, I don't have access to the db's server. I am working remotely, and do not have any way to remotely (or directly) access the db server. Is there any way to have the file output to my local machine, or am I just S.O.L.?

    SomeoneElse used "create table as" (CTAS), wich automatically gathers the stats. You can see the differende before and after stats clearly in this example.
    This is the script:
    drop table ttemp;
    create table ttemp (object_id number not null, owner varchar2(30), object_name varchar2(200));
    alter table ttemp add constraint ttemp_pk primary key (object_id);
    insert into ttemp
    select object_id, owner, object_name
    from dba_objects
    where object_id is not null;
    set autotrace on
    select count(*) from ttemp;
    exec dbms_stats.gather_table_stats('PROD','TTEMP');
    select count(*) from ttemp;And the result:
    Table dropped.
    Table created.
    Table altered.
    46888 rows created.
      COUNT(*)
         46888
    1 row selected.
    Execution Plan
               SELECT STATEMENT Optimizer Mode=CHOOSE
       1         SORT AGGREGATE
       2    1      TABLE ACCESS FULL PROD.TTEMP
    Statistics
              1  recursive calls
              1  db block gets
            252  consistent gets
              0  physical reads
            120  redo size
              0  PX remote messages sent
              0  PX remote messages recv'd
              0  buffer is pinned count
              0  workarea memory allocated
              4  workarea executions - optimal
              1  rows processed
    PL/SQL procedure successfully completed.
      COUNT(*)
         46888
    1 row selected.
    Execution Plan
               SELECT STATEMENT Optimizer Mode=CHOOSE (Cost=4 Card=1)
       1         SORT AGGREGATE (Card=1)
       2    1      INDEX FAST FULL SCAN PROD.TTEMP_PK (Cost=4 Card=46 K)
    Statistics
              1  recursive calls
              2  db block gets
            328  consistent gets
              0  physical reads
           8856  redo size
              0  PX remote messages sent
              0  PX remote messages recv'd
              0  buffer is pinned count
              0  workarea memory allocated
              4  workarea executions - optimal
              1  rows processed

  • Explain plan in AWR report?

    Is there any way to generate the explain plan in AWR report?Is it possible to generate the explain plan in AWR?
    Pandu

    Hi,
    AWR: Automatic Workload Repository
    oracle take every 60 minutes a snapshot of statistic in memory and after analysed by ADDM ( automatic database diagnostic monitor) default option, but you can change every 10 minutes or ...
    http://www.oracle-base.com/articles/10g/AutomaticWorkloadRepository10g.php
    http://www.datadisk.co.uk/html_docs/oracle/addm.htm
    http://www.rampant-books.com/t_andert_38_addm_awr_db.htm
    http://www.remote-dba.net/oracle_10g_new_features/db_management.htm
    http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/diagnsis.htm

  • Explain plan, Oracle 10g, AWR, ASH etc etc

    Hi,
    I'm obviously not searching on the right terms but using one of the following : AWR, ASH, ADDM, isn't it possible to get the explain plan for a certain SQL_ID after the fact?
    I was sure that using ash and specifying the SQL_ID that one could have the explain plan, but I don't have it in the ASH Report. We don't have Grid in place, only snapshots taken every hour.
    cheers.

    Thankyou both for your very quick replies, just what I needed.
    Edited by: mattyb on Mar 25, 2009 2:06 PM

  • Oem explain plan produced doesn't correspond to explain plan with tkprof

    Hello all,
    I am running OEM on a 10.2.0.3 database and I have a very slow query with cognos 8 BI on my data warehouse.
    I went to the dbconsole through OEM and connected to target database I went to look at the query execution and then got an explain plan.
    Then I did a trace file and ran it throught tkprof.
    When I look at both produced explain plan, I can see the tree looks the same exept the corresponding values. In OEM, it says I am going throug 18000 rows and in the tkprof result it says more like millions of records.
    As anybody had these kind of results?
    Shall I have more confidence in TKprof then OEM?
    It is very important to me since I am being chalanged by an external DBA.

    I would recommend you to get Christian Antogini´s book "Troublshooting Oracle Performance", (http://www.antognini.ch/top/) which explains everything you need to know when analyzing Oracle SQL Performance and Explain Plans.
    If you properly trace your SQL Statement, you will get "STAT" lines in the trace file. These stat lines show you the actual number of rows processed per row source operation. Explain plan per default does only show you the "estimated" row counts for the row source operations no matter whether you use "explain=" in the tkprof call or OEM to get the explain plan. Tkprof reads the STAT lines from the trace and outputs a section which is similar to an execution plan but contains the "real" number of rows.
    However, if you want to troubleshoot Oracle Performance, I would recommend you to run the statement with the hint /*+ GATHER_PLAN_STATISTICS */ or set statistics_level=ALL in your session (not database-wide!).
    If you do, you can get an excellent execution plan with DBMS_XPLAN.DISPLAY_CURSOR containing both estimated rows as well as actual rows combined with the "number of starts" for e.g. nested loop joins.
    Get the book, read it, and you will be able to discuss this issue with your external dba in a professional way. ;-)
    Regards,
    Martin
    www.ora-solutions.net

  • Explain Plan from TKPROF trace file.

    Hello,
    My procedure is taking time for that i have trace on in procedure fo find explain plan of particular query.
    Using below statement Trace is on.
       EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE = TRUE';
       EXECUTE IMMEDIATE 'ALTER SESSION SET TIMED_STATISTICS = TRUE';Now for getting expalin plan from TKPROF i have used below statement but for some query i have found explain paln and some case i cant found explain plan.
    tkprof mf_ora_23773.trc mf_ora_23773.txt explain =abc/abc
    can u please help me to analyze where i m wrong?
    Thanks.

    First of all, you should best avoid using the explain= clause on the tkprof command line.
    This will run explain plan on the statement in the trace file, and that explain plan can even be wrong, as there is no information on datatypes in the trace file.
    The real explain plan data is flushed to the trace file, when the program issues commit or rollback. Oracle always issues an implicit commit when the program disconnects, so when you run the program to completion you should have explain plan output in your trace files.
    You won't get explain plan output if you don't have access to the objects in the SQL statement. Also recursive SQL won't produce explain plan result.
    One would need to see part of your trace file to verify your assertion the explain clause doesn't always work.
    Sybrand Bakker
    Senior Oracle DBA

  • Why tkprof did not show explain plan for some sql statements

    Hi,
    I did a trace for one of the session, hoping to find the explain plan for its tkprof. However, I only get this:
    INSERT INTO AUDIT_TABLE
    VALUES
    ( :B1 , :B2 , :B3 , :B4 , :B5 , :B6 , :B8 , :B7 )
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute   3698      8.08      59.41       3348        566      19092        3698
    Fetch        0      0.00       0.00          0          0          0           0
    total     3699      8.08      59.42       3348        566      19092        3698
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: 30     (recursive depth: 2)
    ********************************************************************************Any idea why the explain plan is missing?
    Also looking at the above statistics, what can I conclude?

    Thanks John. What's ur take on this statistics then?
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   1798     12.23      36.75       1758       5404       7418        1798
    Fetch        0      0.00       0.00          0          0          0           0
    total     1798     12.23      36.75       1758       5404       7418        1798
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 30     (recursive depth: 1)
    ********************************************************************************

  • Does bigger explain plan in TKPROF output indicate something wrong with SQL

    We were tracing some database sessions.
    Using TKPROF we were able to read the trace file.
    we have noticed that some of the SQL ( 1-2 lines SQL statements) were showing up atleast
    150 lines of explain plan.
    So we realized that the sql statements are badly written.
    Based on that above can we come into the following conclusion:
    - for 1-2 lines of SQL Statement if there is 100+ lines of explain plan in TKPROF report, it indicates the SQL statement
    is wrongly written ?

    johnpau2013 wrote:
    We were tracing some database sessions.
    Using TKPROF we were able to read the trace file.
    we have noticed that some of the SQL ( 1-2 lines SQL statements) were showing up atleast
    150 lines of explain plan.
    So we realized that the sql statements are badly written.
    Based on that above can we come into the following conclusion:
    - for 1-2 lines of SQL Statement if there is 100+ lines of explain plan in TKPROF report, it indicates the SQL statement
    is wrongly written ?The only rule that is always true for tuning SQL, is that NO rule is ALWAYS true for every SQL statement &
    every data distribution.
    it depends
    post actual example, so we can see what you see.

  • Autotrace explain plan

    Hi
    i like to know how can i understand the output of the autotrace ..
    my current sql explain plan is
    Execution Plan
    Plan hash value: 2038802176
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 9 | 1026 | 332 (3)| 00:00:04 |
    | 1 | SORT ORDER BY | | 9 | 1026 | 332 (3)| 00:00:04 |
    | 2 | HASH UNIQUE | | 9 | 1026 | 331 (3)| 00:00:04 |
    | 3 | NESTED LOOPS | | | | | |
    | 4 | NESTED LOOPS | | 9 | 1026 | 330 (2)| 00:00:04 |
    |* 5 | TABLE ACCESS FULL | EATTEND_STUDENT_ATTENDANCE | 9 | 144 | 294 (3)|
    |* 6 | INDEX RANGE SCAN | PERF_EATTEND_STUDENT_INFO_N99 | 7 | | 2 (0)| 0
    |* 7 | TABLE ACCESS BY INDEX ROWID| EATTEND_STUDENT_INFO | 1 | 98 | 4 (0)| 0
    how will i decide where is the performance issue ???
    thanks

    Don't think you have any issues here, given the small number of rows you're query returns.
    You can find useful information regariding interpreting execution plans by exploring these links:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm#i16971
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:111012348061
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:231814117467
    and do some searches on those sites yourself
    Also, post your execution plan between the {noformat}{noformat} tag, so it'll stay formatted.
    For example, when you type:
    {noformat}select *
    from dual{noformat}
    it will appear as:select *
    from dualwhen you post it on this forum.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to set autotrace to explain plan ONLY

    Hi,
    I would like to see explain plan for a long running statement.
    Now if I do following:
    set autotrace on explain
    UPDATE ......-- my statement
    I get the plan, but the rows are updated also :-(
    Is there a way to tell ORACLE, please show me the explain plan but dio not execute the statement?
    Thanks

    ONLY FOR queries you can use
    set autotrace traceonly explain
    And actually query isn't executed. For other DML you cannot use that.
    The other way can be explaining the query and then selecting the plan_table output:
    SQL> explain plan for update t set code = 3;
    Explained.
    SQL> SELECT * FROM table(DBMS_XPLAN.DISPLAY);
    PLAN_TABLE_OUTPUT
    Plan hash value: 931696821
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT   |      |     3 |     9 |     3   (0)| 00:00:01 |
    |   1 |  UPDATE            | T    |       |       |            |          |
    |   2 |   TABLE ACCESS FULL| T    |     3 |     9 |     3   (0)| 00:00:01 |
    Note
    PLAN_TABLE_OUTPUT
       - dynamic sampling used for this statement
    13 rows selected.
    SQL> see http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xplan.htm
    Gints Plivna
    http://www.gplivna.eu

  • Saving/exporting autotrace and explain plan

    Is it at all possible to export or save the explain plan and/or autotrace information from Oracle SQL Developer to text?

    You must first click Explain icon or Autotrace Icon to generate them before you can check under the tab.

  • Autotrace and explain plan just show a green dot

    When I click on the AUTOTRACE and the EXPLAIN PLAN tabs in SQL Developer all I get is a green dot. I do have PLUSTRCE roll defined to my signon. I am running SQL DEVELOPER 1.5.1 on Windows XP Professional Patch 3.

    You must first click Explain icon or Autotrace Icon to generate them before you can check under the tab.

Maybe you are looking for

  • Unable to send or receive emails on my blackberry curve 9320

    Hi, for the last 2 days i have unable to send or receive emails on my phone, i have contacted vodafone and they have not been able to help. I would also like to add that when i click on OPTIONS  - SECURITY - SECURITY STATUS INFORMATION my 4 email acc

  • Problem in MRP RUN

    Hi,    We are maintaining one field in suppose MRP field in MRP1view as "X". In  Enhancement, we develop logic like that if in material master MRP field value equal to "X", then while creating reservation,system automatically create a PR along with r

  • Form does not contain Fragments when I run it

    Hi Folks, I've got a form which uses fragments.This form previews fine in the designer, but when I try to run it using generatePDF Output in a process, the parts that come from the fragments are gone. The following entries are in the log: 2011-03-04

  • Auto resize columns.

    How can i get finder to auto resize my columns in columns view? (I know how to option-click resize them) best...Jan

  • My iPod 5 says it going to take 43 hours to update to ios 7 what do I do?

    My iPod 5 says it going to take 43 hours to update to ios 7 what do I do?