<?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: Bugs</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Wed, 19 Jun 2013 22:21:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Valentin Nikotin</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49803</link>
		<dc:creator><![CDATA[Valentin Nikotin]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 21:34:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49803</guid>
		<description><![CDATA[I just compared 10046 trace with and without refreshed MV. Then I checked query causing the issue, found that error happens even for explain plan and ran 10053 to get details.]]></description>
		<content:encoded><![CDATA[<p>I just compared 10046 trace with and without refreshed MV. Then I checked query causing the issue, found that error happens even for explain plan and ran 10053 to get details.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49790</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 17:30:30 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49790</guid>
		<description><![CDATA[Valentin,

Thanks for pinning that down - I love the way that a small group with shared interests can sort out a problem so much faster than an individual.

Lookng at the trace file I generated the SQL statement never gets into the file - was this a guess based on the normal code that you expected to see for index stats collection, or did you have a version of the SQL that actually dumped this before crashing ?]]></description>
		<content:encoded><![CDATA[<p>Valentin,</p>
<p>Thanks for pinning that down &#8211; I love the way that a small group with shared interests can sort out a problem so much faster than an individual.</p>
<p>Lookng at the trace file I generated the SQL statement never gets into the file &#8211; was this a guess based on the normal code that you expected to see for index stats collection, or did you have a version of the SQL that actually dumped this before crashing ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49789</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 17:26:33 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49789</guid>
		<description><![CDATA[Stefan,

Nice bit of research - which leads to all sorts of clues: and also shows why the problem can also appear &quot;randomly&quot;. If it&#039;s about query rewrite then (with default settings for the query_rewrite_integrity parameter) the error won&#039;t occur unless the stats collection is done AFTER a refresh but BEFORE the next change to the underlying tables.

(Add an insert to the demo code after the refresh and before stats collection, and you should find that the collection suddenly works.)]]></description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>Nice bit of research &#8211; which leads to all sorts of clues: and also shows why the problem can also appear &#8220;randomly&#8221;. If it&#8217;s about query rewrite then (with default settings for the query_rewrite_integrity parameter) the error won&#8217;t occur unless the stats collection is done AFTER a refresh but BEFORE the next change to the underlying tables.</p>
<p>(Add an insert to the demo code after the refresh and before stats collection, and you should find that the collection suddenly works.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49788</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 17:23:58 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49788</guid>
		<description><![CDATA[Valentin,

Thanks for that reference - it&#039;s not very impressive that the problem was first reported in 9.2, and the Oracle developers still haven&#039;t got around to adding the no_rewrite() hint to the code in 11.2.]]></description>
		<content:encoded><![CDATA[<p>Valentin,</p>
<p>Thanks for that reference &#8211; it&#8217;s not very impressive that the problem was first reported in 9.2, and the Oracle developers still haven&#8217;t got around to adding the no_rewrite() hint to the code in 11.2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valentin Nikotin</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49767</link>
		<dc:creator><![CDATA[Valentin Nikotin]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 10:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49767</guid>
		<description><![CDATA[The root of this bug is specific of sys_op_lbid function which checks it&#039;s arguments during the parse.
Although the resulted plan won&#039;t contain MV if we remove sys_op_lbid, it is still discussed by CBO. 
This is quote of the end of 10053 trace with failure:

[sourcecode language=&quot;SQL&quot; collapse=&quot;true&quot;]Copy query block qb# -1 (&lt;unnamed&gt;) : SELECT * FROM &quot;U&quot;.&quot;ORDERS_JOIN&quot;
Registered qb: SEL$4D0E67CD 0xaa7bb0 (PARSER)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$4D0E67CD nbfros=1 flg=0
    fro(0): flg=4 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

Registered qb: SEL$AD2C33E0 0xc46a80 (MV REWRITE SEL$1; SEL$1; ORDERS_JOIN)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$AD2C33E0 nbfros=1 flg=0
    fro(0): flg=0 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

CVM: Considering view merge in query block SEL$AD2C33E0 (#0)
OJE: Begin: find best directive for query block SEL$AD2C33E0 (#0)
OJE: End: finding best directive for query block SEL$AD2C33E0 (#0)
CNT:   Considering count(col) to count(*) on query block SEL$AD2C33E0 (#0)
*************************
Count(col) to Count(*) (CNT)
*************************
CNT:     COUNT() to COUNT(*) not done.
query block SEL$1 transformed to SEL$AD2C33E0 (#0)[/sourcecode]

And this is the quote from 10053 with commented sys_op_lbid :

[sourcecode language=&quot;SQL&quot; collapse=&quot;true&quot;]
Copy query block qb# -1 (&lt;unnamed&gt;) : SELECT * FROM &quot;U&quot;.&quot;ORDERS_JOIN&quot;
Registered qb: SEL$4D0E67CD 0xcdb8cf30 (PARSER)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$4D0E67CD nbfros=1 flg=0
    fro(0): flg=4 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

Registered qb: SEL$AD2C33E0 0xcdb26a80 (MV REWRITE SEL$1; SEL$1; ORDERS_JOIN)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$AD2C33E0 nbfros=1 flg=0
    fro(0): flg=0 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

CVM: Considering view merge in query block SEL$AD2C33E0 (#0)
OJE: Begin: find best directive for query block SEL$AD2C33E0 (#0)
OJE: End: finding best directive for query block SEL$AD2C33E0 (#0)
CNT:   Considering count(col) to count(*) on query block SEL$AD2C33E0 (#0)
*************************
Count(col) to Count(*) (CNT)
*************************
CNT:     COUNT() to COUNT(*) not done.
query block SEL$1 transformed to SEL$AD2C33E0 (#0)
FPD: Considering simple filter push in query block SEL$AD2C33E0 (#0)
&quot;ORDERS_JOIN&quot;.&quot;ORDER_ID&quot; IS NOT NULL OR &quot;ORDERS_JOIN&quot;.&quot;LINE_ID&quot; IS NOT NULL
try to generate transitive predicate from check constraints for query block SEL$AD2C33E0 (#0)
finally: &quot;ORDERS_JOIN&quot;.&quot;ORDER_ID&quot; IS NOT NULL OR &quot;ORDERS_JOIN&quot;.&quot;LINE_ID&quot; IS NOT NULL

apadrv-start sqlid=5681247571542508886
  :
    call(in-use=21384, alloc=32712), compile(in-use=79560, alloc=85400), execution(in-use=4664, alloc=8088)

*******************************************
Peeked values of the binds in SQL statement
*******************************************

Final query after transformations:******* UNPARSED QUERY IS *******
SELECT /*+ NO_EXPAND */
 COUNT(*) &quot;NRW&quot;,
 NULL &quot;NDK&quot;,
 SYS_OP_COUNTCHG(SUBSTRB(ROWIDTOCHAR(&quot;ORDERS_JOIN&quot;.&quot;ORL_ROWID&quot;), 1, 15), 1) &quot;CLF&quot;
  FROM &quot;U&quot;.&quot;ORDERS_JOIN&quot; &quot;ORDERS_JOIN&quot;
 WHERE &quot;ORDERS_JOIN&quot;.&quot;ORDER_ID&quot; IS NOT NULL
    OR &quot;ORDERS_JOIN&quot;.&quot;LINE_ID&quot; IS NOT NULL
...
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>The root of this bug is specific of sys_op_lbid function which checks it&#8217;s arguments during the parse.<br />
Although the resulted plan won&#8217;t contain MV if we remove sys_op_lbid, it is still discussed by CBO.<br />
This is quote of the end of 10053 trace with failure:</p>
<pre class="brush: sql; collapse: true; light: false; title: ; toolbar: true; notranslate">Copy query block qb# -1 (&lt;unnamed&gt;) : SELECT * FROM &quot;U&quot;.&quot;ORDERS_JOIN&quot;
Registered qb: SEL$4D0E67CD 0xaa7bb0 (PARSER)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$4D0E67CD nbfros=1 flg=0
    fro(0): flg=4 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

Registered qb: SEL$AD2C33E0 0xc46a80 (MV REWRITE SEL$1; SEL$1; ORDERS_JOIN)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$AD2C33E0 nbfros=1 flg=0
    fro(0): flg=0 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

CVM: Considering view merge in query block SEL$AD2C33E0 (#0)
OJE: Begin: find best directive for query block SEL$AD2C33E0 (#0)
OJE: End: finding best directive for query block SEL$AD2C33E0 (#0)
CNT:   Considering count(col) to count(*) on query block SEL$AD2C33E0 (#0)
*************************
Count(col) to Count(*) (CNT)
*************************
CNT:     COUNT() to COUNT(*) not done.
query block SEL$1 transformed to SEL$AD2C33E0 (#0)</pre>
<p>And this is the quote from 10053 with commented sys_op_lbid :</p>
<pre class="brush: sql; collapse: true; light: false; title: ; toolbar: true; notranslate">
Copy query block qb# -1 (&lt;unnamed&gt;) : SELECT * FROM &quot;U&quot;.&quot;ORDERS_JOIN&quot;
Registered qb: SEL$4D0E67CD 0xcdb8cf30 (PARSER)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$4D0E67CD nbfros=1 flg=0
    fro(0): flg=4 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

Registered qb: SEL$AD2C33E0 0xcdb26a80 (MV REWRITE SEL$1; SEL$1; ORDERS_JOIN)
---------------------
QUERY BLOCK SIGNATURE
---------------------
  signature (): qb_name=SEL$AD2C33E0 nbfros=1 flg=0
    fro(0): flg=0 objn=62795 hint_alias=&quot;ORDERS_JOIN&quot;@&quot;SEL$4D0E67CD&quot;

CVM: Considering view merge in query block SEL$AD2C33E0 (#0)
OJE: Begin: find best directive for query block SEL$AD2C33E0 (#0)
OJE: End: finding best directive for query block SEL$AD2C33E0 (#0)
CNT:   Considering count(col) to count(*) on query block SEL$AD2C33E0 (#0)
*************************
Count(col) to Count(*) (CNT)
*************************
CNT:     COUNT() to COUNT(*) not done.
query block SEL$1 transformed to SEL$AD2C33E0 (#0)
FPD: Considering simple filter push in query block SEL$AD2C33E0 (#0)
&quot;ORDERS_JOIN&quot;.&quot;ORDER_ID&quot; IS NOT NULL OR &quot;ORDERS_JOIN&quot;.&quot;LINE_ID&quot; IS NOT NULL
try to generate transitive predicate from check constraints for query block SEL$AD2C33E0 (#0)
finally: &quot;ORDERS_JOIN&quot;.&quot;ORDER_ID&quot; IS NOT NULL OR &quot;ORDERS_JOIN&quot;.&quot;LINE_ID&quot; IS NOT NULL

apadrv-start sqlid=5681247571542508886
  :
    call(in-use=21384, alloc=32712), compile(in-use=79560, alloc=85400), execution(in-use=4664, alloc=8088)

*******************************************
Peeked values of the binds in SQL statement
*******************************************

Final query after transformations:******* UNPARSED QUERY IS *******
SELECT /*+ NO_EXPAND */
 COUNT(*) &quot;NRW&quot;,
 NULL &quot;NDK&quot;,
 SYS_OP_COUNTCHG(SUBSTRB(ROWIDTOCHAR(&quot;ORDERS_JOIN&quot;.&quot;ORL_ROWID&quot;), 1, 15), 1) &quot;CLF&quot;
  FROM &quot;U&quot;.&quot;ORDERS_JOIN&quot; &quot;ORDERS_JOIN&quot;
 WHERE &quot;ORDERS_JOIN&quot;.&quot;ORDER_ID&quot; IS NOT NULL
    OR &quot;ORDERS_JOIN&quot;.&quot;LINE_ID&quot; IS NOT NULL
...
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valentin Nikotin</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49764</link>
		<dc:creator><![CDATA[Valentin Nikotin]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 09:21:31 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49764</guid>
		<description><![CDATA[Actually it&#039;s &quot;Gathering Index Stats Fails with ORA-1760 when MVIEW is Present on the Table [ID 317254.1]&quot;]]></description>
		<content:encoded><![CDATA[<p>Actually it&#8217;s &#8220;Gathering Index Stats Fails with ORA-1760 when MVIEW is Present on the Table [ID 317254.1]&#8220;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valentin Nikotin</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49763</link>
		<dc:creator><![CDATA[Valentin Nikotin]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 09:09:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49763</guid>
		<description><![CDATA[This error happens when following SQL is executed (of course you have to put your index object_id instead of 62727).
The disabling of QUERY_REWRITE_ENABLED prevents from fail.

[sourcecode language=&quot;SQL&quot;]
select /*+ no_parallel_index(t, &quot;ORL_PK&quot;)
           dbms_stats 
           cursor_sharing_exact 
           use_weak_name_resl 
           dynamic_sampling(0) 
           no_monitoring 
           no_substrb_pad  
           no_expand 
           index(t,&quot;ORL_PK&quot;) */
       count(*) as nrw,
       count(distinct sys_op_lbid(62727, &#039;L&#039;, t.rowid)) as nlb,
       null as ndk,
       sys_op_countchg(substrb(t.rowid, 1, 15), 1) as clf
from &quot;U&quot;.&quot;ORDER_LINES&quot; t
where &quot;ORDER_ID&quot; is not null or &quot;LINE_ID&quot; is not null;
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>This error happens when following SQL is executed (of course you have to put your index object_id instead of 62727).<br />
The disabling of QUERY_REWRITE_ENABLED prevents from fail.</p>
<pre class="brush: sql; title: ; notranslate">
select /*+ no_parallel_index(t, &quot;ORL_PK&quot;)
           dbms_stats 
           cursor_sharing_exact 
           use_weak_name_resl 
           dynamic_sampling(0) 
           no_monitoring 
           no_substrb_pad  
           no_expand 
           index(t,&quot;ORL_PK&quot;) */
       count(*) as nrw,
       count(distinct sys_op_lbid(62727, 'L', t.rowid)) as nlb,
       null as ndk,
       sys_op_countchg(substrb(t.rowid, 1, 15), 1) as clf
from &quot;U&quot;.&quot;ORDER_LINES&quot; t
where &quot;ORDER_ID&quot; is not null or &quot;LINE_ID&quot; is not null;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49758</link>
		<dc:creator><![CDATA[Stefan]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 06:10:38 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49758</guid>
		<description><![CDATA[I forgot, this was on a test VM with 11.2.0.1. And alternatively a small step further instead of changing the mview, alter session set QUERY_REWRITE_ENABLED=false; will allow dbms_stats to work without an error, it seems. Maybe Oracle tries to be a little bit too clever on the rewrite part during dbms_stats..., but maybe I am also wrong.]]></description>
		<content:encoded><![CDATA[<p>I forgot, this was on a test VM with 11.2.0.1. And alternatively a small step further instead of changing the mview, alter session set QUERY_REWRITE_ENABLED=false; will allow dbms_stats to work without an error, it seems. Maybe Oracle tries to be a little bit too clever on the rewrite part during dbms_stats&#8230;, but maybe I am also wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49757</link>
		<dc:creator><![CDATA[Stefan]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 06:04:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49757</guid>
		<description><![CDATA[A first quick run through narrows (maybe) down the problem, when query rewrite on the materialized view is disabled, then it all runs through ok. 

I got no more time unfortunately for now, but may be later.]]></description>
		<content:encoded><![CDATA[<p>A first quick run through narrows (maybe) down the problem, when query rewrite on the materialized view is disabled, then it all runs through ok. </p>
<p>I got no more time unfortunately for now, but may be later.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Pythian Blog</title>
		<link>http://jonathanlewis.wordpress.com/2012/09/02/bugs-3/#comment-49749</link>
		<dc:creator><![CDATA[The Pythian Blog]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 01:00:10 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?p=9382#comment-49749</guid>
		<description><![CDATA[[...] Jonathan Lewis blogs about the bugs once again. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Jonathan Lewis blogs about the bugs once again. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
