Tool for Explain Plan??

Hi
Is there any tool avialable for explain plan that will give a graphical representation of the flow??

Thanks 3360,
I agree the export or copy functionality from some of these tools leaves a bit to be desired, but the original post here was in regards to an easier tool to use for self diagnosis. Maybe this can be remedied through feedback to the product manufacturers.
I know its good to have a familiarity with the lowest common denominator when it comes to database interfaces, and its also good to have an appreciation of what's going on behind the scenes when you press a button. But for productivity's sake, I left vi/notepad and sqlplus behind long ago as my main development/management environments.
Regards
Andre

Similar Messages

  • Hi when i run this in toad for explain plan  its showing an error ORA_22905

    hi when i run this query in toad for explain plan its showing an error ORA_22905 cannot accesss rows from an non nested table item can anyone help me out
    SELECT
    DISTINCT SERVICE_TBL.SERVICE_ID , SERVICE_TBL.CON_TYPE, SERVICE_TBL.S_DESC || '(' || SERVICE_TBL.CON_TYPE || ')' AS SERVICE_DESC ,SERVICE_TBL.CON_STAT
    FROM
    TABLE(:B1 )SERVICE_TBL
    WHERE
    CON_NUM = :B2
    thanks

    Note the name of this forum is SQL Developer *(Not for general SQL/PLSQL questions)* (so for issues with the SQL Developer tool). Please post these questions under the dedicated SQL And PL/SQL forum.
    Regards,
    K.

  • What are the privileges required for explain plan in Oracle 11g database

    I am facing the problem in doing a explain plan for a view in Oracle 11g database. When I select from the view like this:
    select * from zonewisearpu
    It does a select on the view but when I give explain plan like
    explain plan for
    select * from zonewisearpu
    I get the error like insufficient privileges.
    Please let me know if things are getting missed out as I guess system level privileges are required to execute this.
    I hope, my question is clear.
    It’s a humble request to revert urgently if possible as I need to complete a task and do not know the way out.
    Regards

    975148 wrote:
    Thanks for your reply. I have found out that an explain plan is possible on the user's own objects and is not possible on the granted objects from a different schema. For eg, if I do a explain plan on a view querying on tables from a different view, it would not allow the explain plan to proceed. This could mean that explain plan needs different privileges than just a select.
    Requesting for a revert to this.
    Here is a simple test case that I have perfomed
    SQL> create user test1 identified by test1;
    User created.
    SQL> create user test2 identified by test1;
    User created.
    SQL> grant connect, resource to test1,test2;
    Grant succeeded.
    SQL> create table test1.tab1 as select * from v$session;
    Table created.
    SQL> connect test2/test1
    Conencted.
    SQL> show user
    USER is "TEST2"
    SQL>
    SQL> explain plan for
      2  select sid,serial#,status,username from test1.tab1 where username<> '';
    Explained.
    SQL>
    So, as can be seen I am able to do a explain plan from user test2 for tables belong to user test1.
    As far as privileges are concerned, following is the list
    SQL> select * from dba_role_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE                        GRANTED_ROLE                   ADM DEF
    TEST1                          CONNECT                        NO  YES
    TEST1                          RESOURCE                       NO  YES
    TEST2                          CONNECT                        NO  YES
    TEST2                          RESOURCE                       NO  YES
    SQL>
    SQL> select grantee,owner,table_name,privilege from dba_tab_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE    OWNER      TABLE_NAME           PRIVILEGE
    TEST2      TEST1      TAB1                 SELECT
    SQL>
    SQL>  select * from dba_sys_privs where grantee in ('TEST1','TEST2') order by 1;
    GRANTEE    PRIVILEGE                      ADM
    TEST1      UNLIMITED TABLESPACE           NO
    TEST2      UNLIMITED TABLESPACE           NO
    SQL>

  • Script for explain plan

    Hi all
    What is the name of the script for creating the plan table in order to execute the explain plan command ?

    your_oracle_home\rdbms\admin\utlxplan.sql

  • Explain for Explain plan

    Hi,
    can anybody point me to very details of this Plan, specifically how to understand syntax in "3-filter..." statement marked in red.
    This about cross join. I expect to see <> (not equal sign) between those columns but there is nothing:
    Also actual results is 14 rows, but I don't see this number anywhere in the plan, only "12", should be any correlation between plan and result numbers?
    T1 (col_1 number):
    1
    2
    3
    4
    T2 (col_1 number):
    3
    4
    5
    6
    SQL> explain plan for  select t1.col_1 from t1, t2 where t1.col_1 != t2.col_1;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1967407726
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    12 |   312 |     6   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |      |    12 |   312 |     6   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| T1   |     4 |    52 |     2   (0)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| T2   |     3 |    39 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("T1"."COL_1""T2"."COL_1")          ---/*XXX
    Note
       - dynamic sampling used for this statement

    the cost based optimizer uses internal statistics to determine the number of rows an operation will return. For the simple query in your example these estimates would be quite exact if the statistics were adequate - but they are not since we see the dynamic sampling note that indicates missing statistics: http://blogs.oracle.com/optimizer/entry/dynamic_sampling_and_its_impact_on_the_optimizer
    -- without statistics
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    12 |   312 |    13   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |      |    12 |   312 |    13   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| T1   |     4 |    52 |     4   (0)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| T2   |     3 |    39 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("T1"."ID"<>"T2"."ID")
    Note
       - dynamic sampling used for this statement (level=2)
    -- gather statistics
    exec dbms_stats.gather_table_stats(user, 'T1')
    exec dbms_stats.gather_table_stats(user, 'T2')
    -- with statistics (we see the 4 * 4 = 16 rows we expect)
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |    16 |    96 |    13   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |      |    16 |    96 |    13   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| T1   |     4 |    12 |     4   (0)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| T2   |     4 |    12 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("T1"."ID"<>"T2"."ID")The filter says that the results of the full scan in Operation 3 are filtered according to the given condition. If we had indexes we would perhaps see an access predicate.
    Regards
    Martin Preiss

  • Verbose EXPLAIN PLAN output when asking for explain plan on simple SQL

    Hello. In a nutshell I have two issues: first, inability to execute EXPLAIN PLAN via SET AUTOTRACE ON EXPLAIN, and second, extremely verbose output when I log on as SYSDBA to circumvent the first issue.
    So, issue number one:
    I am trying to get an EXPLAIN PLAN via SET AUTOTRACE ON EXPLAIN for a simple SQL query:
      1   select decode(rownum,1,'JAN', 2,'FEB',3,'MAR',4,'APR',5,'MAY',6,'JUN',7,'JUL',8,'AUG',9,'SEP',10,'OCT',11,'NOV',12,'DEC')
      2* from all_objects where rownum<13
    HR@XE> /
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    HR@XE> set autotrace on explain
    HR@XE> /
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    Execution Plan
    ERROR:
    ORA-01039: insufficient privileges on underlying objects of the viewSo, first question, why am I getting this error? ALL_OBJECTS should be available to everybody, no?
    So to circumvent this I log on as sysdba and get the second issue: the following extremely verbose output
    HR@XE> connect / as sysdba
    Connected.
    SYS@XE>  select decode(rownum,1,'JAN', 2,'FEB',3,'MAR',4,'APR',5,'MAY',6,'JUN',7,'JUL',8,'AUG',9,'SEP',10,'OCT',11,'NOV',12,'DEC')
      2  from all_objects where rownum<13;
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    SYS@XE> set autotrace on explain
    SYS@XE> /
    DEC
    JAN
    FEB
    MAR
    APR
    MAY
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    12 rows selected.
    Execution Plan
    Plan hash value: 1291336664
    | Id  | Operation                          | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                         |    12 |  3240 |     5  (20)| 00:00:01 |
    |*  1 |  COUNT STOPKEY                     |                         |       |       |            |       |
    |*  2 |   FILTER                           |                         |       |       |            |       |
    |*  3 |    HASH JOIN                       |                         |    32 |  8640 |     5  (20)| 00:00:01 |
    |   4 |     INDEX FULL SCAN                | I_USER2                 |    49 |  1078 |     1   (0)| 00:00:01 |
    |*  5 |     HASH JOIN                      |                         |    32 |  5248 |     4  (25)| 00:00:01 |
    |   6 |      INDEX FULL SCAN               | I_USER2                 |    49 |   196 |     1   (0)| 00:00:01 |
    |*  7 |      TABLE ACCESS FULL             | OBJ$                    |    33 |  2640 |     2   (0)| 00:00:01 |
    |*  8 |    TABLE ACCESS BY INDEX ROWID     | IND$                    |     1 |     8 |     2   (0)| 00:00:01 |
    |*  9 |     INDEX UNIQUE SCAN              | I_IND1                  |     1 |       |     1   (0)| 00:00:01 |
    |* 10 |    HASH JOIN                       |                         |     1 |    24 |     3  (34)| 00:00:01 |
    |* 11 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |    11 |     2   (0)| 00:00:01 |
    |  12 |     FIXED TABLE FULL               | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 13 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 14 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  15 |    NESTED LOOPS                    |                         |       |       |            |       |
    |  16 |     NESTED LOOPS                   |                         |     1 |    73 |     6   (0)| 00:00:01 |
    |  17 |      NESTED LOOPS                  |                         |     1 |    63 |     4   (0)| 00:00:01 |
    |  18 |       NESTED LOOPS                 |                         |     1 |    52 |     3   (0)| 00:00:01 |
    |  19 |        MERGE JOIN CARTESIAN        |                         |     1 |    48 |     2   (0)| 00:00:01 |
    |* 20 |         INDEX RANGE SCAN           | I_OBJ5                  |     1 |    35 |     2   (0)| 00:00:01 |
    |  21 |         BUFFER SORT                |                         |   100 |  1300 |     0   (0)| 00:00:01 |
    |  22 |          FIXED TABLE FULL          | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 23 |        INDEX RANGE SCAN            | I_USER2                 |     1 |     4 |     1   (0)| 00:00:01 |
    |* 24 |       INDEX RANGE SCAN             | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 25 |      INDEX RANGE SCAN              | I_DEPENDENCY1           |     4 |       |     1   (0)| 00:00:01 |
    |* 26 |     TABLE ACCESS BY INDEX ROWID    | DEPENDENCY$             |     1 |    10 |     2   (0)| 00:00:01 |
    |* 27 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 28 |    HASH JOIN                       |                         |     1 |    24 |     3  (34)| 00:00:01 |
    |* 29 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |    11 |     2   (0)| 00:00:01 |
    |  30 |     FIXED TABLE FULL               | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 31 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  32 |    NESTED LOOPS                    |                         |     2 |    48 |     2   (0)| 00:00:01 |
    |* 33 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |    11 |     2   (0)| 00:00:01 |
    |* 34 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |  35 |    NESTED LOOPS                    |                         |     1 |    38 |     2   (0)| 00:00:01 |
    |  36 |     NESTED LOOPS                   |                         |     1 |    25 |     2   (0)| 00:00:01 |
    |* 37 |      TABLE ACCESS BY INDEX ROWID   | TRIGGER$                |     1 |    14 |     1   (0)| 00:00:01 |
    |* 38 |       INDEX UNIQUE SCAN            | I_TRIGGER2              |     1 |       |     0   (0)| 00:00:01 |
    |* 39 |      INDEX RANGE SCAN              | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 40 |     FIXED TABLE FULL               | X$KZSRO                 |     1 |    13 |     0   (0)| 00:00:01 |
    |* 41 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  42 |    NESTED LOOPS                    |                         |       |       |            |       |
    |  43 |     NESTED LOOPS                   |                         |     1 |    73 |     6   (0)| 00:00:01 |
    |  44 |      NESTED LOOPS                  |                         |     1 |    63 |     4   (0)| 00:00:01 |
    |  45 |       NESTED LOOPS                 |                         |     1 |    52 |     3   (0)| 00:00:01 |
    |  46 |        MERGE JOIN CARTESIAN        |                         |     1 |    48 |     2   (0)| 00:00:01 |
    |* 47 |         INDEX RANGE SCAN           | I_OBJ5                  |     1 |    35 |     2   (0)| 00:00:01 |
    |  48 |         BUFFER SORT                |                         |   100 |  1300 |     0   (0)| 00:00:01 |
    |  49 |          FIXED TABLE FULL          | X$KZSRO                 |   100 |  1300 |     0   (0)| 00:00:01 |
    |* 50 |        INDEX RANGE SCAN            | I_USER2                 |     1 |     4 |     1   (0)| 00:00:01 |
    |* 51 |       INDEX RANGE SCAN             | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 52 |      INDEX RANGE SCAN              | I_DEPENDENCY1           |     4 |       |     1   (0)| 00:00:01 |
    |* 53 |     TABLE ACCESS BY INDEX ROWID    | DEPENDENCY$             |     1 |    10 |     2   (0)| 00:00:01 |
    |* 54 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 55 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 56 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  57 |    NESTED LOOPS                    |                         |     2 |    68 |     2   (0)| 00:00:01 |
    |  58 |     NESTED LOOPS                   |                         |     1 |    21 |     2   (0)| 00:00:01 |
    |  59 |      TABLE ACCESS BY INDEX ROWID   | TABPART$                |     1 |    10 |     1   (0)| 00:00:01 |
    |* 60 |       INDEX UNIQUE SCAN            | I_TABPART_OBJ$          |     1 |       |     0   (0)| 00:00:01 |
    |* 61 |      INDEX RANGE SCAN              | I_OBJAUTH1              |     1 |    11 |     1   (0)| 00:00:01 |
    |* 62 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |* 63 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 64 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 65 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 66 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 67 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 68 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 69 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 70 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 71 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 72 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 73 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 74 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  75 |    VIEW                            |                         |     1 |    13 |     2   (0)| 00:00:01 |
    |  76 |     FAST DUAL                      |                         |     1 |       |     2   (0)| 00:00:01 |
    |* 77 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 78 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 79 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 80 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 81 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |* 82 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  83 |    NESTED LOOPS                    |                         |     2 |    42 |     2   (0)| 00:00:01 |
    |* 84 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |     8 |     2   (0)| 00:00:01 |
    |* 85 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |* 86 |    FIXED TABLE FULL                | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  87 |    NESTED LOOPS                    |                         |     2 |    42 |     2   (0)| 00:00:01 |
    |* 88 |     INDEX RANGE SCAN               | I_OBJAUTH1              |     1 |     8 |     2   (0)| 00:00:01 |
    |* 89 |     FIXED TABLE FULL               | X$KZSRO                 |     2 |    26 |     0   (0)| 00:00:01 |
    |* 90 |      FIXED TABLE FULL              | X$KZSPR                 |     1 |    26 |     0   (0)| 00:00:01 |
    |  91 |    VIEW                            |                         |     1 |    16 |     1   (0)| 00:00:01 |
    |  92 |     SORT GROUP BY                  |                         |     1 |    86 |     1   (0)| 00:00:01 |
    |  93 |      NESTED LOOPS                  |                         |     1 |    86 |     1   (0)| 00:00:01 |
    |  94 |       MERGE JOIN CARTESIAN         |                         |     1 |    78 |     0   (0)| 00:00:01 |
    |  95 |        NESTED LOOPS                |                         |     1 |    65 |     0   (0)| 00:00:01 |
    |* 96 |         INDEX UNIQUE SCAN          | I_OLAP_CUBES$           |     1 |    13 |     0   (0)| 00:00:01 |
    |* 97 |         TABLE ACCESS BY INDEX ROWID| OLAP_DIMENSIONALITY$    |     1 |    52 |     0   (0)| 00:00:01 |
    |* 98 |          INDEX RANGE SCAN          | I_OLAP_DIMENSIONALITY$  |     1 |       |     0   (0)| 00:00:01 |
    |  99 |        BUFFER SORT                 |                         |     1 |    13 |     0   (0)| 00:00:01 |
    | 100 |         INDEX FULL SCAN            | I_OLAP_CUBE_DIMENSIONS$ |     1 |    13 |     0   (0)| 00:00:01 |
    |*101 |       INDEX RANGE SCAN             | I_OBJ1                  |     1 |     8 |     1   (0)| 00:00:01 |
    | 102 |    NESTED LOOPS                    |                         |     1 |    30 |     2   (0)| 00:00:01 |
    |*103 |     INDEX SKIP SCAN                | I_USER2                 |     1 |    20 |     1   (0)| 00:00:01 |
    |*104 |     INDEX RANGE SCAN               | I_OBJ4                  |     1 |    10 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM<13)
       2 - filter(("O"."TYPE#"<>1 AND "O"."TYPE#"<>10 OR "O"."TYPE#"=1 AND  (SELECT 1 FROM "SYS"."IND$"
                  "I" WHERE "I"."OBJ#"=:B1 AND ("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR
                  "I"."TYPE#"=6 OR "I"."TYPE#"=7 OR "I"."TYPE#"=9))=1) AND (("O"."SPARE3"=USERENV('SCHEMAID') OR
                  "O"."SPARE3"=1) OR "O"."TYPE#"=13 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OA",SYS."X$KZSRO"
                  "X$KZSRO" WHERE "OA"."GRANTEE#"="KZSROROL" AND "OA"."OBJ#"=:B2 AND ("OA"."PRIVILEGE#"=12 OR
                  "OA"."PRIVILEGE#"=26)) OR  EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE
                  "INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-184) OR (-"KZSPRPRV")=(-181) OR
                  (-"KZSPRPRV")=(-241)))) OR ("O"."TYPE#"=1 OR "O"."TYPE#"=2 OR "O"."TYPE#"=3 OR "O"."TYPE#"=4 OR
                  "O"."TYPE#"=5 OR "O"."TYPE#"=19 OR "O"."TYPE#"=20 OR "O"."TYPE#"=34 OR "O"."TYPE#"=35) AND  EXISTS
                  (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE "INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-45)
                  OR (-"KZSPRPRV")=(-47) OR (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50))) OR
                  "O"."TYPE#"=11 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OA","SYS"."DEPENDENCY$"
                  "DEP",SYS."USER$" "U",SYS."OBJ$" "O",SYS."X$KZSRO" "X$KZSRO" WHERE "O"."NAME"=:B3 AND
                  "O"."SPARE3"=:B4 AND "O"."TYPE#"=9 AND "O"."TYPE#"<>88 AND "O"."OWNER#"="U"."USER#" AND
                  "DEP"."D_OBJ#"=:B5 AND "DEP"."P_OBJ#"="O"."OBJ#" AND "OA"."OBJ#"="O"."OBJ#" AND "OA"."PRIVILEGE#"=26
                  AND "OA"."GRANTEE#"="KZSROROL") OR  EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE
                  ((-"KZSPRPRV")=(-141) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))) OR ("O"."TYPE#"=7
                  OR "O"."TYPE#"=8 OR "O"."TYPE#"=9 OR "O"."TYPE#"=28 OR "O"."TYPE#"=29 OR "O"."TYPE#"=30 OR
                  "O"."TYPE#"=56) AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OA",SYS."X$KZSRO" "X$KZSRO" WHERE
                  "OA"."GRANTEE#"="KZSROROL" AND "OA"."OBJ#"=:B6 AND ("OA"."PRIVILEGE#"=12 OR "OA"."PRIVILEGE#"=26)) OR
                   EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE "INST_ID"=USERENV('INSTANCE') AND
                  ((-"KZSPRPRV")=(-144) OR (-"KZSPRPRV")=(-141) OR (-"KZSPRPRV")=(-241)))) OR "O"."TYPE#"<>14 AND
                  "O"."TYPE#"<>28 AND "O"."TYPE#"<>29 AND "O"."TYPE#"<>30 AND "O"."TYPE#"<>56 AND "O"."TYPE#"<>93 AND
                  "O"."TYPE#"<>7 AND "O"."TYPE#"<>8 AND "O"."TYPE#"<>9 AND "O"."TYPE#"<>11 AND "O"."TYPE#"<>12 AND
                  "O"."TYPE#"<>13 AND  EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$" "OBJAUTH$",SYS."X$KZSRO" "X$KZSRO" WHERE
                  "GRANTEE#"="KZSROROL" AND "OBJ#"=:B7 AND ("PRIVILEGE#"=3 OR "PRIVILEGE#"=6 OR "PRIVILEGE#"=7 OR
                  "PRIVILEGE#"=9 OR "PRIVILEGE#"=10 OR "PRIVILEGE#"=11 OR "PRIVILEGE#"=12 OR "PRIVILEGE#"=16 OR
                  "PRIVILEGE#"=17 OR "PRIVILEGE#"=18)) OR "O"."TYPE#"=12 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$"
                  "OA","SYS"."TRIGGER$" "T",SYS."X$KZSRO" "X$KZSRO" WHERE "OA"."GRANTEE#"="KZSROROL" AND "T"."OBJ#"=:B8
                  AND BITAND("T"."PROPERTY",24)=0 AND "OA"."OBJ#"="T"."BASEOBJECT" AND "OA"."PRIVILEGE#"=26) OR  EXISTS
                  (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE ((-"KZSPRPRV")=(-152) OR (-"KZSPRPRV")=(-241)) AND
                  "INST_ID"=USERENV('INSTANCE'))) OR "O"."TYPE#"=14 AND ( EXISTS (SELECT 0 FROM "SYS"."OBJAUTH$"
                  "OA","SYS"."DEPENDENCY$" "DEP",SYS."USER$" "U",SYS."OBJ$" "O",SYS."X$KZSRO" "X$KZSRO" WHERE
                  "O"."NAME"=:B9 AND "O"."SPARE3"=:B10 AND "O"."TYPE#"=13 AND "O"."TYPE#"<>88 AND
                  "O"."OWNER#"="U"."USER#" AND "DEP"."D_OBJ#"=:B11 AND "DEP"."P_OBJ#"="O"."OBJ#" AND
                  "OA"."OBJ#"="O"."OBJ#" AND "OA"."PRIVILEGE#"=26 AND "OA"."GRANTEE#"="KZSROROL") OR  EXISTS (SELECT 0
                  FROM SYS."X$KZSPR" "X$KZSPR" WHERE ((-"KZSPRPRV")=(-181) OR (-"KZSPRPRV")=(-241)) AND
                  "INST_ID"=USERENV('INSTANCE'))) OR ("O"."TYPE#"=66 OR "O"."TYPE#"=100) AND  EXISTS (SELECT 0 FROM
                  SYS."X$KZSPR" "X$KZSPR" WHERE (-"KZSPRPRV")=(-265) AND "INST_ID"=USERENV('INSTANCE')) OR
                  ("O"."TYPE#"=67 OR "O"."TYPE#"=79) AND  EXISTS (SELECT 0 FROM SYS."X$KZSPR" "X$KZSPR" WHERE
                  ((-"KZSPRPRV")=(-265) OR (-"KZSPRPRV")=(-266)) AND "INST_ID"=USERENV('INSTANCE')) OR "O"."TYPE#"=19
                  AND  EXISTS (SELECT 0 FROM SYS."TABPART$" "TABPART$","SYS"."OBJAUTH$" "OBJAUTH$",SYS."X$KZSRO"
                  "X$KZSRO" WHERE "GRANTEE#"="KZSROROL" AND "BO#"="OBJ#" A)
       3 - access("O"."OWNER#"="U"."USER#")
       5 - access("O"."SPARE3"="U"."USER#")
       7 - filter("O"."NAME"<>'_NEXT_OBJECT' AND "O"."NAME"<>'_default_auditing_options_' AND
                  BITAND("O"."FLAGS",128)=0 AND "O"."LINKNAME" IS NULL)
       8 - filter("I"."TYPE#"=1 OR "I"."TYPE#"=2 OR "I"."TYPE#"=3 OR "I"."TYPE#"=4 OR "I"."TYPE#"=6 OR
                  "I"."TYPE#"=7 OR "I"."TYPE#"=9)
       9 - access("I"."OBJ#"=:B1)
      10 - access("OA"."GRANTEE#"="KZSROROL")
      11 - access("OA"."OBJ#"=:B1)
           filter("OA"."PRIVILEGE#"=12 OR "OA"."PRIVILEGE#"=26)
      13 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-184) OR (-"KZSPRPRV")=(-181) OR
                  (-"KZSPRPRV")=(-241)))
      14 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR
                  (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50)))
      20 - access("O"."SPARE3"=:B1 AND "O"."NAME"=:B2 AND "O"."TYPE#"=9)
           filter("O"."TYPE#"=9 AND "O"."TYPE#"<>88)
      23 - access("O"."OWNER#"="U"."USER#")
      24 - access("OA"."OBJ#"="O"."OBJ#" AND "OA"."GRANTEE#"="KZSROROL" AND "OA"."PRIVILEGE#"=26)
           filter("OA"."PRIVILEGE#"=26 AND "OA"."GRANTEE#"="KZSROROL")
      25 - access("DEP"."D_OBJ#"=:B1)
      26 - filter("DEP"."P_OBJ#"="O"."OBJ#")
      27 - filter(((-"KZSPRPRV")=(-141) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))
      28 - access("OA"."GRANTEE#"="KZSROROL")
      29 - access("OA"."OBJ#"=:B1)
           filter("OA"."PRIVILEGE#"=12 OR "OA"."PRIVILEGE#"=26)
      31 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-144) OR (-"KZSPRPRV")=(-141) OR
                  (-"KZSPRPRV")=(-241)))
      33 - access("OBJ#"=:B1)
           filter("PRIVILEGE#"=3 OR "PRIVILEGE#"=6 OR "PRIVILEGE#"=7 OR "PRIVILEGE#"=9 OR "PRIVILEGE#"=10
                  OR "PRIVILEGE#"=11 OR "PRIVILEGE#"=12 OR "PRIVILEGE#"=16 OR "PRIVILEGE#"=17 OR "PRIVILEGE#"=18)
      34 - filter("GRANTEE#"="KZSROROL")
      37 - filter(BITAND("T"."PROPERTY",24)=0)
      38 - access("T"."OBJ#"=:B1)
      39 - access("OA"."OBJ#"="T"."BASEOBJECT" AND "OA"."PRIVILEGE#"=26)
           filter("OA"."PRIVILEGE#"=26)
      40 - filter("OA"."GRANTEE#"="KZSROROL")
      41 - filter(((-"KZSPRPRV")=(-152) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))
      47 - access("O"."SPARE3"=:B1 AND "O"."NAME"=:B2 AND "O"."TYPE#"=13)
           filter("O"."TYPE#"=13 AND "O"."TYPE#"<>88)
      50 - access("O"."OWNER#"="U"."USER#")
      51 - access("OA"."OBJ#"="O"."OBJ#" AND "OA"."GRANTEE#"="KZSROROL" AND "OA"."PRIVILEGE#"=26)
           filter("OA"."PRIVILEGE#"=26 AND "OA"."GRANTEE#"="KZSROROL")
      52 - access("DEP"."D_OBJ#"=:B1)
      53 - filter("DEP"."P_OBJ#"="O"."OBJ#")
      54 - filter(((-"KZSPRPRV")=(-181) OR (-"KZSPRPRV")=(-241)) AND "INST_ID"=USERENV('INSTANCE'))
      55 - filter((-"KZSPRPRV")=(-265) AND "INST_ID"=USERENV('INSTANCE'))
      56 - filter(((-"KZSPRPRV")=(-265) OR (-"KZSPRPRV")=(-266)) AND "INST_ID"=USERENV('INSTANCE'))
      60 - access("OBJ#"=:B1)
      61 - access("BO#"="OBJ#" AND "PRIVILEGE#"=9)
           filter("PRIVILEGE#"=9)
      62 - filter("GRANTEE#"="KZSROROL")
      63 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-189) OR (-"KZSPRPRV")=(-190) OR
                  (-"KZSPRPRV")=(-191) OR (-"KZSPRPRV")=(-192)))
      64 - filter((-"KZSPRPRV")=(-109) AND "INST_ID"=USERENV('INSTANCE'))
      65 - filter(((-"KZSPRPRV")=(-177) OR (-"KZSPRPRV")=(-178)) AND "INST_ID"=USERENV('INSTANCE'))
      66 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-45) OR (-"KZSPRPRV")=(-47) OR
                  (-"KZSPRPRV")=(-48) OR (-"KZSPRPRV")=(-49) OR (-"KZSPRPRV")=(-50)))
      67 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-205) OR (-"KZSPRPRV")=(-206) OR
                  (-"KZSPRPRV")=(-207) OR (-"KZSPRPRV")=(-208)))
      68 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-200) OR (-"KZSPRPRV")=(-201) OR
                  (-"KZSPRPRV")=(-202) OR (-"KZSPRPRV")=(-203) OR (-"KZSPRPRV")=(-204)))
      69 - filter(((-"KZSPRPRV")=(-222) OR (-"KZSPRPRV")=(-223)) AND "INST_ID"=USERENV('INSTANCE'))
      70 - filter((-"KZSPRPRV")=12 AND "INST_ID"=USERENV('INSTANCE'))
      71 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-251) OR (-"KZSPRPRV")=(-252) OR
                  (-"KZSPRPRV")=(-253) OR (-"KZSPRPRV")=(-254)))
      72 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-258) OR (-"KZSPRPRV")=(-259) OR
                  (-"KZSPRPRV")=(-260) OR (-"KZSPRPRV")=(-261)))
      73 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-246) OR (-"KZSPRPRV")=(-247) OR
                  (-"KZSPRPRV")=(-248) OR (-"KZSPRPRV")=(-249)))
      74 - filter(((-"KZSPRPRV")=(-268) OR (-"KZSPRPRV")=(-267)) AND "INST_ID"=USERENV('INSTANCE'))
      77 - filter(((-"KZSPRPRV")=(-277) OR (-"KZSPRPRV")=(-278)) AND "INST_ID"=USERENV('INSTANCE'))
      78 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-292) OR (-"KZSPRPRV")=(-293) OR
                  (-"KZSPRPRV")=(-294)))
      79 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-282) OR (-"KZSPRPRV")=(-283) OR
                  (-"KZSPRPRV")=(-284) OR (-"KZSPRPRV")=(-285)))
      80 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-302) OR (-"KZSPRPRV")=(-303) OR
                  (-"KZSPRPRV")=(-304) OR (-"KZSPRPRV")=(-305) OR (-"KZSPRPRV")=(-306) OR (-"KZSPRPRV")=(-307)))
      81 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-315) OR (-"KZSPRPRV")=(-316) OR
                  (-"KZSPRPRV")=(-317) OR (-"KZSPRPRV")=(-318)))
      82 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-320) OR (-"KZSPRPRV")=(-321) OR
                  (-"KZSPRPRV")=(-322)))
      84 - access("OBJ#"=:B1)
      85 - filter("GRANTEE#"="KZSROROL")
      86 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-309) OR (-"KZSPRPRV")=(-310) OR
                  (-"KZSPRPRV")=(-311) OR (-"KZSPRPRV")=(-312) OR (-"KZSPRPRV")=(-313)))
      88 - access("OBJ#"=:B1)
      89 - filter("GRANTEE#"="KZSROROL")
      90 - filter("INST_ID"=USERENV('INSTANCE') AND ((-"KZSPRPRV")=(-302) OR (-"KZSPRPRV")=(-303) OR
                  (-"KZSPRPRV")=(-304) OR (-"KZSPRPRV")=(-305) OR (-"KZSPRPRV")=(-306) OR (-"KZSPRPRV")=(-307)))
      96 - access("C"."OBJ#"=:B1)
      97 - filter("DIML"."DIMENSION_TYPE"=11)
      98 - access("DIML"."DIMENSIONED_OBJECT_ID"=:B1 AND "DIML"."DIMENSIONED_OBJECT_TYPE"=1)
    101 - access("DIML"."DIMENSION_ID"="DO"."OBJ#")
           filter("DO"."OBJ#"="DIM"."OBJ#")
    103 - access("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
           filter("U2"."TYPE#"=2 AND "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id')))
    104 - access("O2"."DATAOBJ#"=:B1 AND "O2"."TYPE#"=88 AND "O2"."OWNER#"="U2"."USER#")
    SYS@XE>Many thanks in advance.
    Jason

    Welcome to the forum!
    Whenever you post please provide your 4 digit Oracle Version (result of SELECT * FROM V$VERSION).
    >
    So, first question, why am I getting this error? ALL_OBJECTS should be available to everybody, no?
    >
    Your user probably does have access to ALL_OBJECTS. But you need to have dba privileges to access views base objects.
    The "ORA-01039: insufficient privileges on underlying objects of the view" message is telling you that the user does not have privileges to access the BASE OBJECTS that used to build the view. Access to those base objects is necessary to generate the plan you are trying to see.
    So to circumvent this I log on as sysdba and get the second issue: the following extremely verbose output
    >
    And that is because sysdba DOES have access to the base objects of the view. You asked for a plan and you got it. That verbose output IS the plan and all of those oddly named tables are being accessed to satisfy your query so are included in the plan.
    Do your query using DUAL or the SCOTT.EMP table and you won't get the error.

  • Book advise for explain plan

    Hi guys,
    I have 2 questions. The first one is as you know before, I would like to learn all secrets behind explain plan and how how oracle works behind the scenery. I have researched some books. I found Oracle SQL Tuning: A Close Look at Explain Plans by Dan Hotka. Do you recommend this book? I have just read one page of this books, I thnik the language of this book is simple and it explains the situation from the beginning. I think, it is usefull for beginners like me. Because the things become hard to learn in first time for beginners. As a result I just would like to learn that do you recommend this book?
    My second question is, I want to buy this book but I couldn't find in England (as paperback, not e book). But, appereantly I have to buy it online as ebook. Do you know any trusted web site that I can buy this book's ebook version?
    Thanks a lot for your help.

    944258 wrote:
    Hi guys,
    I have 2 questions. The first one is as you know before, I would like to learn all secrets behind explain plan and how how oracle works behind the scenery. I have researched some books. I found Oracle SQL Tuning: A Close Look at Explain Plans by Dan Hotka. Do you recommend this book? I have just read one page of this books, I thnik the language of this book is simple and it explains the situation from the beginning. I think, it is usefull for beginners like me. Because the things become hard to learn in first time for beginners. As a result I just would like to learn that do you recommend this book?Hi, why not start here first: http://www.orafaq.com/node/1420. There is probably as much information about execution plans found online, as there is in the books. At least the part you would like to know and try to remember will be online available :-)
    >
    My second question is, I want to buy this book but I couldn't find in England (as paperback, not e book). But, appereantly I have to buy it online as ebook. Do you know any trusted web site that I can buy this book's ebook version?
    http://www.amazon.com/Oracle-SQL-Tuning-Close-Explain/dp/1453804196
    Cheers
    FJFranken

  • How to set an plan_table for explain plan

    Is there a way in SQL Developer to tell it to use a particular plan table?

    Or the good old fashioned way of typing
    EXPLAIN PLAN INTO table
    FOR sql_stmt
    And looking at the results manually with
    select * from table(dbms_xplan.display);

  • Script for explain plans

    Hi Everybody,
    I was just wondering if anybody has a script that goes out and retrieve all queries that have been performed on the database and then performs a explain plan on each of these queries. Thank you in advance.
    Troy

    Hi Everybody,
    I was just wondering if anybody has a script that goes out and retrieve all queries that have been performed on the database and then performs a explain plan on each of these queries. Thank you in advance.
    Troy

  • SQL Developer 1.5.3: Specify location of PLAN_TABLE for EXPLAIN PLAN?

    In a competitor's product, I am able to set the schema location and name of the PLAN_TABLE in the preferences. This is important because there is no shared PLAN_TABLE in the databases I use.
    Is there a way to point SQL Developer to the PLAN_TABLE in my personal schema? If not, should I submit this as a feature request? Might be nice to have a CREATE PLAN_TABLE option in there as well for convenience.
    Thanks.
    Dana

    Which database version are you using? Since version 10 this issue is not relevant, because where in earlier versions you needed to create physical PLAN_TABLE, you now have a view to a system object. In version 9 why creating view/synonym with desirable name and access privileges won't solve the problem?

  • Explain plan for the packages

    Hi ,
    We have no.of packages to check for explain plan.
    Is there any tool to which we can feed the packages and get the expalin plan result of all the queries.
    Please advice
    thanks
    Maanasa

    Hi Maanasa
    Two things…
    1)     I’m not aware of any tool that does what you are looking for.
    2)     Do you use bind variables in your SQL statements. If yes, there is no way to accurately get the execution plans without executing them. In fact the query optimizer requires the bind variable values to produce an execution plan…
    Hence, the advice of enabling SQL trace (either through the SQL_TRACE parameter or the DBMS_MONITOR package) is the best one.
    HTH
    Chris Antognini
    Troubleshooting Oracle Performance, Apress 2008
    http://top.antognini.ch

  • What privileges or role is required for user to acces the explain plan?

    Hi mates,
    Can anyone pls tell me what privileges or roles(grants) are requred for a user to access the explain plan in oORACLE 8i 8174..
    I think the select any dictionary is not valid for explain plan accessibility in 8i.
    Cheers.

    I already had that... Just that a user (not a dba) requires access to the explain plan and I dont want to grant him a dba role.
    Are you aware of any other grant I can give to the user?

  • Error with Explain Plan

    Hello,
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
    NLSRTL Version 10.2.0.4.0 - Production
    I have this issue:
    On the sited above database first I execute a SELECT query, no matter what is it, with EXPLAIN PLAN FOR:
    EXPLAIN PLAN FOR SELECT <some query comes here>This executes successfully.
    Next, I do this to see the explain plan:
    SELECT *
    FROM TABLE (dbms_xplan.display());This generates the following error, which I read from the column "PLAN_TABLE_OUTPUT" of the result set:
    ERROR: an uncaught error in function display has happened; please contact Oracle support
    Please provide also a DMP file of the used plan table PLAN_TABLE
    ORA-00904: "OTHER_TAG": invalid identifierI see that it is said to contact Oracle support, but unfortunately in this firm I am not in position to contact Oracle, when there is an issue.
    Probably it is obvious to most of you, but since I receive this error for first time, I am wondering where the reason for the error could be.
    The table PLAN_TABLE exists, which I know is needed to hold the output of an EXPLAIN PLAN statement.
    Generally, in this database, when I try to see the explain plan for any query, the plan shows no values for niether parameter: Cost, CPU Cost, I/O Cost, Cardinality, whatever.
    Could anyone presume, what could be changed in order the problem to be fixed.
    What else .. the reason is not into the tool I am using, which is PL/SQL Developer, version 7.1.5, because for other databases there is no problem with EXPLAIN PLAN.
    Thanks.

    You have an invalid PLAN_TABLE that has been created by some utility or has come from a script from a lower version.
    See the script $ORACLE_HOME/rdbms/admin/catplan.sql for the correct 10.2.0.4 PLAN_TABLE (script executed by SYS AS SYSDBA)
    Alternatively, use $ORACLE_HOME/rdbms/admin/utlxplan.sql to create a private PLAN_TABLE
    Hemant K Chitale

  • Explain plans - caching question

    I am trying to get some explain plan information for some queries that we have running poorly. Our application uses some alter session statements to set the optimizer_mode to all_rows. I am trying to determine if we need to include the optimizer_index_cost_adj parameter and possibly the optimizer_index_caching parameter.
    Using SQL Developer I can easily run the different alter session statements needed and then get an explain plan for the query in question. However I am seeing some weird results - for example long query times for queries that have a relatively low cost. On the flip side I am seeing some queries that have a higher cost return quicker.
    I am doing this many times over and am wondering what impact using the same query could have. Is this query being cached in Oracle? To get an accurate explain plan would I need to clear a cache each time?
    Also, in the explain plan is the cost figure the most important? How is it that a query can have a low cost and take longer to complete than the same query with a higher cost and some different parameters?

    There are no fixed road map for what to see in explain plan,but some common observation should be made for explain plan i.e full table scans due to poor use of indexing,inappropriate hints uses for forcing indexing where FTS can be faster.unnecessary sorting,cartesian
    joins, outer joins, and anti-joins.
    At last i would say that every database vary to its different hardware platforms and those hardware have different configuration,these things can effect oracle optimizer.
    So, if my statistics are current, what should I be
    taking out of the explain plan? I always assumed
    cost was the main indicator of the performance of a
    query.As justin already told cost is not something which should be considered for tuning query rather access path, but there is more other then explain plan access path e.g TKPROF tool which will address you plan as well as others stuff which should be considered for tuning query.
    http://download.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htmKhurram

  • Explain plan generating it self taking very long time !!! What to do ?

    Hi,
    I am trying to generate explain plan for a query which is running more than 2 hours. I am trying to generate explain plan for query by "explin plan for select ..." but it self is taking very long time.
    Kindly suggest me how to reduce time for explain plan ? Secondly why explain plan itself taking very long time ?
    thanks & regards
    PKP

    Just guessing here, but I've experienced this behaviour when I did two explain's within a second. This is because a plan is identified by a statement_id or, if you don't provide a statement_id, by the timestamp (of DATE datatype). So if you execute two explain plans within the second (using a script), it has two sets of data with the same primary key. The hierarchical query that needs to be executed to provide you the nicely indented text, will exponentially expand in this case.
    Maybe time to clean up your plan_table ?
    Hope this helps.
    Regards,
    Rob.

Maybe you are looking for