OEM explain plan sown on SQL Details vs Tuning Advisor
In OEM, if I go to "Top SQL" and then get the "SQL Details" for a specific SQL Id there is a tab which shows the execution plan.
For the SQL I'm interested in, this plan shows very low values for cost, number of rows, etc. It also shows all table access being through indexes. It shows no values in the Time column.
Now on this page, if I click the button "Run SQL Tuning Advisor" and run an advisor it comes back with a recommendation that I'll ignore for now. Here's my real question. On the recommendations page there is a button "Original Explain Plan". If I click this the execution plan I get is similar but not exactly the same as the one I mentioned above on the SQL Details page. This one has very high values for cost, number of rows, etc. Some of the tables show as not using indexes.
What are the differences between these 2 pages? Is the first one an estimated plan and the second one the actual?
I've searched trying to find an explanation for this, but haven't. Thanks for any help explaining this.
I tired running SQL Tuning Advisor with DBMS_SQLTUNE package, I think the output will help you understand.
Oracle 10g SQL Tuning
Adith
Similar Messages
-
Hi
I have done an explain for one of my sql and i got the result as follows
SELECT STATEMENT Cost = 502
SORT AGGREGATE
HASH JOIN
NESTED LOOPS
HASH JOIN
TABLE ACCESS FULL CMC_NWPE_RELATION
HASH JOIN
TABLE ACCESS FULL CMC_NWST_NET_SET
NESTED LOOPS
TABLE ACCESS FULL CMC_NWPR_RELATION
INDEX UNIQUE SCAN SYS_C006513
INDEX UNIQUE SCAN SYS_C006316
TABLE ACCESS FULL CMC_MEPR_PRIM_PROV
I need to know whether i have gone wrong with any of the joins in the sql. For the matter of fact I need to interpret the result of the explain plan for my sql.
Thanks in advance
Chandra SekharHi
First of all u haven't send the complete explanation in the plan table. As far i got from your result ur accesing the ful table scan CMC_NWPE_RELATION ,CMC_NWST_NET_SET , CMC_NWPR_RELATION & one more.
check in your auery why these table are accesing full when the data in this table will volumonuous ur system this query will become very slow as it will have to acces nosof rowsin table 1*nosof rowsin table 2*nosof rowsin table 3*nosof rowsin table 4 so u create the index in those tables and index should be made on the columns which r used in ur where clause of the query
Amit -
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 in Pl/SQL developer tool
How to get the explain plan result of a query in PL/SQL developer tool which has a database link ?
Also, please suggest the min and max Cost, Cardinality and byte values
Thanks859486 wrote:
How to get the explain plan result of a query in PL/SQL developer tool which has a database link ?PL/SQL Developer is a tool written by allround automations.
I suggest you ask how to use that tool vie the support option on their own website/forums:
http://www.allroundautomations.com/plsqldev.html
Also, please suggest the min and max Cost, Cardinality and byte valuesmin cost would be 0
max cost could be anything
cardinality is http://en.wikipedia.org/wiki/Cardinality_%28SQL_statements%29
bytes are the number of estimated bytes involved in the data retrieved/processed. -
Dear All.
DBMS_XPLAN.DISPLAY_CURSOR(
sql_id IN VARCHAR2 DEFAULT NULL,
child_number IN NUMBER DEFAULT NULL,
format IN VARCHAR2 DEFAULT 'TYPICAL');
SQL> SELECT * FROM table (
2 DBMS_XPLAN.DISPLAY_CURSOR('b7jn4mf49n569'));
PLAN_TABLE_OUTPUT
SQL_ID b7jn4mf49n569, child number 0
select o.name, u.name from obj$ o, type$ t, user$ u where o.oid$ = t.tvoid and
u.user#=o.owner# and bitand(t.properties,8388608) = 8388608 and
(sysdate-o.ctime) > 0.0007
Plan hash value: 4266358741
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| T
| 0 | SELECT STATEMENT | | | | 94 (100)|
| 1 | NESTED LOOPS | | 1 | 72 | 94 (2)| 0
| 2 | NESTED LOOPS | | 1 | 56 | 93 (2)| 0
|* 3 | TABLE ACCESS FULL | OBJ$ | 71 | 2414 | 37 (3)| 0
|* 4 | TABLE ACCESS BY INDEX ROWID| TYPE$ | 1 | 22 | 1 (0)| 0
|* 5 | INDEX UNIQUE SCAN | I_TYPE2 | 1 | | 0 (0)|
| 6 | TABLE ACCESS CLUSTER | USER$ | 1 | 16 | 1 (0)| 0
|* 7 | INDEX UNIQUE SCAN | I_USER# | 1 | | 0 (0)|
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
3 - filter(("O"."OID$" IS NOT NULL AND SYSDATE@!-"O"."CTIME">.0007))
4 - filter(BITAND("T"."PROPERTIES",8388608)=8388608)
5 - access("O"."OID$"="T"."TVOID")
7 - access("U"."USER#"="O"."OWNER#")
29 rows selected
SQL> As you can see using DBMS_XPLAN.DISPLAY_CURSOR. I can display the explain plan of any query IN SQL*PLUS.
But I want to write a PL/SQL function that generating an explain plan for any query and displaying the explain plan in a htlm page
how can i do same thing in pl/sql? I need yours advice.
Thanks in advance!Generate the plan like so:
begin
execute immediate 'explain plan for select * from dual';
end;Then you can put the dbms_xplan.display bit into a ref cursor and pass that across to the front end.
Eg:
SQL> variable rc refcursor
SQL> begin
2 execute immediate 'explain plan for select * from dual';
3 open :rc for select * from table(dbms_xplan.display);
4* end;
SQL> /
PL/SQL procedure successfully completed.
SQL> print rc;
PLAN_TABLE_OUTPUT
Plan hash value: 3543395131
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 5 (0)| 00:00:01 |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 5 (0)| 00:00:01 |
8 rows selected. -
"Explain Plan" in Oracle SQL Developer is greyed out
Hi all,
I know this is not the right place to post this, but I have look around and do not know where to post question about Oracle SQL Developer - I presume this tool is also discussed here in this forum.
My question is very simple (I presume):
1. I installed Oracle SQL Developer 3.0.04.
2. I added a new DB connection to a DB hosted in one of my servers in the LAN.
3. However, when I am writing some SQL queries, I intend to use the "Explain Plan" feature, but it is being greyed out (disabled).
4. How can I enable it back?Hello,
{forum:id=260}
Regards
Marcus -
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.
JasonWelcome 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. -
Explain plan for a sql statement
Hi,
I have a simple sql statement which has a cost of 122, cardinality 59 and CPU cost 1966777.
Same sql statement written in another way (using a nested select in the 'from' clause), has a cost of 58, cardinality 24 but cpu cost is much higher 29078895.
What should I look for? For a better cost overall, or for a better cpu cost? Which statement should I consider? What is most important?
Thanks.Roger25 wrote:
... Based on this, my question is what statement to choose? which is more important, the cost or the cpu cost?
Thanks.
Based on this, sorry, but my reply will remain unchanged:
Again, you cannot compare explain plan of two different queries.
Find out more:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:313416745628
Nicolas. -
Explain plans for PL/SQL code?
Hi!
I am pulling SQL statements (select, insert, update, delete, etc.) from PL/SQL code and producing explain plans. Some of the delete statements have "WHERE CURRENT OF" in them which produces an ORA-3001 error (feature not implemented) error. How can I do an explain plan of these statements? Can I replace "WHERE CURRENT OF" with "=" to get a plan? How far off will the plan be? Any suggestions, ideas, etc. greatfully appreciated!
This is Oracle 9.2.0.4/5 on AIX if it makes a difference.
Thanks!
Dave VenusWHERE CURRENT OF shouldn't be a problem. Here above an example on 9.2.0.4 on AIX5.2 :
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> create table TBL_USER_PROFILE_CATEGORY
2 as
3 select 654 id_category, 1103 id_user from dual union all
4 select 654 id_category, 1104 id_user from dual union all
5 select 18 id_category, 1103 id_user from dual union all
6 select 629 id_category, 1103 id_user from dual union all
7 select 110 id_category, 1103 id_user from dual union all
8 select 110 id_category, 1104 id_user from dual union all
9 select 18 id_category, 1104 id_user from dual union all
10 select 37 id_category, 1103 id_user from dual union all
11 select 24 id_category, 1103 id_user from dual union all
12 select 7 id_category, 104 id_user from dual union all
13 select 37 id_category, 1104 id_user from dual union all
14 select 22 id_category, 1103 id_user from dual union all
15 select 22 id_category, 1104 id_user from dual union all
16 select 25 id_category, 1104 id_user from dual union all
17 select 25 id_category, 1103 id_user from dual ;
Table created.
SQL>
SQL> alter table TBL_USER_PROFILE_CATEGORY add primary key (id_category, id_use
Table altered.
SQL>
SQL> CREATE OR REPLACE
2 PROCEDURE P$UPDATE_TBL_USER_PROFILE_CAT(p_id_cat_old IN NUMBER) AS
3 p_id_category number;
4 p_id_user number;
5 cursor mycur is select id_category, id_user
6 from TBL_USER_PROFILE_CATEGORY
7 where id_category = p_id_cat_old
8 for update of id_category;
9 BEGIN
10 open mycur;
11 LOOP
12 FETCH mycur INTO p_id_category, p_id_user;
13 EXIT WHEN mycur%NOTFOUND;
14 BEGIN
15 DELETE FROM TBL_USER_PROFILE_CATEGORY
16 WHERE CURRENT OF mycur;
17 END;
18 END LOOP;
19 CLOSE mycur;
20 COMMIT;
21 EXCEPTION WHEN OTHERS THEN rollback;
22 END;
23 /
Procedure created.
SQL>
SQL> exec P$UPDATE_TBL_USER_PROFILE_CAT(654)
PL/SQL procedure successfully completed.
SQL> select * from TBL_USER_PROFILE_CATEGORY;
ID_CATEGORY ID_USER
18 1103
629 1103
110 1103
110 1104
18 1104
37 1103
24 1103
7 104
37 1104
22 1103
22 1104
25 1104
25 1103
13 rows selected.
SQL> Please, paste here what's your code...
Nicolas. -
Hi ,
Our db version is Oracle 8i and looking for solution.
I have multiple select sql statments and need to get the explain plan for all statments.
Is it possible to take explain plan for all statments one time? If so please provide the steps.
Thanks.
Happy Halloween.Not sure exactly you are looking. But if you do
set autotrace on
from sqlplus and put all the query in a script, you should get all explain plan in one shot. You can spool the output to a file. -
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)
******************************************************************************** -
SQL Server database Tuning Advisor not working SQL 2014 CU3
Any idea?
Problem signature:
Problem Event Name: APPCRASH
Application Name: DTAEngine.exe
Application Version: 2014.120.2000.8
Application Timestamp: 5306c816
Fault Module Name: StackHash_560c
Fault Module Version: 6.3.9600.17114
Fault Module Timestamp: 53648f36
Exception Code: c0000374
Exception Offset: PCH_DC_FROM_ntdll+0x0003D2EC
OS Version: 6.3.9600.2.0.0.400.8
Locale ID: 1033
Additional Information 1: 560c
Additional Information 2: 560c82bf94e4e2b42d9b3a1a3a0f9a27
Additional Information 3: 966f
Additional Information 4: 966f4f60943cf9e4691aec84523dade7
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=280262
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
SkyRiverHello,
Are you using the “Save to file” option? Try reducing the “Set maximum file size (MB)”. Disable file rollover or use it
for creating 2-3 files only.
Please report this issue on Microsoft Connect.
https://connect.microsoft.com/SQLServer
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
Explain Plan in SQL Developer vs. SQLPlus
Hi everyone,
I've got a quick question. Why would an explain plan hang in SQL Developer but come back immediately in SQL Plus?
For example, in SQL developer, I write my statement and use the F6 command to bring up the explain plan and it just hangs and hangs. It looks like it's trying to generate an explain plan, but it's been running for hours now.
When I log into SQL Plus, I do a
SQL> explain plan for <query>:
SQL> select * from table(dbms_xplan.display);That whole process takes less than a minute to get the explain plan.
Is there something fundamentally different being executed by SQL Developer?
Thanks!
-JoeJoe,
F6 in SQL Developer runs an AutoTrace, which actually runs the SQL and also displays timings and the explain plan. If you only want the explain plan, use F10.
Regards,
Bob -
Explain plan for SQL running in a session
Hi. Can you get the explain plan information for sql that's currently running in a session? I know I can use the session report to see the active SQL, but I don't know if it's possible to get the explain plan information from there, like you can with TOAD's session manager.
I've put together a query for the v$sql_plan in 9iR2.
Depending on what you use, you can probably drop some columns (eg OTHER and partition columns) and you could drive it from the v$session by getting the hash_value from there for the sid you are interested in :
(select * from v$sql_plan where hash_value =
(select sql_hash_value from v$session where sid=:sid))
select level, optimizer, lpad('_',1*(level-1),'_')||operation operation,
options, object_owner||'.'||object_name obj_name, search_columns,
ltrim(to_char(cardinality,'999,999,999')) no_rows,
ltrim(to_char(bytes/1024,'999,999')) kbytes, cost tot_cost,
object_node link, id, parent_id, other_tag||':'||other other,
partition_start, partition_stop, cpu_cost, io_cost,
access_predicates, filter_predicates,
round(temp_space/(1024*1024),2) temp_space_mb
from (select * from v$sql_plan where hash_value = :hash_val)
start with id=0
connect by prior id = parent_id and prior child_number = child_number
order by child_number, id, position; -
Over all a very nice product. As with everything now it is difficult to place the raptor feature set in the over all product set. However any comparison is inevitable.
It would be nice if the explain plan option would ask for a default userid in case the table names are not fully qualified. This is how OEM works. It is a very convenient feature.Say I get a sql from somewhere for explain plan. The sql is executed as user scott.
When I paste the sql in the worksheet(logged in as system) and ask for an explain plan - raptor will complain about table or view not existing (942)
If I do the same in OEM (9I). OEM will ask for a default parsing userid. You pick scott and all tables in the sql are automatically aliased as scott and out comes the explain plan.
Also is there option in raptor to pretty format an sql (Again similar to OEM)
Maybe you are looking for
-
How can i connect my existing airport express to my new time capsule network?
I have an older airport express for wirelessly extending my network in my apartment. I bought a new Time Capsule and my airport express flashes amber and cannot find the time capsule to connect. How do I get them connected?
-
Creation of secondary index on RSPCPROCESSLOG table
Hello guys, We have detected severe performance issues while executing the transaction ST03n in our BW 3.5 System. Looking in the OSS notes we found the note "SAP Note 841324 - ST03N: poor performance for process chain profile" where it recommends th
-
having problems updating keynote and pages
-
Production order conformation quantity control
Dear friends, Requirement is : Against a production order quantity say 100, with milestone confirmation in 3 operations, the actual yeild is only say 80 with indicator delivery completed in the final operation. System is still allowing to do the GR f
-
Use more than one DB in InfiniteInsight
Hi, I want to know if is it possible to use more than one Data Base for create a Data Source in InfiniteInsgiht and how. Thank you very much.