<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ora-solutions.net - Martin Decker &#187; admin</title>
	<atom:link href="http://www.ora-solutions.net/web/author/admin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ora-solutions.net/web</link>
	<description>Indepented Oracle consultant</description>
	<lastBuildDate>Wed, 25 Jan 2012 14:04:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Performance Degradation for Query on DBA_SEGMENTS.BYTES in 11gR2</title>
		<link>http://www.ora-solutions.net/web/2011/07/18/performance-degradation-for-query-on-dba_segments-bytes-in-11gr2/</link>
		<comments>http://www.ora-solutions.net/web/2011/07/18/performance-degradation-for-query-on-dba_segments-bytes-in-11gr2/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 14:21:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[11gR2]]></category>
		<category><![CDATA[MetaLink]]></category>
		<category><![CDATA[Oracle Database]]></category>
		<category><![CDATA[Performance Tuning]]></category>

		<guid isPermaLink="false">http://www.ora-solutions.net/web/?p=1085</guid>
		<description><![CDATA[I have been troubleshooting a performance issue in a DWH environment, which is quite interesting. It was a query on DBA_SEGMENTS in 11gR2 with lots of partitions and it was taking almost 10 minutes versus only a few seconds in 10gR2. The problem could be stripped downt to this SQL query:]]></description>
			<content:encoded><![CDATA[<p>I have been troubleshooting a performance issue in a DWH environment, which is quite interesting. It was a query on DBA_SEGMENTS in 11gR2 with lots of partitions and it was taking almost 10 minutes versus only a few seconds in 10gR2. The problem could be stripped downt to this SQL query:</p>
<pre lang=SQL">select bytes from dba_segments</pre>
<p>The dba_segment view can be seen in DBA_VIEWS:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">...</span>
       decode<span style="color: #66cc66;">&#40;</span>bitand<span style="color: #66cc66;">&#40;</span>segment_flags<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">131072</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">131072</span><span style="color: #66cc66;">,</span> blocks<span style="color: #66cc66;">,</span>
           <span style="color: #66cc66;">&#40;</span>decode<span style="color: #66cc66;">&#40;</span>bitand<span style="color: #66cc66;">&#40;</span>segment_flags<span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span>
            <span style="color: #66cc66;">&lt;</span>strong<span style="color: #66cc66;">&gt;</span>dbms_space_admin<span style="color: #66cc66;">.</span>segment_number_blocks<span style="color: #66cc66;">&lt;/</span>strong<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span>tablespace_id<span style="color: #66cc66;">,</span> relative_fno<span style="color: #66cc66;">,</span>
            header_block<span style="color: #66cc66;">,</span> segment_type_id<span style="color: #66cc66;">,</span> buffer_pool_id<span style="color: #66cc66;">,</span> segment_flags<span style="color: #66cc66;">,</span>
            segment_objd<span style="color: #66cc66;">,</span> blocks<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> blocks<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span>blocksize<span style="color: #66cc66;">,</span>
      <span style="color: #66cc66;">...</span>
<span style="color: #993333; font-weight: bold;">FROM</span> sys_dba_segs</pre></div></div>

<p>The response time was dominated by Waits for &#8220;db file sequential reads&#8221; taking almost all of the response time.</p>
<p><strong>11gR2:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch    12563     23.17     546.74     157447     580414          1      188421
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total    12565     23.17     546.74     157447     580414          1      188421</pre></div></div>

<p><strong>10gR2:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.06       0.06          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch     5104      1.77       2.54          0      96688          0       76542
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total     5106      1.83       2.61          0      96688          0       76542</pre></div></div>

<p>The 10046 Trace File contains more data regarding those waits:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">WAIT #4: nam='db file sequential read' ela= 134 file#=21 block#=2313482 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 120 file#=15 block#=2128019 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 128 file#=21 block#=2313490 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 372 file#=21 block#=2313498 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 108 file#=21 block#=2313506 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 130 file#=21 block#=2313514 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 132 file#=21 block#=2313522 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 121 file#=21 block#=2313530 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 158 file#=15 block#=2128003 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 146 file#=21 block#=2313538 blocks=1 obj#=-1 
WAIT #4: nam='db file sequential read' ela= 116 file#=21 block#=2313546 blocks=1 obj#=-1 
(Output modified for formatting)</pre></div></div>

<p>Strange thing that obj# is -1. I made some block dumps of those blocks and found out that all those blocks (file#/block#) have something in common: They were all segment header blocks. Another strange thing was that when the query was executed a second time, all those I/O requests were performed again &#8211; so no caching. </p>
<p>At that point, I opened a Support service request. After a couple of weeks, Support suggested running this for each tablespace of the user segments:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">exec  dbms_space_admin<span style="color: #66cc66;">.</span>TABLESPACE_FIX_SEGMENT_EXTBLKS<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'&lt;tablespace_name&gt;'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Finally this fixed the problem. Now, we are trying to find out why this was necessary for a database, that was freshly created with dbca 11.2.0.2 from the seeded template and filled with data pump import.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ora-solutions.net/web/2011/07/18/performance-degradation-for-query-on-dba_segments-bytes-in-11gr2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

