<?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: OC 6 Writing and Recovery</title>
	<atom:link href="http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Thu, 23 May 2013 12:47:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Martin</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-54185</link>
		<dc:creator><![CDATA[Martin]]></dc:creator>
		<pubDate>Mon, 18 Mar 2013 22:44:45 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-54185</guid>
		<description><![CDATA[Hello Jonathan,

Starting on page 151 you describe the scenario that leads to the &quot;log file switch (private strand flush incomplete)&quot; message in the alert log. I think I got the big picture, but there are a couple of things I didn&#039;t understand.

1) What does &quot;triggers a log file switch prematurely&quot; exactly mean in the context it appears on page 151 - does LGWR start writing into the new log file at this very moment or does it mean the processing you describe subsequently (DBWR flushing private redo ...) is initiated?

2) After the log file switch is triggered prematurely, DBWR flushes private redo into the public buffers as you describe on page 152. How does the redo finally get into the (old) redo log file? Is it DBWR that (exceptionally) writes this data into the redo log files (as you write &quot;the database writer gets it [the redo data] there [into the log file]&quot;) or is it LGWR? However, if it was LGWR, wouldn&#039;t the data end up in the new log file, as the log file switch has already happened (see question 1)?

3) When Oracle decides at moment t to switch from log file L1 to log file L2, I believe it must ensure that (i) everything that was in the private or public redo buffers at time t will go into log file L1 and that (ii) no redo generated after time t will go into log file L1. (i) is to ensure that all the redo records in each log file are between this file&#039;s starting SCN and the following file&#039;s starting SCN as you describe on page 151 (I don&#039;t understand exactly why this is necessary, but it seems plausible that e.g. in some scenarios the code needs to be sure it got all redo records up to a certain SCN). (ii) I believe is necessary to ensure that L1 can be safely overwritten once the corresponding media recovery checkpoint completes (as DBWR will have written to disk the data blocks that were modified up to time t, but blocks modified more recently may still not be up to date in the datafiles).
Does that imply that Oracle will stop redo generation for all sessions (not only those using private redo) until the private strands are flushed into the public redo buffers? This might be necessary to prevent some redo generated before time t from ending up in log file L2 despite the space that was reserved in L1 at the premature log file switch (which would compromise (i)) and also to prevent new redo generated after time t to end up in L1 (which would compromise (ii)). Does Oracle even stop such redo generation until the LGWR has written the entire public redo buffers (including the flushed content from the private redo buffers) into log file L1 or are there other ways (i.e. telling the LGWR after which redo buffer entry it should start writing into the new log file L2)?


