Print Thread
Not getting plan when querying with dbms_xplan.display_cursor
#34108 05/28/09 07:32 PM
Joined: Jun 2004
Posts: 89
J
jking Offline OP
Member
OP Offline
Member
J
Joined: Jun 2004
Posts: 89
Whenever I run the below script inside of a command window:

set serveroutput off
select * from dual;
select * from table(dbms_xplan.display_cursor);


I get the below output:

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
SQL_ID 9m7787camwh4m, child number 2
begin :id := sys.dbms_transaction.local_transaction_id; end;
NOTE: cannot fetch plan for SQL_ID: 9m7787camwh4m, CHILD_NUMBER: 2
Please verify value of SQL_ID and CHILD_NUMBER;
It could also be that the plan is no longer in cursor cache (check v$sql_p


If I run the same script inside of Oracle SQL*Plus, I get the correct output:


PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------
SQL_ID a5ks9fhw2v9s1, child number 0
-------------------------------------
select * from dual

Plan hash value: 272002086

--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
| 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------



Am I doing something wrong in PL/SQL Dev or is there something else wrong?

Thanks,
Joe


Re: Not getting plan when querying with dbms_xplan.display_cursor
jking #34113 05/29/09 10:09 AM
Joined: Aug 1999
Posts: 22,228
Member
Offline
Member
Joined: Aug 1999
Posts: 22,228
Apparently the Command Window checks the transaction status between statements, and this conflicts with your script. We'll see if we can enhance this.


Marco Kalter
Allround Automations
Re: Not getting plan when querying with dbms_xplan.display_cursor
Marco Kalter #38889 10/20/10 02:32 PM
Joined: Sep 2010
Posts: 8
L
Member
Offline
Member
L
Joined: Sep 2010
Posts: 8
We are using version 8 on Oracle 11g. Could you please let us know when the issue of using dbms_xplan.display_cursor will be resolved.

Thanks
Lise

Re: Not getting plan when querying with dbms_xplan.display_cursor
Marco Kalter #48280 12/03/13 06:08 PM
Joined: Dec 2001
Posts: 73
Cedar Hills, UT
Member
Offline
Member
Joined: Dec 2001
Posts: 73
Cedar Hills, UT
We're now two versions later and this still isn't fixed. I'm on PSD version 10.0.5.1710

I'm getting the exact same output when I call upon dbms_xplan.display_cursor, either without arguments, or with the sqlid parameter bypassed using named notation. According to the docs if sqlid isn't passed dbms_xplan will automatically grab the sqlid of the last statement executed in the current session. This works fine in SQL*Plus and TOAD, but returns the output seen in the original post above when attempted in PSD's Command window or SQL window.

In my opinion this is a larg-ish bug and ought to be fixed in the next patch. Anytime I'm forced to use TOAD or SQL*Plus to get correct behavior, it ought to be fixed pronto.

Re: Not getting plan when querying with dbms_xplan.display_cursor
bcoulam #51642 06/12/15 08:20 AM
Joined: Dec 2011
Posts: 3
S
Member
Offline
Member
S
Joined: Dec 2011
Posts: 3
Hello Marco,

we would appreciate a fix/solution for this issue too.
We need this for some schemas which are not allowed to select the base tables of SQL. Thus a normal Explain Plan Window does not work too.

Thanks
Steffen


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.056s Queries: 15 (0.017s) Memory: 2.5175 MB (Peak: 3.0405 MB) Data Comp: Off Server Time: 2024-06-09 18:11:21 UTC
Valid HTML 5 and Valid CSS