<?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/"
	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>Learning Oracle</title>
	<atom:link href="http://learningoracle.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://learningoracle.wordpress.com</link>
	<description>Knowledge is PCTFREE</description>
	<lastBuildDate>Sun, 28 Aug 2011 00:24:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='learningoracle.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Learning Oracle</title>
		<link>http://learningoracle.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://learningoracle.wordpress.com/osd.xml" title="Learning Oracle" />
	<atom:link rel='hub' href='http://learningoracle.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Latches and Latch Contention</title>
		<link>http://learningoracle.wordpress.com/2008/02/19/latches-and-latch-contention/</link>
		<comments>http://learningoracle.wordpress.com/2008/02/19/latches-and-latch-contention/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 19:47:59 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Reading Material]]></category>
		<category><![CDATA[Write-Ups]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[latches]]></category>
		<category><![CDATA[_spin_count]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/?p=19</guid>
		<description><![CDATA[I&#8217;ve taken a short detour into the world of latch contention. I read two papers, Resolving Oracle Latch Contention and Conquering Oracle Latch Contention. The stand-out thing about these two papers is that, modulo a caveat about CPU usage, they recommend exactly opposite ways of reducing latch contention! One of Conquering&#8216;s suggestions is to decrease [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=19&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve taken a short detour into the world of latch contention. I read two papers, <i><a href="http://www.quest-pipelines.com/newsletter-v5/Resolving_Oracle_Latch_Contention.pdf" target="_blank">Resolving Oracle Latch Contention</a></i> and <i><a href="http://resources.orapub.com/product_p/latch1.htm" target="_blank">Conquering Oracle Latch Contention</a></i>. The stand-out thing about these two papers is that, <i>modulo</i> a caveat about CPU usage, they recommend exactly opposite ways of reducing latch contention! One of <i>Conquering</i>&#8216;s suggestions is to decrease the value of the parameter <i>_spin_count</i>, but <i>Resolving</i>&#8216;s main suggestion is to increase the value of <i>_spin_count</i>! Let me try to summarise what I&#8217;ve learned about latches before explaining why I think they&#8217;ve come to different conclusions about how to deal with latch contention problems.</p>
<p><u>What is a Latch?</u></p>
<p>Latches are &#8220;lightweight&#8221; mechanisms that are used to serialise access to memory structures. <i>It is not possible to queue for a latch</i> &#8211; a process either gets the latch or does not. Memory structures protected by latches include things like the buffer cache, the java pool and the library cache.</p>
<p><u>Behaviour on Latch Get Failure</u></p>
<p>When a process tries to obtain a latch, it may succeed or fail. On most hardware, the latch get operation is implemented as an atomic &#8220;test-and-set&#8221; instruction. Unlike failure to obtain a lock (which may result in a process sleeping or failing), failure to obtain a latch does not result in the process giving up the CPU. Exactly what happens when a latch is not obtained depends on the mode in which the latch was requested. If it was requested in &#8220;immediate&#8221; mode then the requesting process resumes exectuion immediately; it may then fail or carry out another action. If the latch was requested in &#8220;willing to wait&#8221; mode, then the process does not resume immediately if the latch request fails. Instead, the process starts the &#8220;spin and sleep&#8221; routine (as it&#8217;s named in <i>Conquering</i>).</p>
<p>Because of the speed at which latches are obtained and released, the latch-seeking process can remain on the CPU, and is said to be &#8220;spin-locked&#8221;. Spin-locked processes are consuming CPU, and my be preventing other processes from executing. If a spin-locked process still has not obtained the latch after <i>_spin_count</i> attempts, it will relinquish the CPU and sleep, allowing other processes to resume execution. The sleeping process will post the &#8220;latch free&#8221; wait.</p>
<p>When the sleeping process is resumed on the CPU, it will again request the latch. If it fails, it will spin again, and request again, until it has once more made <i>_spin_count</i> attempts to acquire the latch, at which point it will sleep again. The first sleep while waiting for a particular latch will be 10ms long, as will the second. Sleep lengths follow an exponential pattern, so the third and fourth are 20ms long, the fifth and sixth are 40ms long, and so on.</p>
<p><u>Parent and Child Latches</u></p>
<p>Some latches, such as the cache buffers chains latch protecting cached data blocks, have multiple children. In these cases the parent latch is not, as far as I can see, a useful object. It exists to aggregate statistics in dynamic performance views.  Where child latches exist, they offer finer granularity of locking than would otherwise be available.<br />
For instance, if there are <i>N</i> child latches protecting blocks in the buffer cache, then there can be up to <i>N</i> processes altering these blocks concurrently. Because each block &#8220;belongs&#8221; with a particular latch, it is still possible for running processes to block each other, but this becomes less likely as the granularity of the latching increases.</p>
<p><i>Oracle Wait Interface</i>[4] is confusing on the exact behaviour of processes trying to obtain latches. On page 145, it says:</p>
<blockquote><p> If a process fails to get one of the child latches in the first attempt, it will ask for the next, also with the no-wait mode. The willing-to-wait mode is used only on the last latch an when all no-wait requests against other child latches have failed.</p></blockquote>
<p>That behaviour wouldn&#8217;t make sense if the latch requested was protecting a block in the buffer cache. After all, if any of the <i>N</i> child latches was sufficient, then there could be <i>N</i> processes concurrently changing the same block! It&#8217;s been suggested to me that the above is wrong in the general case, but may be true in some specific cases like the <a href="http://www.ixora.com.au/tips/tuning/redo_latches.htm" title="Redo Latching" target="_blank">redo copy latch</a>. This seems plausible to me, but I can&#8217;t verify it.</p>
<p><u>Latch-Related System Information</u></p>
<p>There are a number of latch-related dynamic performance views.  These include:</p>
<ul>
<li><i>v$latch</i> &#8211;  lists all latches available in the system</li>
<li><i>v$latchname</i> &#8211; a straightforward translation from number to name</li>
<li><i>v$latch_parent</i> /<i>v$latch_children</i> &#8211; has nearly identical columns to <i>v$latch</i>, but de-aggregated</li>
<li><i>v$latch_misses</i> &#8211; details on where latch acquisition attempts have been missed (but see <a href="http://www.ixora.com.au/newsletter/2001_02.htm#latch_misses" title="Using V$LATCH_MISSES to characterize latching problems">Ixora article</a>)</li>
<li><i>v$latchholder</i> &#8211; contains a SID and PID for each held latch</li>
<li><i>v$event_histogram</i> &#8211; contains a histogram of waits, sorted by the event that caused them (including latches) and how many milliseconds they lasted<i><br />
</i></li>
</ul>
<p><u>Dealing With Contention</u></p>
<p><i>Resolving</i> makes the point that latch contention must be considered in the context of the whole system. If latch free waits are only a small proportion of the total waits, then there&#8217;s little to be gained by trying to eliminate them. Furthermore, it&#8217;s not the latch miss ratio that matters, but the total number of misses.</p>
<p><i>Conquering</i> takes an understanding-led approach. When dealing with latch contention, it suggests three questions:</p>
<ol>
<li>What is the use of the  memory structure protected by this latch?</li>
<li>Why do processes want to access this latch so often?</li>
<li>Why do they hold the latch so long?</li>
</ol>
<p>After understanding the cause of the problem, possible solutions should present themsleves.</p>
<p><u><i>_spin_count</i>: Up or Down?</u></p>
<p><i>Resolving</i> points out that  <i>_spin_count</i> has been an undocumented parameter since version 8i (released in 1999). Its default value, 2000, has apparently not changed in that period. Since CPUs are much faster today than they were in 1999, the time taken by a spinning process to request a latch 2000 times is much lower today than it was when the default was established. So a process that cannot obtain a much latch spends a much greater proportion of its time on modern hardware sleeping than it would have on an older hardware. This is demonstrated with the results of an experiment, where the optimum value of <i>_spin_count</i> was found to be approximately 12000.</p>
<p>Before advising against raising <i>_spin_count</i>, <i>Conquering</i> notes that by the time the DBA sees a latch free wait, the posting process has already consumed CPU time waiting for the latch. The step in the author&#8217;s reasoning that I don&#8217;t quite get is the next:</p>
<blockquote><p>&#8220;With this in mind, you may be able to see why it is very common to have latch contention when there is an operating system CPU bottleneck.&#8221;</p></blockquote>
<p>This seems back-to-front to me. I can see that:</p>
<blockquote><p>more latch contention =&gt; more CPU consumption by spinning processes =&gt; CPU bottleneck</p></blockquote>
<p>What I can&#8217;t see is that a CPU bottleneck would lead to more latch contention, unless a lot of sleeping CPU-starved processes are holding latches required by processes on the CPU. In any case, I do agree that you probably won&#8217;t want to increase <i>_spin_count</i> when there is a CPU bottleneck: this certainly would increase CPU demand, but may not increase the rate at which useful work is done.</p>
<p><u>Reading Material</u></p>
<ol>
<li><i><a href="http://www.quest-pipelines.com/newsletter-v5/Resolving_Oracle_Latch_Contention.pdf" target="_blank">Resolving Oracle Latch Contention</a>, </i>Guy Harrison</li>
<li><a href="http://resources.orapub.com/product_p/latch1.htm" target="_blank"><i>Conquering Oracle Latch Contention</i></a>, Craig Shallahamer</li>
<li>Oracle Data Dictionary Pocket Reference, D. C. Kreines. O&#8217;Reilly, 2003</li>
<li>Oracle Wait Interface: A Practical Guide to Performance Diagnostics &amp; Tuning, R. Shee, K. Deshpande,  K. Gopalakrishnan, McGraw-Hill Osborne, 2004</li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=19&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/02/19/latches-and-latch-contention/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>Recompiling Busy Package Bodies in a RAC Environment</title>
		<link>http://learningoracle.wordpress.com/2008/01/24/recompiling-busy-package-bodies-in-a-rac-environment/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/24/recompiling-busy-package-bodies-in-a-rac-environment/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 16:54:11 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[The Real World]]></category>
		<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/24/recompiling-busy-package-bodies-in-a-rac-environment/</guid>
		<description><![CDATA[In short, probably not a good idea. A package body needed to be recompiled on production. The large package body took about ten seconds to compile in QA. Obviously, nothing else went invalid or needed to be recompiled. On production, the compile seemed to hang, as it was still going on after 30s. OEM showed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=16&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In short, probably not a good idea.</p>
<p>A package body needed to be recompiled on production. The large package body took about ten seconds to compile in QA. Obviously, nothing else went invalid or needed to be recompiled.</p>
<p>On production, the compile seemed to hang, as it was still going on after 30s. OEM showed a spike in sessions working or waiting, all of which were concurrency waits. Investigating further, these were all &#8220;<a href="http://heliodias.wordpress.com/2007/08/28/library-cache-pin/" target="_blank">library cache pin</a>&#8221; waits. We killed the rebuild session from its terminal, and about two-thirds of the sessions waiting disappeared fairly quickly.</p>
<p>The remaining hundred or so sessions were all on the same node. Each was trying to execute one of two stored procedures from the package we had tried to recompile.  I looked in GV$SQL to see if there was anything significantly different about the statements in each instances memory, but this was slightly out of my depth and nothing was immediately obvious to me.</p>
<p>The waiting sessions were made to go away by being manually killed. The <a href="http://www.orafaq.com/faq/how_does_one_diagnose_and_fix_library_cache_pin_waits" title="How does one diagnose and fix 'library cache pin' waits?" target="_blank">available literature</a> on how to &#8220;fix&#8221; library cache pins generally refers to <i>x$</i> views to which I didn&#8217;t have access. Nor was DBA_BLOCKERS available.</p>
<p>What I would like to know is, what was the correct way of dealing with this? Was a lock or latch held on the package body by one of the sessions? If so, was it for a good reason, or was there a process failure of some sort? Where could I have looked for this information?</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=16&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/24/recompiling-busy-package-bodies-in-a-rac-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>Transaction Tables</title>
		<link>http://learningoracle.wordpress.com/2008/01/17/transaction-tables/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/17/transaction-tables/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 01:20:31 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/17/transaction-tables/</guid>
		<description><![CDATA[The section on undo tablespaces includes, &#8220;When the first DML operation is run within a transaction, the transaction is bound (assigned) to an undo segment (and therefore to a transaction table) in the current undo tablespace.&#8221; What&#8217;s a transaction table? I don&#8217;t recall them being mentioned before this point, and there&#8217;s no forward link from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=14&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/physical.htm#sthref506" target="_blank">section on undo tablespaces</a> includes, &#8220;When the first DML operation is run within a transaction, the transaction is bound (assigned) to an undo segment (and therefore to a transaction table) in the current undo tablespace.&#8221;</p>
<p>What&#8217;s a transaction table? I don&#8217;t recall them being mentioned before this point, and there&#8217;s no forward link from here either. It&#8217;s not in the glossary, and the index only points to a description of how they are recovered, not what they are.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=14&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/17/transaction-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>PCTUSED and PCTFREE Parameters</title>
		<link>http://learningoracle.wordpress.com/2008/01/17/pctused-and-pctfree-parameters/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/17/pctused-and-pctfree-parameters/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 01:07:42 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Write-Ups]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/17/pctused-and-pctfree-parameters/</guid>
		<description><![CDATA[The section on PCTUSED says, &#8220;The PCTUSED parameter sets the minimum percentage of a block that can be used for row data plus overhead before new rows are added to the block.&#8221; I think this is wrong, or at least badly expressed. Consider part of the description of figure 2-5, &#8220;[A]fter the amount of used [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=13&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/logical.htm#sthref352" target="_blank">section on PCTUSED</a> says, &#8220;The PCTUSED parameter sets the minimum percentage of a block that can be used for row data plus overhead before new rows are added to the block.&#8221;</p>
<p>I think this is wrong, or at least badly expressed. Consider part of the description of <a href="http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/img/cncpt031.gif" title="Maintaining the Free Space of Data Blocks with PCTFREE and PCTUSED" target="_blank">figure 2-5</a>, &#8220;[A]fter the amount of used space falls below 40%, new rows can again be inserted into this block.&#8221; This makes me think that PCTUSED is a maximum, rather than a minimum. The idea is quite hard to express clearly in writing; I think the diagrams are much more useful here.</p>
<p>I always had trouble keeping PCTUSED and PCTFREE apart in my mind, until I read the best sentence in this section, &#8220;[U]pdates can reduce the available space of a block to less than <i>PCTFREE, the space reserved for updates but not accesible to inserts.</i>&#8220;</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=13&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/17/pctused-and-pctfree-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>Table Directory in Row Header</title>
		<link>http://learningoracle.wordpress.com/2008/01/15/table-directory-in-row-header/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/15/table-directory-in-row-header/#comments</comments>
		<pubDate>Tue, 15 Jan 2008 07:16:54 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/15/table-directory-in-row-header/</guid>
		<description><![CDATA[Apparently part of the header of each data block is the table directory, which contains information about the table that this block forms part of. Why would Oracle want to write something about tables into every data block? Why not allow this information to remain in the data dictionary or the segment header? Is it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=12&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Apparently part of the header of each data block is the <i>table directory</i>, which <a href="http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/logical.htm#sthref312" title="Table Directory" target="_blank">contains information about the table that this block forms part of</a>.</p>
<p>Why would Oracle want to write something about tables into every data block? Why not allow this information to remain in the data dictionary or the segment header? Is it here for efficiency purposes?</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=12&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/15/table-directory-in-row-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>RAC Redo Recovery</title>
		<link>http://learningoracle.wordpress.com/2008/01/13/rac-redo-recovery/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/13/rac-redo-recovery/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 20:05:28 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/13/rac-redo-recovery/</guid>
		<description><![CDATA[According to 1-23 of the Concepts Manual, &#8220;After an instance failure, Oracle automatically performs instance recovery. If one instance in a RAC environment fails, then another instance recovers the redo for the failed instance.&#8221; For this to work, I guess that each instance must keep its redo logs on the shared storage (no use of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=11&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>According to 1-23 of the <a href="http://learningoracle.wordpress.com/2008/01/12/current-reading-concepts-manual/" target="_blank">Concepts Manual</a>, &#8220;After an instance failure, Oracle automatically performs instance recovery. If one instance in a RAC environment fails, then another instance recovers the redo for the failed instance.&#8221;</p>
<p>For this to work, I guess that each instance must keep its redo logs on the shared storage (no use of locally-attached storage, which I believe is possible in 11g). Each instance must also know which log files belong to which other instance.</p>
<p>As far as  I can see, there also must be a way of distinguishing how much of the logged changes have already been stored &#8220;properly&#8221;, and how many remain to be written. This would be true in a RAC or a single-node environment. The first possibility that occurs is that the process of writing changes back to disk is also logged.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=11&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/13/rac-redo-recovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>Query Isolation</title>
		<link>http://learningoracle.wordpress.com/2008/01/13/query-isolation/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/13/query-isolation/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 17:21:06 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/13/query-isolation/</guid>
		<description><![CDATA[Is query isolation (or transaction isolation) achieved by storing an SCN with the running query (or transaction)? I guess this would be the easiest way to identify which parts of the undo to note and which to ignore when creating a consistent view of the data.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=10&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Is query isolation (or transaction isolation) achieved by storing an SCN with the running query (or transaction)? I guess this would be the easiest way to identify which parts of the undo to note and which to ignore when creating a consistent view of the data.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=10&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/13/query-isolation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>Redo Log Buffer</title>
		<link>http://learningoracle.wordpress.com/2008/01/13/redo-log-buffer/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/13/redo-log-buffer/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 17:18:43 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/13/redo-log-buffer/</guid>
		<description><![CDATA[In this buffer are entries for the redo log that haven&#8217;t yet been written to permanent storage. I assume that anything in here stands to be lost if there&#8217;s a hardware failure.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=9&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this buffer are entries for the redo log that haven&#8217;t yet been written to permanent storage. I assume that anything in here stands to be lost if there&#8217;s a hardware failure.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=9&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/13/redo-log-buffer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>Alert Log</title>
		<link>http://learningoracle.wordpress.com/2008/01/13/alert-log/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/13/alert-log/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 17:04:40 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/13/alert-log/</guid>
		<description><![CDATA[What goes into the alert log? What gets left out? Page 1-9 says, &#8220;The alert log of a database is a chronological log of messages and errors.&#8221; Does that mean that messages from all Oracle processes get written to the log?<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=8&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What goes into the alert log? What gets left out? Page 1-9 says, &#8220;The alert log of a database is a chronological log of messages and errors.&#8221; Does that mean that messages from all Oracle processes get written to the log?</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=8&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/13/alert-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
		<item>
		<title>Updatability and Analytic Functions</title>
		<link>http://learningoracle.wordpress.com/2008/01/13/updatability-and-analytic-functions/</link>
		<comments>http://learningoracle.wordpress.com/2008/01/13/updatability-and-analytic-functions/#comments</comments>
		<pubDate>Sun, 13 Jan 2008 02:12:33 +0000</pubDate>
		<dc:creator>ealing</dc:creator>
				<category><![CDATA[Unanswered Questions]]></category>

		<guid isPermaLink="false">http://learningoracle.wordpress.com/2008/01/13/updatability-and-analytic-functions/</guid>
		<description><![CDATA[Not really a question, more an annoyance: Oracle won&#8217;t correctly determine which columns &#8211; if any- in a view are updatable once analytics are involved. A table will not be regarded as key-preserved by Oracle in a view if analytic functions are invoked on it in a sub-select: SQL&#62; drop table analytic_test_a; Table dropped SQL&#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=7&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Not really a question, more an annoyance: Oracle won&#8217;t correctly determine which columns &#8211; if any- in a view are updatable once analytics are involved.</p>
<p>A table will not be regarded as key-preserved by Oracle in a view if analytic functions are invoked on it in a sub-select:</p>
<blockquote><p>SQL&gt; drop table analytic_test_a;</p>
<p>Table dropped</p>
<p>SQL&gt; drop table analytic_test_b;</p>
<p>Table dropped</p>
<p>SQL&gt; drop view analytic_test_view_1;</p>
<p>View dropped</p>
<p>SQL&gt; drop view analytic_test_view_2;</p>
<p>View dropped</p>
<p>SQL&gt; drop view analytic_test_view_1s;</p>
<p>View dropped</p>
<p>SQL&gt; drop view analytic_test_view_2s;</p>
<p>View dropped</p>
<p>SQL&gt; create table analytic_test_a as<br />
2  select o.object_id, o.object_name, o.created<br />
3  from user_objects o<br />
4  where o.object_type in (&#8216;TABLE&#8217;,'VIEW&#8217;);</p>
<p>Table created</p>
<p>SQL&gt; alter table ANALYTIC_TEST_A<br />
2    add constraint ANALYTIC_TEST_A_PK primary key (OBJECT_NAME);</p>
<p>Table altered</p>
<p>SQL&gt; create table analytic_test_b as<br />
2  select t.table_name, t.tablespace_name, t.pct_free<br />
3  from all_tables t;</p>
<p>Table created</p>
<p>SQL&gt; create view analytic_test_view_1 as<br />
2  select *<br />
3  from analytic_test_a a,<br />
4       analytic_test_b b<br />
5  where b.table_name = a.object_name;</p>
<p>View created</p>
<p>SQL&gt; create view analytic_test_view_2 as<br />
2  select a.*, b.*, min(OBJECT_ID) over (partition by TABLESPACE_NAME) min_id<br />
3  from analytic_test_a a,<br />
4       analytic_test_b b<br />
5  where b.table_name = a.object_name;</p>
<p>View created</p>
<p>SQL&gt; select *<br />
2  from user_updatable_columns c<br />
3  where lower(c.table_name) = &#8216;analytic_test_view_1&#8242;;</p>
<p>OWNER                          TABLE_NAME                     COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1           OBJECT_ID                      NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1           OBJECT_NAME                    NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1           CREATED                        NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1           TABLE_NAME                     YES       YES        YES<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1           TABLESPACE_NAME                YES       YES        YES<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1           PCT_FREE                       YES       YES        YES</p>
<p>6 rows selected</p>
<p>SQL&gt; select *<br />
2  from user_updatable_columns c<br />
3  where lower(c.table_name) = &#8216;analytic_test_view_2&#8242;;</p>
<p>OWNER                          TABLE_NAME                     COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2           OBJECT_ID                      NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2           OBJECT_NAME                    NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2           CREATED                        NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2           TABLE_NAME                     YES       YES        YES<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2           TABLESPACE_NAME                YES       YES        YES<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2           PCT_FREE                       YES       YES        YES<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2           MIN_ID                         NO        NO         NO</p>
<p>7 rows selected</p>
<p>SQL&gt; create view analytic_test_view_1s as<br />
2  select *<br />
3  from analytic_test_view_1;</p>
<p>View created</p>
<p>SQL&gt; select *<br />
2  from user_updatable_columns c<br />
3  where lower(c.table_name) = &#8216;analytic_test_view_1s&#8217;;</p>
<p>OWNER                          TABLE_NAME                     COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1S          OBJECT_ID                      NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1S          OBJECT_NAME                    NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1S          CREATED                        NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1S          TABLE_NAME                     YES       YES        YES<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1S          TABLESPACE_NAME                YES       YES        YES<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_1S          PCT_FREE                       YES       YES        YES</p>
<p>6 rows selected</p>
<p>SQL&gt; create view analytic_test_view_2s as<br />
2  select *<br />
3  from analytic_test_view_2;</p>
<p>View created</p>
<p>SQL&gt; select *<br />
2  from user_updatable_columns c<br />
3  where lower(c.table_name) = &#8216;analytic_test_view_2s&#8217;;</p>
<p>OWNER                          TABLE_NAME                     COLUMN_NAME                    UPDATABLE INSERTABLE DELETABLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2S          OBJECT_ID                      NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2S          OBJECT_NAME                    NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2S          CREATED                        NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2S          TABLE_NAME                     NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2S          TABLESPACE_NAME                NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2S          PCT_FREE                       NO        NO         NO<br />
BARTOJ_DEV                     ANALYTIC_TEST_VIEW_2S          MIN_ID                         NO        NO         NO</p>
<p>7 rows selected</p>
<p>SQL&gt;</p></blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/learningoracle.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/learningoracle.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningoracle.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningoracle.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningoracle.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningoracle.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningoracle.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningoracle.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningoracle.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningoracle.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningoracle.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningoracle.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningoracle.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningoracle.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningoracle.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningoracle.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningoracle.wordpress.com&amp;blog=2506385&amp;post=7&amp;subd=learningoracle&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningoracle.wordpress.com/2008/01/13/updatability-and-analytic-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/101cd263128675359902eacfcf457d94?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ealing</media:title>
		</media:content>
	</item>
	</channel>
</rss>