Than you
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>Starting on page 151 you describe the scenario that leads to the &#8220;log file switch (private strand flush incomplete)&#8221; message in the alert log. I think I got the big picture, but there are a couple of things I didn&#8217;t understand.</p>
<p>1) What does &#8220;triggers a log file switch prematurely&#8221; exactly mean in the context it appears on page 151 &#8211; does LGWR start writing into the new log file at this very moment or does it mean the processing you describe subsequently (DBWR flushing private redo &#8230;) is initiated?</p>
<p>2) After the log file switch is triggered prematurely, DBWR flushes private redo into the public buffers as you describe on page 152. How does the redo finally get into the (old) redo log file? Is it DBWR that (exceptionally) writes this data into the redo log files (as you write &#8220;the database writer gets it [the redo data] there [into the log file]&#8220;) or is it LGWR? However, if it was LGWR, wouldn&#8217;t the data end up in the new log file, as the log file switch has already happened (see question 1)?</p>
<p>3) When Oracle decides at moment t to switch from log file L1 to log file L2, I believe it must ensure that (i) everything that was in the private or public redo buffers at time t will go into log file L1 and that (ii) no redo generated after time t will go into log file L1. (i) is to ensure that all the redo records in each log file are between this file&#8217;s starting SCN and the following file&#8217;s starting SCN as you describe on page 151 (I don&#8217;t understand exactly why this is necessary, but it seems plausible that e.g. in some scenarios the code needs to be sure it got all redo records up to a certain SCN). (ii) I believe is necessary to ensure that L1 can be safely overwritten once the corresponding media recovery checkpoint completes (as DBWR will have written to disk the data blocks that were modified up to time t, but blocks modified more recently may still not be up to date in the datafiles).<br />
Does that imply that Oracle will stop redo generation for all sessions (not only those using private redo) until the private strands are flushed into the public redo buffers? This might be necessary to prevent some redo generated before time t from ending up in log file L2 despite the space that was reserved in L1 at the premature log file switch (which would compromise (i)) and also to prevent new redo generated after time t to end up in L1 (which would compromise (ii)). Does Oracle even stop such redo generation until the LGWR has written the entire public redo buffers (including the flushed content from the private redo buffers) into log file L1 or are there other ways (i.e. telling the LGWR after which redo buffer entry it should start writing into the new log file L2)?</p>
<p>Than you<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-54182</link>
		<dc:creator><![CDATA[Martin]]></dc:creator>
		<pubDate>Mon, 18 Mar 2013 21:37:40 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-54182</guid>
		<description><![CDATA[Hello Jonathan,

On page 139 you describe how a buffer is getting on the checkpoint queue when it becomes dirty. You also write that the buffer&#039;s LRBA is set - I understand this as being the Redo Block Address of the change record describing the change that made the buffer dirty. However, at the moment the buffer becomes dirty, this change record has not necessarily been written to the redo logs - it may still be in one of the (potentially multiple) log buffers. How can Oracle at this moment determine the Redo Block Address this record is going to be written to? This becomes even more difficult when taking into account the possibility that redo from private redo buffers may yet have to be flushed into one of the public redo log buffers and may thus end up in the redo log files before or after the change record mentioned before depending on the public redo log buffer it is written to and the order in which LGWR will write the public redo logs to disk.
Could it be (this is just a guess) that for the purpose of checkpointing it is sufficient to have a lower bound of what I understood to be the LRBA, in which case it might be the Redo Block Address last written by LGWR at the moment the buffer became dirty?

thank you
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>On page 139 you describe how a buffer is getting on the checkpoint queue when it becomes dirty. You also write that the buffer&#8217;s LRBA is set &#8211; I understand this as being the Redo Block Address of the change record describing the change that made the buffer dirty. However, at the moment the buffer becomes dirty, this change record has not necessarily been written to the redo logs &#8211; it may still be in one of the (potentially multiple) log buffers. How can Oracle at this moment determine the Redo Block Address this record is going to be written to? This becomes even more difficult when taking into account the possibility that redo from private redo buffers may yet have to be flushed into one of the public redo log buffers and may thus end up in the redo log files before or after the change record mentioned before depending on the public redo log buffer it is written to and the order in which LGWR will write the public redo logs to disk.<br />
Could it be (this is just a guess) that for the purpose of checkpointing it is sufficient to have a lower bound of what I understood to be the LRBA, in which case it might be the Redo Block Address last written by LGWR at the moment the buffer became dirty?</p>
<p>thank you<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-54181</link>
		<dc:creator><![CDATA[Martin]]></dc:creator>
		<pubDate>Mon, 18 Mar 2013 21:20:27 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-54181</guid>
		<description><![CDATA[Hello Jonathan,

On page 141 you describe the scenario where LGWR is stuck because it cannot overwrite a redo log that contains changes that where not yet written to the data files by DBWR. You mention &quot;... occasionally it means you need a faster device for your redo logs&quot;. Shouldn&#039;t that say &quot;...you need a faster device for your data files&quot;. As I understand it, the redo logs are already written too fast in this scenario (relatively speaking), thus I would not expect a faster device for the redo logs to relieve the problem.

Thank you for clarification
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>On page 141 you describe the scenario where LGWR is stuck because it cannot overwrite a redo log that contains changes that where not yet written to the data files by DBWR. You mention &#8220;&#8230; occasionally it means you need a faster device for your redo logs&#8221;. Shouldn&#8217;t that say &#8220;&#8230;you need a faster device for your data files&#8221;. As I understand it, the redo logs are already written too fast in this scenario (relatively speaking), thus I would not expect a faster device for the redo logs to relieve the problem.</p>
<p>Thank you for clarification<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-54119</link>
		<dc:creator><![CDATA[Martin]]></dc:creator>
		<pubDate>Thu, 14 Mar 2013 19:49:13 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-54119</guid>
		<description><![CDATA[Hello Jonathan,

Thank you for your reply. So if I understand correctly, the scenario is one possible side effect of what you describe in the section &quot;ACID Anomaly&quot; starting on page 129? I am however surprised that Oracle tries to rectify this side effect (by reordering redo records before applying them) but does not address the root problem (ACID anomaly) itself. Are there maybe other scenarios which justify / necessitate the reordering of redo records during recovery?

kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>Thank you for your reply. So if I understand correctly, the scenario is one possible side effect of what you describe in the section &#8220;ACID Anomaly&#8221; starting on page 129? I am however surprised that Oracle tries to rectify this side effect (by reordering redo records before applying them) but does not address the root problem (ACID anomaly) itself. Are there maybe other scenarios which justify / necessitate the reordering of redo records during recovery?</p>
<p>kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-54117</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Thu, 14 Mar 2013 14:26:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-54117</guid>
		<description><![CDATA[Martin,

At the hypothetical level given in the manuals you&#039;re correct. In fact Tony&#039;s starting scenario is possible because of a time-lag that he and I have both blogged about elsewhere.

When a session issues a commit (on a small transaction), the sequence of events is this:

	&lt;li&gt;copy private redo  buffer to public log buffer
apply changes to data buffers
post message to lgwr to write
wait for callback&lt;/li&gt;

Note particularly that the transaction IS visibly committed by the change applied to the undo segment header being applied before the log writer has been called.

Because of this it would be possible for a second transaction to see the results of the first committed (unwritten) transactions, and so on.

It would, of course, be hard to prove that this had happened - but it would be easy to make it happen by mixing some very rapid, high volume updates in one session while performing some highly concurrent, very small transactions from another.  As some point lgwr would be busy doing a large write to the log file giving the high frequency sessions time to go through Tony&#039;s scenario.]]></description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>At the hypothetical level given in the manuals you&#8217;re correct. In fact Tony&#8217;s starting scenario is possible because of a time-lag that he and I have both blogged about elsewhere.</p>
<p>When a session issues a commit (on a small transaction), the sequence of events is this:</p>
<li>copy private redo  buffer to public log buffer<br />
apply changes to data buffers<br />
post message to lgwr to write<br />
wait for callback</li>
<p>Note particularly that the transaction IS visibly committed by the change applied to the undo segment header being applied before the log writer has been called.</p>
<p>Because of this it would be possible for a second transaction to see the results of the first committed (unwritten) transactions, and so on.</p>
<p>It would, of course, be hard to prove that this had happened &#8211; but it would be easy to make it happen by mixing some very rapid, high volume updates in one session while performing some highly concurrent, very small transactions from another.  As some point lgwr would be busy doing a large write to the log file giving the high frequency sessions time to go through Tony&#8217;s scenario.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Maletinsky</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-54114</link>
		<dc:creator><![CDATA[Martin Maletinsky]]></dc:creator>
		<pubDate>Thu, 14 Mar 2013 09:18:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-54114</guid>
		<description><![CDATA[Hello,

If I understand correctly the term &quot;dependent transactions&quot; it implies that T1 commits before T2 makes any changes which depend on changes made by T1 and T2 commits before T3 makes any changes depending on changes made by T2. If this is correct, than I believe the scenario described by Tony Hasler would not be possible however.
If T1 commits before T2 makes any modification depending on T1 then all redo records generated by T1 will be written to the redo log files before any redo records are generated for the dependent modifications made by T2 and idem for T2/T3, no matter which redo strands are used by the transactions.
Did I misunderstand something?

Example:
Assume transactions T1, T2, T3 which consecutively increment the value of one column for one row in a table i.e. &quot;UPDATE T SET VAL=VAL+1 WHERE ID=:X;&quot;. It is my understanding that this is what is ment by &quot;dependent transactions&quot; as mentioned in the scenario described by Tony Hasler.
In this example T2 cannot lock the row in table T until T1 will have committed. I would assume that T2 will not generate any redo for the increment of T.VAL until it has locked the corresponding row. Once T2 can lock the row, this impiles that T1 has committed (or rolled back) and thus all redo records generated by T1 are in the redo log file, i.e. the redo records generated by T2 for the modification (increment) of the column value will be placed after the redo records generated by T1 in the redo log file.

Thank you for clarification
kind regards
Martin]]></description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>If I understand correctly the term &#8220;dependent transactions&#8221; it implies that T1 commits before T2 makes any changes which depend on changes made by T1 and T2 commits before T3 makes any changes depending on changes made by T2. If this is correct, than I believe the scenario described by Tony Hasler would not be possible however.<br />
If T1 commits before T2 makes any modification depending on T1 then all redo records generated by T1 will be written to the redo log files before any redo records are generated for the dependent modifications made by T2 and idem for T2/T3, no matter which redo strands are used by the transactions.<br />
Did I misunderstand something?</p>
<p>Example:<br />
Assume transactions T1, T2, T3 which consecutively increment the value of one column for one row in a table i.e. &#8220;UPDATE T SET VAL=VAL+1 WHERE ID=:X;&#8221;. It is my understanding that this is what is ment by &#8220;dependent transactions&#8221; as mentioned in the scenario described by Tony Hasler.<br />
In this example T2 cannot lock the row in table T until T1 will have committed. I would assume that T2 will not generate any redo for the increment of T.VAL until it has locked the corresponding row. Once T2 can lock the row, this impiles that T1 has committed (or rolled back) and thus all redo records generated by T1 are in the redo log file, i.e. the redo records generated by T2 for the modification (increment) of the column value will be placed after the redo records generated by T1 in the redo log file.</p>
<p>Thank you for clarification<br />
kind regards<br />
Martin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tonyhasler</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-45439</link>
		<dc:creator><![CDATA[tonyhasler]]></dc:creator>
		<pubDate>Mon, 12 Mar 2012 10:41:59 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-45439</guid>
		<description><![CDATA[Jonathan,

Timur&#039;s references do, in fact, explain everything.  I had found the patent for the previous OPS mechanism (with the default few second delay) but had searched in vain for a description of anything new.  The records are indeed cached and sorted before application.  Not only does this sort out the issues I raised but also allows a) records confirming the writing of a data block to disk to avoid any attempt to apply redo  generated earleir and b) blocks to be updated in order optimising head movements.  This algorithm isn&#039;t rocket science but obviously only becomes practical with modern high memory systems.  I haven&#039;t read the patents in detail yet but do intend to.  Seems like the contents would make for a good user group masterclass one day!]]></description>
		<content:encoded><![CDATA[<p>Jonathan,</p>
<p>Timur&#8217;s references do, in fact, explain everything.  I had found the patent for the previous OPS mechanism (with the default few second delay) but had searched in vain for a description of anything new.  The records are indeed cached and sorted before application.  Not only does this sort out the issues I raised but also allows a) records confirming the writing of a data block to disk to avoid any attempt to apply redo  generated earleir and b) blocks to be updated in order optimising head movements.  This algorithm isn&#8217;t rocket science but obviously only becomes practical with modern high memory systems.  I haven&#8217;t read the patents in detail yet but do intend to.  Seems like the contents would make for a good user group masterclass one day!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-45427</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Mon, 12 Mar 2012 08:10:48 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-45427</guid>
		<description><![CDATA[Here&#039;s a question from Tony Hasler, orignally posted under the main index page for Oracle Core - but copied and answered here.

&lt;blockquote&gt;&lt;em&gt;I am not sure if this question belongs here or in chapter 6 but here goes.
 
I am thoroughly confused by the concept of multiple public redo strands. Suppose three dependent transactions occur in the order T1 , T2, T3. Suppose the redo data for T1 and T3 are placed in one public redo strand and the redo data for transaction T2 gets placed in another. It seems that the redo log will eventaully contain the data in the order T1, T3, T2 or T2, T1, T3 depending on which strand’s buffer is written out by LGWR first. This would seem to suggest that any recovery process would need to have some mechanism for looking ahead and reordering redo before applying it but I have never heard of such a thing. I am similarly confused about how dependent transactions in RAC are recovered.
 
Can you help me out?&lt;/em&gt;&lt;/blockquote&gt;

Tony,
Your assumption about recovery having to &quot;look ahead&quot; and reordering redo before applying it is, I believe, correct; and your mention of RAC is extremely pertinent. When the question originally came up about how Oracle could handle recovery from parallel threads the first answer I heard was &quot;it&#039;s been doing it for years with RAC&quot;.

There are a couple of public clues about the mechanism - there is a statistic called &quot;redo ordering marks&quot; which is a little suggestive, and there has been a KK lock type for ages that is used as the &quot;Kick&quot; lock when one RAC instance forces another instance to switch log files in order to keep the log file sequences close to each other. Beyond that I don&#039;t have any details - I could do some hand-waving and produce a hypothesis, but with your previous experience in designing logging mechanisms you could probably do at least as well as I could.

The patents supplied by Timur may contain the information you need - but I haven&#039;t read them yet.

Reply made by Timuy Akhmadeev to Tony&#039;s question at its original location:
&lt;em&gt;

&lt;blockquote&gt;Take a look at patents http://www.google.com/patents/US5974425 and http://www.google.com/patents/US7039773.&lt;/blockquote&gt;&lt;/em&gt;









]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s a question from Tony Hasler, orignally posted under the main index page for Oracle Core &#8211; but copied and answered here.</p>
<blockquote><p><em>I am not sure if this question belongs here or in chapter 6 but here goes.</p>
<p>I am thoroughly confused by the concept of multiple public redo strands. Suppose three dependent transactions occur in the order T1 , T2, T3. Suppose the redo data for T1 and T3 are placed in one public redo strand and the redo data for transaction T2 gets placed in another. It seems that the redo log will eventaully contain the data in the order T1, T3, T2 or T2, T1, T3 depending on which strand’s buffer is written out by LGWR first. This would seem to suggest that any recovery process would need to have some mechanism for looking ahead and reordering redo before applying it but I have never heard of such a thing. I am similarly confused about how dependent transactions in RAC are recovered.</p>
<p>Can you help me out?</em></p></blockquote>
<p>Tony,<br />
Your assumption about recovery having to &#8220;look ahead&#8221; and reordering redo before applying it is, I believe, correct; and your mention of RAC is extremely pertinent. When the question originally came up about how Oracle could handle recovery from parallel threads the first answer I heard was &#8220;it&#8217;s been doing it for years with RAC&#8221;.</p>
<p>There are a couple of public clues about the mechanism &#8211; there is a statistic called &#8220;redo ordering marks&#8221; which is a little suggestive, and there has been a KK lock type for ages that is used as the &#8220;Kick&#8221; lock when one RAC instance forces another instance to switch log files in order to keep the log file sequences close to each other. Beyond that I don&#8217;t have any details &#8211; I could do some hand-waving and produce a hypothesis, but with your previous experience in designing logging mechanisms you could probably do at least as well as I could.</p>
<p>The patents supplied by Timur may contain the information you need &#8211; but I haven&#8217;t read them yet.</p>
<p>Reply made by Timuy Akhmadeev to Tony&#8217;s question at its original location:<br />
<em></p>
<blockquote><p>Take a look at patents <a href="http://www.google.com/patents/US5974425" rel="nofollow">http://www.google.com/patents/US5974425</a> and <a href="http://www.google.com/patents/US7039773" rel="nofollow">http://www.google.com/patents/US7039773</a>.</p></blockquote>
<p></em></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-43701</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Wed, 28 Dec 2011 19:10:53 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-43701</guid>
		<description><![CDATA[Charles,

Thanks for that. It prompted me to add a little note to the Addenda for the Appendix showing how to generate an up to date list of events in the10,000 range since that&#039;s one of the things I used from time to time when investigating problems.

I think event 10120 changed it&#039;s meaning in the 8.1 time scale, the &quot;CBO Index fast full scan&quot; may have beeen the v7 and 8.0 effect, but I no longer have copies of those versions around to check. It&#039;s a useful reminded, of course, that the events are (a) undocumented and (b) subject to change with no notice.

I&#039;ve also pointed outin the addenda for this chapter your follow-up detail that &quot;relative&quot; file number is nominally &quot;relative to tablespace&quot; - although when you look closely the numbering isn&#039;t anything that would match what most people would think of as &quot;relative&quot; since Oracle doesn&#039;t start each tablespace at (relative) file number 1.

There&#039;s plenty of scope for error when working with file numbers - for example, rowids show relative file numbers, not absolute file numbers:
[sourcecode gutter=&quot;false&quot;]
SQL&gt; select rowid from t1;

ROWID
------------------
AAAYHMAAGAAAACKAAA

1 row selected.

SQL&gt; select rowid from t2;

ROWID
------------------
AAAYHLAAGAAAAAZAAA

1 row selected.
[/sourcecode]

The format of the rowid is:  {data_object_id[6]} {relative_file_number[3]} {block number[6]} {rownumber[3]} so, in this case, both rowids come from relative file &lt;strong&gt;AAG&lt;/strong&gt; (which translates into relative file 6 - which I can count to since AAA corresponds to zero). 

Since I happen to know that the two tables are in different tablespaces Oracle has to have some way of working out that there are two different absolute file numbers involved - and it can do this through the data object id, which can be used to determine the tablespace number for the segment.]]></description>
		<content:encoded><![CDATA[<p>Charles,</p>
<p>Thanks for that. It prompted me to add a little note to the Addenda for the Appendix showing how to generate an up to date list of events in the10,000 range since that&#8217;s one of the things I used from time to time when investigating problems.</p>
<p>I think event 10120 changed it&#8217;s meaning in the 8.1 time scale, the &#8220;CBO Index fast full scan&#8221; may have beeen the v7 and 8.0 effect, but I no longer have copies of those versions around to check. It&#8217;s a useful reminded, of course, that the events are (a) undocumented and (b) subject to change with no notice.</p>
<p>I&#8217;ve also pointed outin the addenda for this chapter your follow-up detail that &#8220;relative&#8221; file number is nominally &#8220;relative to tablespace&#8221; &#8211; although when you look closely the numbering isn&#8217;t anything that would match what most people would think of as &#8220;relative&#8221; since Oracle doesn&#8217;t start each tablespace at (relative) file number 1.</p>
<p>There&#8217;s plenty of scope for error when working with file numbers &#8211; for example, rowids show relative file numbers, not absolute file numbers:</p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
SQL&gt; select rowid from t1;

ROWID
------------------
AAAYHMAAGAAAACKAAA

1 row selected.

SQL&gt; select rowid from t2;

ROWID
------------------
AAAYHLAAGAAAAAZAAA

1 row selected.
</pre>
<p>The format of the rowid is:  {data_object_id[6]} {relative_file_number[3]} {block number[6]} {rownumber[3]} so, in this case, both rowids come from relative file <strong>AAG</strong> (which translates into relative file 6 &#8211; which I can count to since AAA corresponds to zero). </p>
<p>Since I happen to know that the two tables are in different tablespaces Oracle has to have some way of working out that there are two different absolute file numbers involved &#8211; and it can do this through the data object id, which can be used to determine the tablespace number for the segment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Hooper</title>
		<link>http://jonathanlewis.wordpress.com/oracle-core/oc-6-writing-and-recovery/#comment-43571</link>
		<dc:creator><![CDATA[Charles Hooper]]></dc:creator>
		<pubDate>Sat, 24 Dec 2011 01:24:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/?page_id=7143#comment-43571</guid>
		<description><![CDATA[Continuing the previous test case, turn off event 10120, and create another tablespace with a single datafile:
[code]
ALTER SYSTEM SET EVENTS &#039;10120 TRACE NAME CONTEXT OFF&#039;;
 
CREATE SMALLFILE TABLESPACE &quot;TEST2&quot; LOGGING DATAFILE &#039;C:\Oracle\OraData\OR1122P\TEST2.dbf&#039; SIZE 5M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
 
SELECT
  FILE#,
  RFILE#
FROM
  V$DATAFILE
WHERE
  NAME LIKE &#039;%TEST2%&#039;;
 
FILE#     RFILE#
----- ----------
   10         10
[/code]

Event 10120 clearly behaves as described in the book.  Now my database has &lt;b&gt;two&lt;/b&gt; datafiles with the same relative file number 10.  Related to the Note&#039;s comments, how would the user-facing code in Oracle Database that expects the relative file number react to the above situation - it seems as though one other key piece of information must be requested when the relative file number is required by user-facing code in Oracle Database.

Referencing the documentation:
http://docs.oracle.com/cd/E14072_01/server.112/e10595/dfiles001.htm
&quot;Absolute: Uniquely identifies a datafile in the database.
Relative: Uniquely identifies a datafile within a tablespace.&quot;]]></description>
		<content:encoded><![CDATA[<p>Continuing the previous test case, turn off event 10120, and create another tablespace with a single datafile:</p>
<pre class="brush: plain; title: ; notranslate">
ALTER SYSTEM SET EVENTS '10120 TRACE NAME CONTEXT OFF';
 
CREATE SMALLFILE TABLESPACE &quot;TEST2&quot; LOGGING DATAFILE 'C:\Oracle\OraData\OR1122P\TEST2.dbf' SIZE 5M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
 
SELECT
  FILE#,
  RFILE#
FROM
  V$DATAFILE
WHERE
  NAME LIKE '%TEST2%';
 
FILE#     RFILE#
----- ----------
   10         10
</pre>
<p>Event 10120 clearly behaves as described in the book.  Now my database has <b>two</b> datafiles with the same relative file number 10.  Related to the Note&#8217;s comments, how would the user-facing code in Oracle Database that expects the relative file number react to the above situation &#8211; it seems as though one other key piece of information must be requested when the relative file number is required by user-facing code in Oracle Database.</p>
<p>Referencing the documentation:<br />
<a href="http://docs.oracle.com/cd/E14072_01/server.112/e10595/dfiles001.htm" rel="nofollow">http://docs.oracle.com/cd/E14072_01/server.112/e10595/dfiles001.htm</a><br />
&#8220;Absolute: Uniquely identifies a datafile in the database.<br />
Relative: Uniquely identifies a datafile within a tablespace.&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
