<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: dbms_xplan (4)</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 22 May 2013 12:40:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41598</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 01 Sep 2011 16:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41598</guid>
		<description><![CDATA[Stefan,

Cunning solution.
Thanks for the reference.]]></description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>Cunning solution.<br />
Thanks for the reference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Preiss</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41574</link>
		<dc:creator><![CDATA[Martin Preiss]]></dc:creator>
		<pubDate>Tue, 30 Aug 2011 11:48:35 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41574</guid>
		<description><![CDATA[Stefan,

thank you for the link and the information. That&#039;s what I was looking for.

Regards

Martin]]></description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>thank you for the link and the information. That&#8217;s what I was looking for.</p>
<p>Regards</p>
<p>Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stefan</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41573</link>
		<dc:creator><![CDATA[stefan]]></dc:creator>
		<pubDate>Tue, 30 Aug 2011 10:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41573</guid>
		<description><![CDATA[I had a similar question, and foundt his, maybe it helps:
http://practical-sql-tuning.blogspot.com/2009/10/dbmsxplandisplaycursor-for-rac-database.html

not beeing able to create, this, I just did it like this manually and it worked  on a 2 node cluster (with inst_id, slq_id and childnmber inserted)

select * from table(dbms_xplan.display(&#039;gv$sql_plan_statistics_all&#039;,  null,  null,
                                              &#039;inst_id=2 and sql_id=&#039;&#039;.......&#039;&#039; and CHILD_NUMBER=0&#039;));]]></description>
		<content:encoded><![CDATA[<p>I had a similar question, and foundt his, maybe it helps:<br />
<a href="http://practical-sql-tuning.blogspot.com/2009/10/dbmsxplandisplaycursor-for-rac-database.html" rel="nofollow">http://practical-sql-tuning.blogspot.com/2009/10/dbmsxplandisplaycursor-for-rac-database.html</a></p>
<p>not beeing able to create, this, I just did it like this manually and it worked  on a 2 node cluster (with inst_id, slq_id and childnmber inserted)</p>
<p>select * from table(dbms_xplan.display(&#8216;gv$sql_plan_statistics_all&#8217;,  null,  null,<br />
                                              &#8216;inst_id=2 and sql_id=&#8221;&#8230;&#8230;.&#8221; and CHILD_NUMBER=0&#8242;));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Preiss</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41325</link>
		<dc:creator><![CDATA[Martin Preiss]]></dc:creator>
		<pubDate>Thu, 18 Aug 2011 06:11:34 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41325</guid>
		<description><![CDATA[Dom,

thank you for your comment. I think it would be helpful if there was an additional node parameter for display_cursor.

Regards

Martin]]></description>
		<content:encoded><![CDATA[<p>Dom,</p>
<p>thank you for your comment. I think it would be helpful if there was an additional node parameter for display_cursor.</p>
<p>Regards</p>
<p>Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randolf Geist</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41322</link>
		<dc:creator><![CDATA[Randolf Geist]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 22:31:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41322</guid>
		<description><![CDATA[Greg,

thanks - much appreciated.

Randolf]]></description>
		<content:encoded><![CDATA[<p>Greg,</p>
<p>thanks &#8211; much appreciated.</p>
<p>Randolf</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dom Brooks</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41321</link>
		<dc:creator><![CDATA[Dom Brooks]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 16:35:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41321</guid>
		<description><![CDATA[With RAC, presumably each node could have a child 1, each with different plans? So the answer should depend on which node you run it.]]></description>
		<content:encoded><![CDATA[<p>With RAC, presumably each node could have a child 1, each with different plans? So the answer should depend on which node you run it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Preiss</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41320</link>
		<dc:creator><![CDATA[Martin Preiss]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 09:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41320</guid>
		<description><![CDATA[Jonathan,

a somewhat related question: does dbms_xplan.display_cursor work with RAC? With event 10046 I see an access on v$sql (and not gv$sql) when using dbms_xplan.display_cursor on a non-RAC-DB:
[code]
select /* EXEC_FROM_DBMS_XPLAN */ case when upper(sql_text) like 
  &#039;%DBMS_XPLAN%&#039; then 0 else 1 end case, SQL_ID, child_number 
from
 v$sql where SQL_ID =&#039;8szmwam7fysa3&#039; and child_number =0

...

Parsing user id: 68     (recursive depth: 1)

Rows     Row Source Operation
-------  ---------------------------------------------------
      1  FIXED TABLE FIXED INDEX X$KGLCURSOR_CHILD (ind:2) (cr=0 pr=0 pw=0 time=0 us cost=0 size=536 card=1)

[/code]

On a RAC DB (without the option to create a sql_trace) I get no result from dbms_xplan.display_cursor for a given sql_id/child_number and no result from v$sql_plan, but when I ask gv$sql_plan I see some lines:
[code]
select * 
  from table(dbms_xplan.display_cursor(sql_id =&gt; &#039;13x0qwkc4xrfv&#039;, cursor_child_no=&gt;1));

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------------------
SQL_ID: 13x0qwkc4xrfv, child number: 1 cannot be found

select count(*) 
  from v$sql_plan
 where sql_id = &#039;13x0qwkc4xrfv&#039; 
   and child_number = 1;

  COUNT(*)
----------
         0

select count(*) 
  from gv$sql_plan
 where sql_id = &#039;13x0qwkc4xrfv&#039; 
   and child_number = 1;

  COUNT(*)
----------
         4
[/code]

In Morgan&#039;s Library (http://www.morganslibrary.org/reference/pkgs/dbms_xplan.html#dxdc) I find for &quot;display_cursor&quot; the description &quot;Display from GV$SQL_PLAN (or GV$SQL_PLAN_STATISTICS_ALL)&quot; - but the documentation (http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_xplan.htm#CACFJGHG) says &quot;The table function DISPLAY_CURSOR requires to have select privileges on the following fixed views: V$SQL_PLAN, V$SESSION and V$SQL_PLAN_STATISTICS_ALL&quot;.

Of course if I am lucky and on the appropriate node I get my results - but is this a limitation of dbms_xplan.display_cursor or do I miss an important point?

Regards

Martin]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>a somewhat related question: does dbms_xplan.display_cursor work with RAC? With event 10046 I see an access on v$sql (and not gv$sql) when using dbms_xplan.display_cursor on a non-RAC-DB:</p>
<pre class="brush: plain; title: ; notranslate">
select /* EXEC_FROM_DBMS_XPLAN */ case when upper(sql_text) like 
  '%DBMS_XPLAN%' then 0 else 1 end case, SQL_ID, child_number 
from
 v$sql where SQL_ID ='8szmwam7fysa3' and child_number =0

...

Parsing user id: 68     (recursive depth: 1)

Rows     Row Source Operation
-------  ---------------------------------------------------
      1  FIXED TABLE FIXED INDEX X$KGLCURSOR_CHILD (ind:2) (cr=0 pr=0 pw=0 time=0 us cost=0 size=536 card=1)

</pre>
<p>On a RAC DB (without the option to create a sql_trace) I get no result from dbms_xplan.display_cursor for a given sql_id/child_number and no result from v$sql_plan, but when I ask gv$sql_plan I see some lines:</p>
<pre class="brush: plain; title: ; notranslate">
select * 
  from table(dbms_xplan.display_cursor(sql_id =&gt; '13x0qwkc4xrfv', cursor_child_no=&gt;1));

PLAN_TABLE_OUTPUT
---------------------------------------------------------------------------------------------------
SQL_ID: 13x0qwkc4xrfv, child number: 1 cannot be found

select count(*) 
  from v$sql_plan
 where sql_id = '13x0qwkc4xrfv' 
   and child_number = 1;

  COUNT(*)
----------
         0

select count(*) 
  from gv$sql_plan
 where sql_id = '13x0qwkc4xrfv' 
   and child_number = 1;

  COUNT(*)
----------
         4
</pre>
<p>In Morgan&#8217;s Library (<a href="http://www.morganslibrary.org/reference/pkgs/dbms_xplan.html#dxdc" rel="nofollow">http://www.morganslibrary.org/reference/pkgs/dbms_xplan.html#dxdc</a>) I find for &#8220;display_cursor&#8221; the description &#8220;Display from GV$SQL_PLAN (or GV$SQL_PLAN_STATISTICS_ALL)&#8221; &#8211; but the documentation (<a href="http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_xplan.htm#CACFJGHG" rel="nofollow">http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_xplan.htm#CACFJGHG</a>) says &#8220;The table function DISPLAY_CURSOR requires to have select privileges on the following fixed views: V$SQL_PLAN, V$SESSION and V$SQL_PLAN_STATISTICS_ALL&#8221;.</p>
<p>Of course if I am lucky and on the appropriate node I get my results &#8211; but is this a limitation of dbms_xplan.display_cursor or do I miss an important point?</p>
<p>Regards</p>
<p>Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leo</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41319</link>
		<dc:creator><![CDATA[leo]]></dc:creator>
		<pubDate>Wed, 17 Aug 2011 01:35:10 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41319</guid>
		<description><![CDATA[[sourcecode]
select (sysdate-a.logon_time)*24*60 minutes,
       a.username,
       a.BLOCKING_INSTANCE,
       a.BLOCKING_SESSION,
       a.program,
       a.machine,
       a.osuser,
       a.status,
       a.sid,
       a.serial#,
       a.event,
       a.p1,
       a.p2,
       a.p3,
       a.sql_id,
       a.sql_child_number,
       b.sql_text
  from v$session a, v$sql b
 where
   a.sql_address = b.address
   and a.sql_hash_value = b.hash_value
   and a.sql_child_number=b.child_number
   and a.username like &#039;%USERNAME%&#039; 
   order by 1 desc;
[/sourcecode]
Factly,when we troubleshooting,we should find the sql_id and child_number,then get exection plan by query:
[sourcecode]
select * from table(dbms_xplan.display_cursor(&#039;sql_id&#039;,sql_child_number,&#039;ALL&#039;));
[/sourcecode]
]]></description>
		<content:encoded><![CDATA[<pre class="brush: plain; title: ; notranslate">
select (sysdate-a.logon_time)*24*60 minutes,
       a.username,
       a.BLOCKING_INSTANCE,
       a.BLOCKING_SESSION,
       a.program,
       a.machine,
       a.osuser,
       a.status,
       a.sid,
       a.serial#,
       a.event,
       a.p1,
       a.p2,
       a.p3,
       a.sql_id,
       a.sql_child_number,
       b.sql_text
  from v$session a, v$sql b
 where
   a.sql_address = b.address
   and a.sql_hash_value = b.hash_value
   and a.sql_child_number=b.child_number
   and a.username like '%USERNAME%' 
   order by 1 desc;
</pre>
<p>Factly,when we troubleshooting,we should find the sql_id and child_number,then get exection plan by query:</p>
<pre class="brush: plain; title: ; notranslate">
select * from table(dbms_xplan.display_cursor('sql_id',sql_child_number,'ALL'));
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Rahn</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41317</link>
		<dc:creator><![CDATA[Greg Rahn]]></dc:creator>
		<pubDate>Tue, 16 Aug 2011 20:45:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41317</guid>
		<description><![CDATA[Filed.  Bug 12879906]]></description>
		<content:encoded><![CDATA[<p>Filed.  Bug 12879906</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mladen Gogala</title>
		<link>http://jonathanlewis.wordpress.com/2011/08/16/dbms_xplan-4/#comment-41315</link>
		<dc:creator><![CDATA[Mladen Gogala]]></dc:creator>
		<pubDate>Tue, 16 Aug 2011 16:33:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=6947#comment-41315</guid>
		<description><![CDATA[Ah, don&#039;t worry! I figured it out. The problem is in set serveroutput on. When I disable the server output, I get the behavior you describe.]]></description>
		<content:encoded><![CDATA[<p>Ah, don&#8217;t worry! I figured it out. The problem is in set serveroutput on. When I disable the server output, I get the behavior you describe.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
