<?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>TTA -- when you believe</title>
	<atom:link href="http://www.easyora.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.easyora.net</link>
	<description>想到达明天现在就要启程...</description>
	<lastBuildDate>Thu, 03 Nov 2011 12:28:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>RAC环境中threads变更后如何确保goldengate继续正常复制</title>
		<link>http://www.easyora.net/blog/goldengate_rac_threads_remap.html</link>
		<comments>http://www.easyora.net/blog/goldengate_rac_threads_remap.html#comments</comments>
		<pubDate>Wed, 17 Aug 2011 08:57:00 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[goldengate]]></category>
		<category><![CDATA[rac threads]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/goldengate_rac_threads_remap.html</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 当rac节点变更的时候，比如我们添加或者删除了集群中的节点，理所当然会对节点对应的log threads进行添加或者删除，但会造成goldengate的map log threads的顺序发生紊乱。在进行这一类行为变更的时候，特别需要注意goldengate端也需要进行特别处理。 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 比如，在节点添加之前，goldengate map log threads顺序如下(数据库log thread在后，下同)： &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1—&#62;1 (假设是sequence 100，rba 1001) &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2&#8212;&#62;2(假设是sequence 88，rba 3009） &#160;&#160;&#160;&#160;&#160;&#160;&#160; 当添加节点后，map log threads的顺序会变成： &#160;&#160;&#160;&#160;&#160;&#160;&#160; 1&#8212;-&#62;3(sequence 88，rba 3009） &#160;&#160;&#160;&#160;&#160;&#160;&#160; 2&#8212;-&#62;1(sequence 100，rba 1001) &#160;&#160;&#160;&#160;&#160;&#160;&#160; 3&#8212;-&#62;2(new) &#160;&#160;&#160;&#160;&#160;&#160;&#160; 当ogg重新工作的时候，因为此时map的顺序发生了变化，因此会造成抽取进度出现问题。 &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; 如果有足够的处理时间，简单而又安全的做法是停止源端应用，删除extract进程后，重新配置新的extract进程并从当前开始抽取。但在这段时间内，所有的操作需确保在应用已经停止服务的前提下，否则数据将造成丢失或者不一致，需要手工处理或者重新初始化。 &#160;&#160;&#160;&#160;&#160;&#160;&#160; 如果应用无法停机呢？我们可以将新建的extract进度修改成停止之前的进度状态，从而避免操作过程中应用的停机行为。 &#160;&#160;&#160;&#160;&#160;&#160;&#160; 需要我们特别记录的checkpoint有：Current Checkpoint、Recovery Checkpoint以及Write Checkpoint 1.正常停止extract(略) 2.获得extract的checkpoint记录 &#160; GGSCI (node1) 21&#62; info ext_r1 showch [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 当rac节点变更的时候，比如我们添加或者删除了集群中的节点，理所当然会对节点对应的log threads进行添加或者删除，但会造成goldengate的map log threads的顺序发生紊乱。在进行这一类行为变更的时候，特别需要注意goldengate端也需要进行特别处理。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 比如，在节点添加之前，goldengate map log threads顺序如下(数据库log thread在后，下同)：</p>
<blockquote><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1—&gt;1 (假设是sequence 100，rba 1001)</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2&#8212;&gt;2(假设是sequence 88，rba 3009）</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 当添加节点后，map log threads的顺序会变成：</p>
<blockquote><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1&#8212;-&gt;3(sequence 88，rba 3009）</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2&#8212;-&gt;1(sequence 100，rba 1001)</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3&#8212;-&gt;2(new)</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 当ogg重新工作的时候，因为此时map的顺序发生了变化，因此会造成抽取进度出现问题。</p>
<p><span id="more-714"></span>
<p>&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 如果有足够的处理时间，简单而又安全的做法是停止源端应用，删除extract进程后，重新配置新的extract进程并从当前开始抽取。但在这段时间内，所有的操作需确保在应用已经停止服务的前提下，否则数据将造成丢失或者不一致，需要手工处理或者重新初始化。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 如果应用无法停机呢？我们可以将新建的extract进度修改成停止之前的进度状态，从而避免操作过程中应用的停机行为。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 需要我们特别记录的checkpoint有：Current Checkpoint、Recovery Checkpoint以及Write Checkpoint</p>
<p>1.正常停止extract(略)</p>
<p>2.获得extract的checkpoint记录</p>
<blockquote><p>&#160; GGSCI (node1) 21&gt; <strong>info ext_r1 showch</strong></p>
</blockquote>
<blockquote><p>EXTRACT&#160;&#160;&#160; EXT_R1&#160;&#160;&#160; Last Started 2011-08-16 22:35&#160;&#160; Status STOPPED      <br />Checkpoint Lag&#160;&#160;&#160;&#160;&#160;&#160; 00:00:00 (updated 00:06:21 ago)       <br />Log Read Checkpoint&#160; Oracle Redo Logs       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2011-08-17 03:32:48&#160; Thread 1, Seqno 62, RBA 29890576       <br />Log Read Checkpoint&#160; Oracle Redo Logs       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2011-08-17 03:32:34&#160; Thread 2, Seqno 42, RBA 18674704</p>
<p>Current Checkpoint Detail:</p>
<p>Read Checkpoint #1</p>
<p>&#160; Oracle RAC Redo Log</p>
<p>&#160; Startup Checkpoint (starting position in the data source):      <br />&#160;&#160;&#160; Thread #: 1       <br />&#160;&#160;&#160; Sequence #: 61       <br />&#160;&#160;&#160; RBA: 32112656       <br />&#160;&#160;&#160; Timestamp: 2011-08-16 22:34:53.000000       <br />&#160;&#160;&#160; SCN: 0.3743980 (3743980)       <br />&#160;&#160;&#160; Redo File: +DATA1/my/onlinelog/group_1.261.758327805</p>
<p>&#160; <strong>Recovery Checkpoint</strong> (position of oldest unprocessed transaction in the data source):       <br />&#160;&#160;&#160; Thread #: 1       <br />&#160;&#160;&#160; Sequence #: 62       <br />&#160;&#160;&#160; RBA: 29890576       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 03:32:48.000000       <br />&#160;&#160;&#160; SCN: 0.3811675 (3811675)       <br />&#160;&#160;&#160; Redo File: +DATA1/my/onlinelog/group_2.262.758327805</p>
<p><strong>&#160; Current Checkpoint</strong> (position of last record read in the data source):       <br />&#160;&#160;&#160; Thread #: 1       <br />&#160;&#160;&#160; Sequence #: 62       <br />&#160;&#160;&#160; RBA: 29890576       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 03:32:48.000000       <br />&#160;&#160;&#160; SCN: 0.3811675 (3811675)       <br />&#160;&#160;&#160; Redo File: +DATA1/my/onlinelog/group_2.262.758327805</p>
<p>&#160; BR Previous Recovery Checkpoint:      <br />&#160;&#160;&#160; Thread #: 1       <br />&#160;&#160;&#160; Sequence #: 0       <br />&#160;&#160;&#160; RBA: 0       <br />&#160;&#160;&#160; Timestamp: 2011-08-16 22:35:09.416136       <br />&#160;&#160;&#160; SCN: Not available       <br />&#160;&#160;&#160; Redo File: </p>
<p>&#160; BR Begin Recovery Checkpoint:      <br />&#160;&#160;&#160; Thread #: 1       <br />&#160;&#160;&#160; Sequence #: 62       <br />&#160;&#160;&#160; RBA: 22437392       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 02:35:11.000000       <br />&#160;&#160;&#160; SCN: 0.3798208 (3798208)       <br />&#160;&#160;&#160; Redo File: </p>
<p>&#160; BR End Recovery Checkpoint:      <br />&#160;&#160;&#160; Thread #: 1       <br />&#160;&#160;&#160; Sequence #: 62       <br />&#160;&#160;&#160; RBA: 24120320       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 02:35:16.000000       <br />&#160;&#160;&#160; SCN: 0.3801192 (3801192)       <br />&#160;&#160;&#160; Redo File: </p>
<p>Read Checkpoint #2</p>
<p>&#160; Oracle RAC Redo Log</p>
<p>&#160; Startup Checkpoint (starting position in the data source):      <br />&#160;&#160;&#160; Thread #: 2       <br />&#160;&#160;&#160; Sequence #: 41       <br />&#160;&#160;&#160; RBA: 25323024       <br />&#160;&#160;&#160; Timestamp: 2011-08-16 22:34:40.000000       <br />&#160;&#160;&#160; SCN: 0.3743980 (3743980)       <br />&#160;&#160;&#160; Redo File: +DATA1/my/onlinelog/group_3.266.758328125</p>
<p><strong>&#160; Recovery Checkpoint</strong> (position of oldest unprocessed transaction in the data source):       <br />&#160;&#160;&#160; Thread #: 2       <br />&#160;&#160;&#160; Sequence #: 42       <br />&#160;&#160;&#160; RBA: 18674704       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 03:32:34.000000       <br />&#160;&#160;&#160; SCN: 0.3811674 (3811674)       <br />&#160;&#160;&#160; Redo File: +DATA1/my/onlinelog/group_4.267.758328125</p>
<p><strong>&#160; Current Checkpoint</strong> (position of last record read in the data source):       <br />&#160;&#160;&#160; Thread #: 2       <br />&#160;&#160;&#160; Sequence #: 42       <br />&#160;&#160;&#160; RBA: 18674704       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 03:32:34.000000       <br />&#160;&#160;&#160; SCN: 0.3811674 (3811674)       <br />&#160;&#160;&#160; Redo File: +DATA1/my/onlinelog/group_4.267.758328125</p>
<p>&#160; BR Previous Recovery Checkpoint:      <br />&#160;&#160;&#160; Thread #: 2       <br />&#160;&#160;&#160; Sequence #: 0       <br />&#160;&#160;&#160; RBA: 0       <br />&#160;&#160;&#160; Timestamp: 2011-08-16 22:35:09.416136       <br />&#160;&#160;&#160; SCN: Not available       <br />&#160;&#160;&#160; Redo File: </p>
<p>&#160; BR Begin Recovery Checkpoint:      <br />&#160;&#160;&#160; Thread #: 2       <br />&#160;&#160;&#160; Sequence #: 42       <br />&#160;&#160;&#160; RBA: 15242240       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 02:35:02.000000       <br />&#160;&#160;&#160; SCN: 0.3800455 (3800455)       <br />&#160;&#160;&#160; Redo File: </p>
<p>&#160; BR End Recovery Checkpoint:      <br />&#160;&#160;&#160; Thread #: 2       <br />&#160;&#160;&#160; Sequence #: 42       <br />&#160;&#160;&#160; RBA: 15242240       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 02:35:02.000000       <br />&#160;&#160;&#160; SCN: 0.3800455 (3800455)       <br />&#160;&#160;&#160; Redo File: </p>
<p><strong>Write Checkpoint</strong> #1</p>
<p>&#160; GGS Log Trail</p>
<p>&#160; Current Checkpoint (current write position):      <br />&#160;&#160;&#160; Sequence #: 3       <br />&#160;&#160;&#160; RBA: 51132       <br />&#160;&#160;&#160; Timestamp: 2011-08-17 03:32:48.695373       <br />&#160;&#160;&#160; Extract Trail: /opt/ggs/dirdat/r1/ex</p>
<p>Header:      <br />&#160; Version = 2       <br />&#160; Record Source = A       <br />&#160; Type = 6       <br />&#160; # Input Checkpoints = 2       <br />&#160; # Output Checkpoints = 1</p>
<p>File Information:      <br />&#160; Block Size = 2048       <br />&#160; Max Blocks = 100       <br />&#160; Record Length = 4096       <br />&#160; Current Offset = 0</p>
<p>Configuration:      <br />&#160; Data Source = 3       <br />&#160; Transaction Integrity = 1       <br />&#160; Task Type = 0</p>
<p>Status:      <br />&#160; Start Time = 2011-08-16 22:35:10       <br />&#160; Last Update Time = 2011-08-17 03:32:48       <br />&#160; Stop Status = G       <br />&#160; Last Result = 402</p>
</blockquote>
<p>3.新建extract进程。</p>
<blockquote><p>GGSCI (node1) 34&gt; ADD EXT ext_r1, BEGIN NOW, TRANLOG, THREADS 3</p>
<p>2011-08-17 03:52:26&#160; INFO&#160;&#160;&#160; OGG-01749&#160; Successfully registered EXTRACT EXT_R1 to start managing log retention at SCN 3826107.      <br />EXTRACT added.</p>
</blockquote>
<p>4.修改current checkpoint (注意每个thread都要修改) </p>
<blockquote><p>GGSCI (node1) 35&gt; alter EXTRACT ext_r1, TRANLOG, EXTSEQNO 62, EXTRBA 29890576,thread 1     <br />EXTRACT altered. </p></blockquote>
<blockquote><p>GGSCI (node1) 36&gt; alter EXTRACT ext_r1, TRANLOG, EXTSEQNO 42, EXTRBA 18674704,thread 2</p>
<p>EXTRACT altered.</p>
</blockquote>
<p>5. 修改recovery checkpoint (注意每个thread都要修改)</p>
<blockquote><p>GGSCI (node1) 42&gt; ALTER EXTRACT ext_r1, IOEXTSEQNO 62, IOEXTRBA 29890576,thread 1</p>
</blockquote>
<blockquote><p>GGSCI (node1) 42&gt; ALTER EXTRACT ext_r1, IOEXTSEQNO 42, IOEXTRBA 18674704,thread 2</p>
</blockquote>
<p>6. 修改exttrail或者rmttrail的write checkpoint</p>
<blockquote><p>GGSCI (node1) 47&gt; ADD EXTTRAIL /opt/ggs/dirdat/r1/ex,SEQNO 3, RBA 51132, EXTRACT ext_r1      <br />EXTTRAIL added.</p>
</blockquote>
<p>7. 验证checkpoint是否修改成功(使用showch,略)</p>
<p>8.重新启动extract(略)</p>
<ul class="related_post">
<li><a href="http://www.easyora.net/blog/goldengate_trainning_1.html" title="goldengate培训提纲&lt;一&gt;">goldengate培训提纲&lt;一&gt;</a></li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/goldengate_rac_threads_remap.html&title=RAC%E7%8E%AF%E5%A2%83%E4%B8%ADthreads%E5%8F%98%E6%9B%B4%E5%90%8E%E5%A6%82%E4%BD%95%E7%A1%AE%E4%BF%9Dgoldengate%E7%BB%A7%E7%BB%AD%E6%AD%A3%E5%B8%B8%E5%A4%8D%E5%88%B6&tags=goldengate, rac threads, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/goldengate_rac_threads_remap.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>goldengate&#8211;使用filter+@GETENV在线重新初始化指定的table</title>
		<link>http://www.easyora.net/blog/using_filter_getenv_function_to_initialize_special_table.html</link>
		<comments>http://www.easyora.net/blog/using_filter_getenv_function_to_initialize_special_table.html#comments</comments>
		<pubDate>Tue, 09 Aug 2011 04:58:21 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[goldengate]]></category>
		<category><![CDATA[@getenv]]></category>
		<category><![CDATA[goldengate，初始化，filter]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/using_filter_getenv_function_to_initialize_special_table-html.html</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在oracle-oracle goldengate的复制环境中，有时候会碰到一些紧急的问题一时无法修复，为了避免影响整个复制环境的复制进度，采取跳过错误事务或者跳过特定对象的办法使得goldengate继续同步；如果后续某个表不得不需要重新同步，而且应用是不间断进行事务操作的，在不停止应用和重建整个复制环境的情况下，为了保证数据的一致性，如何在线对特定的问题对象重新初始化和继续同步呢？ &#160;&#160;&#160;&#160;&#160;&#160;&#160; 处理的办法还是不少的，下面给出一个在replicat端过滤SCN事务的办法，来实现数据的一致同步。 &#160;&#160;&#160;&#160;&#160;&#160;&#160; 处理的思路就是首先在target上获得该表上某个特定SCN版本上的数据(比如使用导入导出或者数据泵)，然后通过filter功能来筛选出该表上大于该commit scn的事务，从而确保事务的一致性。在goldengate v10之后，可以通过@GETENV函数直接获得事务的CSN。&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 简单看一下处理步骤，假设目前gg环境中hr.translog表需要重新初始化，由source端hr用户同步到target端hr2用户下。 &#160;&#160;&#160;&#160;&#160;&#160; &#160; 1.停止target上的replicat进程 GGSCI (sh) 44&#62; stop rep_hr2 Sending STOP request to REPLICAT REP_HR2 &#8230; Request processed. &#160;&#160;&#160;&#160;&#160;&#160;&#160; 2.获得source上hr.translog表的特定SCN一致性版本 SQL&#62; select dbms_flashback.get_system_change_number from dual; 9543774 &#160;&#160;&#160;&#160;&#160;&#160;&#160; 使用exp进行一致性版本导出 [oracle@gz ~]$ exp hr/hr tables=translog file=translog.dmp flashback_scn=9543774 Export: Release 10.2.0.1.0 &#8211; Production on Tue Aug 9 00:27:42 [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在oracle-oracle goldengate的复制环境中，有时候会碰到一些紧急的问题一时无法修复，为了避免影响整个复制环境的复制进度，采取跳过错误事务或者跳过特定对象的办法使得goldengate继续同步；如果后续某个表不得不需要重新同步，而且应用是不间断进行事务操作的，在不停止应用和重建整个复制环境的情况下，为了保证数据的一致性，如何在线对特定的问题对象重新初始化和继续同步呢？</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 处理的办法还是不少的，下面给出一个在replicat端过滤SCN事务的办法，来实现数据的一致同步。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 处理的思路就是首先在target上获得该表上某个特定SCN版本上的数据(比如使用导入导出或者数据泵)，然后通过filter功能来筛选出该表上大于该commit scn的事务，从而确保事务的一致性。在goldengate v10之后，可以通过<strong>@GETENV</strong>函数直接获得事务的CSN。&#160; </p>
<p><span id="more-708"></span>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 简单看一下处理步骤，假设目前gg环境中hr.translog表需要重新初始化，由source端hr用户同步到target端hr2用户下。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; <strong>&#160; 1.停止target上的replicat进程</strong></p>
<blockquote><p>GGSCI (sh) 44&gt; stop rep_hr2</p>
<p>Sending STOP request to REPLICAT REP_HR2 &#8230;      <br />Request processed.</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>2.获得source上hr.translog表的特定SCN一致性版本</strong></p>
<blockquote><p>SQL&gt; select dbms_flashback.get_system_change_number from dual;</p>
<p>9543774</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 使用exp进行一致性版本导出</p>
<blockquote><p>[oracle@gz ~]$ exp hr/hr tables=translog file=translog.dmp<strong> flashback_scn=9543774</strong></p>
</blockquote>
<blockquote><p>Export: Release 10.2.0.1.0 &#8211; Production on Tue Aug 9 00:27:42 2011</p>
<p>Copyright (c) 1982, 2005, Oracle.&#160; All rights reserved.      <br />Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 &#8211; 64bit Production       <br />With the Partitioning, OLAP and Data Mining options       <br />Export done in US7ASCII character set and AL16UTF16 NCHAR character set       <br />server uses ZHS16GBK character set (possible charset conversion)</p>
<p>About to export specified tables via Conventional Path &#8230;      <br />. . exporting table&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TRANSLOG&#160;&#160;&#160;&#160;&#160; 5062409 rows exported       <br />EXP-00091: Exporting questionable statistics.       <br />Export terminated successfully with warnings.</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>3. target上导入一致性版本</strong></p>
<blockquote><p>[oracle@gz ~]$ imp hr2/hr2@sh tables=translog file=translog.dmp ignore=y</p>
</blockquote>
<blockquote><p>Import: Release 10.2.0.1.0 &#8211; Production on Tue Aug 9 00:28:36 2011</p>
<p>Copyright (c) 1982, 2005, Oracle.&#160; All rights reserved.</p>
<p>Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 &#8211; 64bit Production      <br />With the Partitioning, OLAP and Data Mining options</p>
<p>Export file created by EXPORT:V10.02.01 via conventional path</p>
<p>Warning: the objects were exported by HR, not by you</p>
<p>import done in US7ASCII character set and AL16UTF16 NCHAR character set      <br />import server uses ZHS16GBK character set (possible charset conversion)       <br />. importing HR&#8217;s objects into HR2       <br />. importing HR&#8217;s objects into HR2       <br />. . importing table&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;TRANSLOG&quot;&#160;&#160;&#160;&#160;&#160; 50624 rows imported       <br />IMP-00017: following statement failed with ORACLE error 30567:       <br />&quot;ALTER TABLE &quot;TRANSLOG&quot; ADD SUPPLEMENTAL LOG GROUP &quot;GGS_TRANSLOG_56459&quot; (&quot;OB&quot;       <br />&quot;JECT_ID&quot;) ALWAYS&quot;       <br />IMP-00003: ORACLE error 30567 encountered       <br />ORA-30567: name already used by an existing log group       <br />Import terminated successfully with warnings.</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <strong>4. 修改replicat参数，过滤hr.translog上小于SCN 9543774上的事务。</strong></p>
<blockquote><p>GGSCI (sh) 43&gt; view param rep_hr2</p>
<p>replicat rep_hr2      <br />USERID gg, PASSWORD AACAAAAAAAAAAACANJPHHDSJCIYCFCZB,ENCRYPTKEY DEFAULT       <br />assumetargetdefs       <br />map hr.translog, target hr2.translog,<strong><font color="#ff0000"> filter (@GETENV (&quot;transaction&quot;, &quot;csn&quot;) &gt; 9          <br />543774);           <br /></font></strong>map hr.org, target hr2.org;</p>
<p>map hr.unp_file, target hr.unp_file;</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160; <strong>5. 启动replicat进程</strong></p>
<blockquote><p>GGSCI (sh) 2&gt; start rep_hr2</p>
<p>Sending START request to MANAGER &#8230;      <br />REPLICAT REP_HR2 starting</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160; 采用这种办法，即使source上hr.translog表不断被DML，因为SCN过滤的存在，保证了复制过程中的数据一致性。对source上的应用来讲，也无须额外的停机时间。在初始化过程中，因为target上复制进程的暂停，会影响到复制的实时性， 为减少target上replicat的暂停时间，可以采用分割datapump和replicate group的方法，也可实现特定对象的在线初始化，具体参考<a href="http://www.easyora.net/blog/using_split_replicat_group_to_initialize_special_table.html">goldengate&#8211;split replicat group在线重新初始化指定的table</a></p>
<ul class="related_post">
<li>No Related Post</li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/using_filter_getenv_function_to_initialize_special_table.html&title=goldengate%26%238211%3B%E4%BD%BF%E7%94%A8filter%2B%40GETENV%E5%9C%A8%E7%BA%BF%E9%87%8D%E6%96%B0%E5%88%9D%E5%A7%8B%E5%8C%96%E6%8C%87%E5%AE%9A%E7%9A%84table&tags=@getenv, goldengate，初始化，filter, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/using_filter_getenv_function_to_initialize_special_table.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>oracle-oracle goldengate零停机初始化的技巧</title>
		<link>http://www.easyora.net/blog/goldengate_initialization.html</link>
		<comments>http://www.easyora.net/blog/goldengate_initialization.html#comments</comments>
		<pubDate>Mon, 01 Aug 2011 15:43:44 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[goldengate]]></category>
		<category><![CDATA[goldengate，初始化，Handlecollisions，CSN]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/goldengate_initialization.html</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; 在实施goldengate过程中，初始化的方案选择是一个重要的环节，尤其对一个7*24小时的系统环境来讲。一个出色的&#160;&#160;&#160; goldengate的实施不应该以停机时间作为代价，合适的初始化方法完全可以做到零停机。&#160; &#160;&#160;&#160;&#160;&#160; 如果事务不间断进行，如何保证初始化过程中事务的完整性和数据的准确性呢(静态的初始化环境无需多讲)？实现方法还是多样的，从工作机制上来讲，归纳起来主要有2种。 &#160;&#160;&#160;&#160; 1. 利用 Keys + Handlecollisions &#160;&#160;&#160;&#160; 2.利用 commit SCN/CSN &#160;&#160;&#160;&#160;&#160;&#160;&#160; Handlecollisions参数依赖于表上的Key(Primary key/Unique key)来对数据进行重复行和缺失行的处理，常在数据初始化过程中保证数据的一致性，gg文档上的初始化办法，比如initial load，都是用的这种办法。但是这种办法在实际的工程实施中是有相当大的限制。 &#160;&#160;&#160;&#160;&#160;&#160;&#160; 首先，该初始化办法性能比较糟糕，对于大型数据库来讲，并不合适。更严重的是，它有很大的缺陷性。(引自metalink doc)： 1. When there is primary key update (PKUpdate), the HANDLECOLLISIONS method may lose data. The solution in the case of a primary key update is for Extract to fetch whole row by [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160; 在实施goldengate过程中，初始化的方案选择是一个重要的环节，尤其对一个7*24小时的系统环境来讲。一个出色的&#160;&#160;&#160; goldengate的实施不应该以停机时间作为代价，合适的初始化方法完全可以做到零停机。&#160; </p>
<p>&#160;&#160;&#160;&#160;&#160; 如果事务不间断进行，如何保证初始化过程中事务的完整性和数据的准确性呢(静态的初始化环境无需多讲)？实现方法还是多样的，从工作机制上来讲，归纳起来主要有2种。</p>
<blockquote><p>&#160;&#160;&#160;&#160; 1. 利用 Keys + Handlecollisions</p>
<p>&#160;&#160;&#160;&#160; 2.利用 commit SCN/CSN</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Handlecollisions参数依赖于表上的Key(Primary key/Unique key)来对数据进行重复行和缺失行的处理，常在数据初始化过程中保证数据的一致性，gg文档上的初始化办法，比如initial load，都是用的这种办法。但是这种办法在实际的工程实施中是有相当大的限制。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 首先，该<font color="#333333">初始化办法性能</font>比较糟糕，对于大型数据库来讲，并不合适。更严重的是，它有很大的缺陷性。(引自metalink doc)：</p>
<blockquote><p>1. When there is primary key update (PKUpdate), the HANDLECOLLISIONS method may lose data. The solution in the case of a primary key update is for Extract to fetch whole row by making a flashback query. However, this is not efficient and may not be possible in certain environments.</p>
<p>2. When a table does not have any type of key, HANDLECOLLISIONS may introduce duplicate rows in the table. One workaround is to add a primary or unique key to the target table.</p>
<p>3. The exact timestamp when the initial load was started may not be known (and different tables may have different start times), so it is almost inevitable that HANDLECOLLISIONS will be used for certain records un-necessarily. This could mask a real data integrity problem.</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 在实际的工程实施中，个人不推荐使用基于Keys + Handlecollisions模式的初始化办法。</p>
<p><span id="more-705"></span>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 那么基于commit SCN的初始化办法是否可靠呢？如果你用过逻辑备库，Stream等东西，退一步讲，抑或是做过一致性的导入导出，应该很清楚SCN在版本一致性方面的重要作用。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 问题简单化，goldengate初始化的的核心问题就变成了如何联机进行基于SCN一致性的同步。实现的工具和方法还是不少的。</p>
<blockquote><p>1. 一致性的exp和imp</p>
</blockquote>
<blockquote><p>2. 一致性的expdp和impdp</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 通过exp和expdp的一致性参数(例如flashback_scn)，导出特定SCN点上的一致性版本，使用这种方法初始化存在一个问题，就是构造一致性数据过程中会对undo造成比较大的压力，尤其对大型数据库来讲，可以通过分割的datapump来实现数据的分组同步，分散undo的压力，然后合适时间将分组的datapump合并即可。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 该方法的优点就是可以跨平台和跨版本初始化。</p>
<blockquote><p>3. 基于备份的表空间搬移（Transportable Tablespace from Backup with RMAN）</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 为何是基于备份的表空间搬移呢? 单纯的表空间搬移需要数据库或者表空间read only，copy数据文件的这段时间应用是需要停止的，因此表空间搬移并不适合7*24小时的初始化环境。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 基于备份的表空间搬移的一个最大的优势就是零停机，而且支持异构平台和跨版本（对于不同字节顺序的source-target平台初始化，需要进行convert），但是需要10g以上版本才支持，同样受到表空间搬移的那些限制条件。</p>
<blockquote><p>4. Dataguard</p>
</blockquote>
<blockquote></blockquote>
<blockquote></blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dataguard适合同平台同版本的系统环境初始化。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 当然，在实际工程中，还会有别的一些处理办法，或者各种办法之间有交融，作为方案制定者和实施者，你所能驾驭的，就是对你来说合适的。</p>
<ul class="related_post">
<li>No Related Post</li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/goldengate_initialization.html&title=oracle-oracle+goldengate%E9%9B%B6%E5%81%9C%E6%9C%BA%E5%88%9D%E5%A7%8B%E5%8C%96%E7%9A%84%E6%8A%80%E5%B7%A7&tags=goldengate，初始化，Handlecollisions，CSN, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/goldengate_initialization.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>goldengate培训提纲&lt;一&gt;</title>
		<link>http://www.easyora.net/blog/goldengate_trainning_1.html</link>
		<comments>http://www.easyora.net/blog/goldengate_trainning_1.html#comments</comments>
		<pubDate>Wed, 27 Jul 2011 15:45:00 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[goldengate]]></category>
		<category><![CDATA[培训]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/goldengate%e5%9f%b9%e8%ae%ad%e6%8f%90%e7%ba%b2%e4%b8%80.html</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160; Blog一晃半年没有更新了，还真对不起每年交的空间和域名费。 &#160;&#160;&#160;&#160; 一连实施了好几个goldengate的项目,关注ogg也有好些时日了。这是前不久应客户要求做的goldengate的培训，share一下。因为用户只是应急容灾的应用，因此ogg上的很多功能当时并没有提及。接下来的blog会持续整理goldengate的一些问题和技巧。 第一篇 Oracle Goldengate基础技巧 第一节 Goldengate体系介绍 1. Goldengate架构 2. Goldengate工作原理 3. Goldengate使用场景 第二节 安装配置Goldengate 1. 安装Goldengate软件 2. 配置和管理进程 3. Goldengate的安全加固手段 第三节 Goldengate数据初始化 1. 基于keys+HANDLECOLLISIONS初始化 (1) keys+HANDLECOLLISIONS的工作原理和缺点 (2) direct load的局限性和操作步骤 2. 基于SCN consistent初始化 (1) 基于SCN初始化的工作原理和特点 (2) 基于Exp/imp和expdp/impdp一致性初始化使用场景和步骤 (3) 基于transport tablespace with backupset初始化使用场景和步骤 (4) 基于Dataguard模式的初始化使用场景和步骤 第四节 DML常规复制 1. DML复制的工作原理 (1) Keys对rows复制处理的影响 (2) 追加Column日志对rows复制处理的影响 (3) [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160; Blog一晃半年没有更新了，还真对不起每年交的空间和域名费。</p>
<p>&#160;&#160;&#160;&#160; 一连实施了好几个goldengate的项目,关注ogg也有好些时日了。这是前不久应客户要求做的goldengate的培训，share一下。因为用户只是应急容灾的应用，因此ogg上的很多功能当时并没有提及。接下来的blog会持续整理goldengate的一些问题和技巧。</p>
<p><span id="more-697"></span><br />
<blockquote>
<p><a name="OLE_LINK4"></a><a name="OLE_LINK3"><strong>第一篇 Oracle Goldengate</strong></a><strong>基础技巧</strong></p>
</blockquote>
<blockquote><p>第一节 Goldengate体系介绍</p>
<p>1. Goldengate架构</p>
<p>2. Goldengate工作原理</p>
<p>3. Goldengate使用场景</p>
</blockquote>
<blockquote><p>第二节 安装配置Goldengate</p>
<p>1. 安装Goldengate软件</p>
<p>2. 配置和管理进程</p>
<p>3. Goldengate的安全加固手段</p>
</blockquote>
<blockquote><p>第三节 Goldengate数据初始化</p>
<p>1. 基于<strong>keys+HANDLECOLLISIONS</strong>初始化</p>
<p>(1) keys+HANDLECOLLISIONS的工作原理和缺点</p>
<p>(2) direct load的局限性和操作步骤</p>
<p>2. 基于SCN consistent初始化</p>
<p>(1) 基于SCN初始化的工作原理和特点</p>
<p>(2) 基于Exp/imp和expdp/impdp一致性初始化使用场景和步骤</p>
<p>(3) 基于<strong>transport tablespace with backupset</strong>初始化使用场景和步骤</p>
<p>(4) 基于Dataguard模式的初始化使用场景和步骤</p>
</blockquote>
<blockquote><p>第四节 DML常规复制</p>
<p>1. DML复制的工作原理</p>
<p>(1) Keys对rows复制处理的影响</p>
<p>(2) 追加Column日志对rows复制处理的影响</p>
<p>(3) DML复制的支持类型</p>
<p>2.DML错误处理</p>
<p>(1) Extract端参数的使用</p>
<p>(2) <a name="OLE_LINK2"></a><a name="OLE_LINK1">REPERROR</a>的高级用法</p>
<p>(3) exceptions table的使用</p>
</blockquote>
<blockquote><p>第五节 DDL复制的高级技巧</p>
<p>1. DDL复制的工作原理</p>
<p>(1) DDL复制工作机制</p>
<p>(2) DDL复制的支持类型</p>
<p>(3) DDL复制对现有复制环境的影响和冲突</p>
<p>2. DDL复制处理技巧</p>
<p>(1) DDL scopes的使用</p>
<p>(2) DDL过滤技巧</p>
<p>(3) DDL 字符替换的技巧</p>
<p>(4) DDL复制中delivery object/password等行为说明</p>
<p>3. DDL错误处理</p>
<p>(1) Extract 端的参数控制</p>
<p>(2) DDLEEOR的高级用法</p>
</blockquote>
<blockquote><p>第六节 数据<a name="OLE_LINK6"></a><a name="OLE_LINK5">操纵</a></p>
<p>1. 数据操纵对现有复制环境的限制和影响</p>
<p>2. 行数据过滤</p>
<p>(1) Filter行过滤的使用场景和用法</p>
<p>(2) Where行过滤的使用场景和用法</p>
<p>3. 列处理</p>
<p>(1) colmap的使用技巧</p>
<p>(2)colmatch的使用技巧</p>
<p>(3) data-definition的使用技巧 </p>
<p>(4) 列转换函数介绍</p>
<p>4. DML类型处理</p>
<p>(1) DML类型过滤</p>
<p>(2) DML类型转换</p>
<p>5. 事务信息提取</p>
<p>(1) 事务信息抽取的意义和使用场景</p>
<p>(2) 相关的function以及用法(token/getenv)</p>
<p>6. SQLEXEC的使用</p>
</blockquote>
<blockquote><p><strong>第二篇 Oracle Goldengate</strong><strong>工程与运维技巧</strong></p>
</blockquote>
<blockquote><p>第一节 实施与规划</p>
<p>1. 应急/实时同步场景的规划</p>
<p>(1) 如何选择初始化办法</p>
<p>(2) 复制对象的特别处理(Sequence/Trigger/FK)</p>
<p>(3) 应急切换处理办法</p>
<p>2. 数据分发/数据稽核场景的规划</p>
<p>3. 双向同步的规划和数据冲突处理</p>
<p>4. RAC场景中的注意点</p>
<p>5. ALO模式的限制和使用</p>
<p>6. Goldengate升级要点</p>
</blockquote>
<blockquote><p>第二节 日常运维</p>
<p>1. 日常监控的设计</p>
<p>2. Process abort的一般诊断步骤</p>
<p>3. 重新初始化指定object的方法</p>
<p>4. Logdump排查异常transaction的使用</p>
<p>5. 提高复制性能的参数使用</p>
</blockquote>
<ul class="related_post">
<li><a href="http://www.easyora.net/blog/goldengate_rac_threads_remap.html" title="RAC环境中threads变更后如何确保goldengate继续正常复制">RAC环境中threads变更后如何确保goldengate继续正常复制</a></li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/goldengate_trainning_1.html&title=goldengate%E5%9F%B9%E8%AE%AD%E6%8F%90%E7%BA%B2%26lt%3B%E4%B8%80%26gt%3B&tags=goldengate, 培训, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/goldengate_trainning_1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When you Believe-2011，怡然前行</title>
		<link>http://www.easyora.net/blog/2011_life_continue.html</link>
		<comments>http://www.easyora.net/blog/2011_life_continue.html#comments</comments>
		<pubDate>Tue, 22 Mar 2011 09:12:00 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[2011感想]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/2011_life_continue.html</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160; 曾期许做一个舞文泼墨者，将或喜或悲点缀到跳动的字里行间，洒脱自得；然而，不经意的却走向了it这个湖潭，逐流随波，几近五载。 &#160;&#160;&#160;&#160;&#160;&#160; 成长会让理性变成习惯，但感性亦不会荡然无存。 &#160;&#160;&#160;&#160;&#160; 恋上了随遇而安，却总爱奢华的瞻望。当踮起脚尖的时候，已然望不到尽头，剩下了就是不安与惶恐。这种惶恐近来愈发强烈，却着实不得不面对。岔路口上，或左或右需要是睿智；而坡路上，迎面总好过退缩。瓶颈虽不会无处不在，但却很难让它无处遁形。惶恐之由，想罢是生性中最脆弱的一面又蠢蠢欲动，夹杂着诸多不尽人意，难免碰触到最敏感的神经。 &#160;&#160;&#160;&#160;&#160; 漂泊了4个半年头后，在广州算是有了个尚未交付的栖息之所。心情沉重了很多，决非释然。想来这是一种微妙的感觉，诸如我们这般琐居的外乡人，独自飘零，兀自找寻。即便有了归属，心又归于何处。 &#160;&#160;&#160;&#160;&#160; 好好对待身边的人，朋友，亲人。谢谢陪伴自己一路走过的人。 &#160;&#160;&#160;&#160;&#160; 责任当是种爱的感知和传递。花自漂零，怡然前行。 &#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;2011.3.22 广州 No Related Post]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160; 曾期许做一个舞文泼墨者，将或喜或悲点缀到跳动的字里行间，洒脱自得；然而，不经意的却走向了it这个湖潭，逐流随波，几近五载。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 成长会让理性变成习惯，但感性亦不会荡然无存。</p>
<p>&#160;&#160;&#160;&#160;&#160; 恋上了随遇而安，却总爱奢华的瞻望。当踮起脚尖的时候，已然望不到尽头，剩下了就是不安与惶恐。这种惶恐近来愈发强烈，却着实不得不面对。岔路口上，或左或右需要是睿智；而坡路上，迎面总好过退缩。瓶颈虽不会无处不在，但却很难让它无处遁形。惶恐之由，想罢是生性中最脆弱的一面又蠢蠢欲动，夹杂着诸多不尽人意，难免碰触到最敏感的神经。</p>
<p>&#160;&#160;&#160;&#160;&#160; 漂泊了4个半年头后，在广州算是有了个尚未交付的栖息之所。心情沉重了很多，决非释然。想来这是一种微妙的感觉，诸如我们这般琐居的外乡人，独自飘零，兀自找寻。即便有了归属，心又归于何处。</p>
<p>&#160;&#160;&#160;&#160;&#160; 好好对待身边的人，朋友，亲人。谢谢陪伴自己一路走过的人。</p>
<p>&#160;&#160;&#160;&#160;&#160; 责任当是种爱的感知和传递。花自漂零，怡然前行。</p>
<p>&#160;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;2011.3.22 广州</p>
<ul class="related_post">
<li>No Related Post</li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/2011_life_continue.html&title=When+you+Believe-2011%EF%BC%8C%E6%80%A1%E7%84%B6%E5%89%8D%E8%A1%8C&tags=2011感想, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/2011_life_continue.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cascaded Destinations/Cascaded Standby Databases</title>
		<link>http://www.easyora.net/blog/oracle_cascaded_destinations.html</link>
		<comments>http://www.easyora.net/blog/oracle_cascaded_destinations.html#comments</comments>
		<pubDate>Mon, 24 Jan 2011 06:10:00 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[cascaded destinations]]></category>
		<category><![CDATA[cascaded standby database]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/oracle_cascaded_destinations.html</guid>
		<description><![CDATA[Cascaded Destinations，简单的讲，就是为了避免主库的压力和干扰，将主库产生的redo通过一个standby传送到另外一个standby上，而不是直接通过primary到另外一个standby。在Oracle各版本的在线文档上，对此界定也并不一致。比如这样一个组合方式：Primary Database > Logical Standby Database  > Physical Standby Database，因为最后一层的standby并不和第一层的priamry database有直接关系，1-2和2-3分别自成体系，这并不是一个真正意义上的Cascaded Destination。但在10g和9i在线文档中，依然将这种模式列为cascaded destinations，这一点在相关联机文档和metelink Doc也有所提及。]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160; Cascaded Destinations，简单的讲，就是为了避免主库的压力和干扰，将主库产生的redo通过一个standby传送到另外一个standby上，而不是直接通过primary到另外一个standby。在Oracle各版本的在线文档上，对此界定也并不一致。比如这样一个组合方式：<strong>Primary Database &gt;</strong> <strong>Logical Standby Database&#160; &gt; Physical Standby Database</strong>，因为最后一层的standby并不和第一层的priamry database有直接关系，1-2和2-3分别自成体系，这并不是一个真正意义上的Cascaded Destination。但在10g和9i在线文档中，依然将这种模式列为cascaded destinations，而在11g中已经将这种情形排除。严格意义上的cascaded destination 支持如下组合场景：</p>
<blockquote><p>1. Primary Database &gt; Physical Standby Database with cascaded destination &gt; Physical Standby Database      <br />2. Primary Database &gt; Physical Standby Database with cascaded destination &gt; Logical Standby Database</p>
</blockquote>
<p>&#160;&#160;&#160;&#160; Cascaded Destinations的用处还是比较多的，例如使用dataguard做远程容灾的场景，使用Cascaded Destinations就远比local primary和romote standby直接做dataguard可靠。基于WAN上的dataguard的一个致命问题就是主备端的网络质量问题，这将对主端产生严重的影响，尽管可以通过async的方式来进行redo或者archive的传送，但在一个繁忙的系统中，这仍然是个极大的性能和稳定性隐患。通过Cascaded Destinations，redo/archive log的同步放到了local physical standby端上进行，主库产生的日志先传送到local standby，然后由local standby负责传送日志到remote standby。</p>
<p>&#160;<img style="border-right-width: 0px; margin: 0px 20px 0px 50px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="cascaded%20destinations[1]" border="0" alt="cascaded%20destinations[1]" src="http://www.easyora.net/wp-content/uploads/2011/01/cascaded20destinations11.jpg" width="566" height="114" /></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 对于10g版本以上的该模型，通过日志传输参数VALID_FOR的功能，通过角色控制priamry/standby向remote database的日志传送，这样日常中local dataguard的switchover并不影响remote standby的同步且操作上更加平滑，另外，remote standby端配合Flashback Database，这样也避免了因为WAN上带宽有限，local database的Failover造成的remote standby的重建带来的数据传输问题。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 需要特别提出的是cascaded standby databases中的FAL的配置问题，正常情况下最后一级standby的日志是从上级standby上取得，并非直接从primary上传输，但特别情况下可直接由Primary向最后一级standby传送。如果最后一级standby的fal_server配置对应primary database和上级standby database，那么可能出现这么一种情况需要注意：上级standby database的对应的归档日志已经apply但已经不存在(比如被删除)，因为下级 standby database存在一系列问题，恢复进度并没有赶上日志的传送速度，当正好需要上级standby上这部分log的时候，发现从上级standby上已经无法获得，这时候通过fal_server的配置可直接从primary向最后一级standby上传输，而不需要中转。</p>
<p>&#160;&#160;&#160;&#160;&#160; Metalink doc上也相关记录如下：</p>
<blockquote><p>If primary receives a FAL request from the remote standby in the above case then It ships the archive logs directly to the remote standby without going via cascaded standby.</p>
</blockquote>
<ul class="related_post">
<li>No Related Post</li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/oracle_cascaded_destinations.html&title=Cascaded+Destinations%2FCascaded+Standby+Databases&tags=cascaded destinations, cascaded standby database, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/oracle_cascaded_destinations.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Oracle读写分离架构</title>
		<link>http://www.easyora.net/blog/oracle_read_write_separated_architecture.html</link>
		<comments>http://www.easyora.net/blog/oracle_read_write_separated_architecture.html#comments</comments>
		<pubDate>Fri, 07 Jan 2011 09:22:24 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[读写分离]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/oracle-%e8%af%bb%e5%86%99%e5%88%86%e7%a6%bb%e6%9e%b6%e6%9e%84.html</guid>
		<description><![CDATA[oracle 读写分离]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160; 读写分离是架构分布式系统的一个重要思想。不少系统整体处理能力并不能同业务的增长保持同步，因此势必会带来瓶颈，单纯的升级硬件并不能一劳永逸。针对业务类型特点，需要从架构模式上进行一系列的调整，比如业务模块的分割，数据库的拆分等等。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 集中式和分布式是两个对立的模式，不同行业的应用特点也决定了架构的思路。如互联网行业中一些门户站点，出于技术和成本等方面考虑，更多的采用开源的数据库产品(如MYSQL)，由于大部分是典型的读多写少的请求，因此为MYSQL及其复制技术大行其道提供了条件。而相对一些传统密集交易型的行业，比如电信业、金融业等，考虑到单点处理能力和可靠性、稳定性等问题，可能更多的采用商用数据库，比如DB2、Oracle等。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 就数据库层面来讲，大部分传统行业核心库采用集中式的架构思路，采用高配的小型机做主机载体，因为数据库本身和主机强大的处理能力，数据库端一般能支撑业务的运转，因此，Oracle读写分离式的架构相对MYSQL来讲，相对会少。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 前段时间一直在规划公司新的数据库架构，考虑到我们的业务特点，采用Oracle读写分离的思路，Writer DB和Reader&#160; DB采用日志复制软件实现实时同步； Writer DB负责交易相关的实时查询和事务处理，Reader DB负责只读接入，处理一些非实时的交易明细,报表类的汇总查询等。同时，为了满足高可用性和扩展性等要求，对读写端适当做外延，比如Writer DB采用HA或者RAC的架构模式，Reader DB可以采用多套，通过负载均衡或者业务分离的方式，有效分担读库的压力。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 对于Shared-nothing的数据库架构模式，核心的一个问题就是读写库的实时同步；另外，虽然Reader&#160; DB只负责业务查询，但并不代表数据库在功能上是只读的。只读是从应用角度出发，为了保证数据一致和冲突考虑，因为查询业务模块可能需要涉及一些中间处理，如果需要在数据库里面处理(取决与应用需求和设计)，所以Reader&#160; DB在功能上仍然需要可写。</p>
</p>
<p> <span id="more-656"></span>
</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 下面谈一下数据同步的技术选型问题：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 能实现数据实时同步的技术很多，基于OS层(例如VERITAS VVR)，基于存储复制(中高端存储大多都支持)，基于应用分发或者基于数据库层的技术。因为数据同步可能并不是单一的DB整库同步，会涉及到业务数据选择以及多源整合等问题，因此OS复制和存储复制多数情况并不适合做读写分离的技术首选。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 基于日志的Oracle复制技术，Oracle自身组件可以实现，同时也有成熟的商业软件。选商业的独立产品还是Oracle自身的组件功能，这取决于多方面的因素。比如团队的相应技术运维能力、项目投入成本、业务系统的负载程度等。</p>
<p>&#160;&#160;&#160;&#160;&#160; 采用Oracle自身组件功能，无外乎Logical Standby、Stream以及11g的Physical Standby(Active Data Guard)，对比来说，Stream最灵活，但最不稳定，11g Physical Standby支持恢复与只读并行，但由于并不是日志的逻辑应用机制，在读写分离的场景中最为局限。如果技术团队对相关技术掌握足够充分，而选型方案的处理能力又能支撑数据同步的要求，采用Oracle自身的组件完全可行。</p>
<p>&#160;&#160;&#160;&#160; 选择商业化的产品，更多出于稳定性、处理能力等考虑。市面上成熟的Oracle复制软件也无外乎几种，无论是老牌的Shareplex，还是本土DSG公司的RealSync和九桥公司的DDS，或是Oracle新贵Goldengate，都是可供选择的目标。随着GoldenGate被Oracle收购和推广，个人认为GoldenGate在容灾、数据分发和同步方面将大行其道。</p>
<p>&#160;&#160;&#160;&#160;&#160; 当然，架构好一个可靠的分布式读写分离的系统，还需要应用上做大量设计，不在本文讨论范围内。</p>
<ul class="related_post">
<li><a href="http://www.easyora.net/blog/manual_create_sql_profile_lock_sqlplan.html" title="Undocumented Way&#8211;通过手工创建sql profiles固定执行计划进行SQL调优">Undocumented Way&#8211;通过手工创建sql profiles固定执行计划进行SQL调优</a></li>
<li><a href="http://www.easyora.net/blog/manual_fix_asm_disk_header2.html" title="完全手工重构ASM Disk Header &lt;二&gt;">完全手工重构ASM Disk Header &lt;二&gt;</a></li>
<li><a href="http://www.easyora.net/blog/manual_fix_asm_disk_header1.html" title="完全手工重构ASM Disk Header &lt;一&gt;">完全手工重构ASM Disk Header &lt;一&gt;</a></li>
<li><a href="http://www.easyora.net/blog/dataguard_log_gap_mechanism.html" title="Dataguard的两种Log Gap检测和处理机制">Dataguard的两种Log Gap检测和处理机制</a></li>
<li><a href="http://www.easyora.net/blog/monitor_dg_sync_script.html" title="Physical Dataguard同步状态Shell巡检监控一则">Physical Dataguard同步状态Shell巡检监控一则</a></li>
<li><a href="http://www.easyora.net/blog/mma_dataguard_tuning_network.html" title="Dataguard高级调整之一&#8212;&#8211;网络调整">Dataguard高级调整之一&#8212;&#8211;网络调整</a></li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/oracle_read_write_separated_architecture.html&title=Oracle%E8%AF%BB%E5%86%99%E5%88%86%E7%A6%BB%E6%9E%B6%E6%9E%84&tags=oracle, 读写分离, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/oracle_read_write_separated_architecture.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Undocumented Way&#8211;通过手工创建sql profiles固定执行计划进行SQL调优</title>
		<link>http://www.easyora.net/blog/manual_create_sql_profile_lock_sqlplan.html</link>
		<comments>http://www.easyora.net/blog/manual_create_sql_profile_lock_sqlplan.html#comments</comments>
		<pubDate>Tue, 21 Dec 2010 15:48:08 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[dbms_sqltune.import_sql_profile]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[performance tuning]]></category>
		<category><![CDATA[sql profile]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/undocumented-way-%e9%80%9a%e8%bf%87%e6%89%8b%e5%b7%a5%e5%88%9b%e5%bb%basql-profiles%e5%9b%ba%e5%ae%9a%e6%89%a7%e8%a1%8c%e8%ae%a1%e5%88%92%e8%bf%9b%e8%a1%8csql%e8%b0%83%e4%bc%98.html</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; 一直以来对SQL profiles都是爱恨有加。SQL profiles的灵活和一些特性(比如对SQL语句级的类似cursor_sharing功能，对非绑定变量环境非常实用)，在不很多不能修改应用代码的场景下最小风险的对SQL语句进行调优，是传统的outline无法比拟的;但是用过SQL profile的朋友应该都清楚，按官方的SQL tuning Advisor提供的sql profies生成办法，由于包含了太多了nodirective Hints(比如OPT_ESTIMATE/COLUMN_STATS/TABLE_STATS等),并不能保证执行计划的稳定性，会随着外界的因素发生改变(比如表和索引的信息，柱状图等信息的变化) 。尽管二者都是依靠hints来提示或者指挥优化器完成执行计划的解析，但却不尽相同。通过SQL Tuning Advisor 生成的hints更多是为执行计划的生成提供评估和参考信息，而Outlinie Hints，倾向于指挥命令。 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 前几天在查阅新书&#60;Pro Oracle SQL&#62;介绍的时候，看到作者blog上有提出了undocmented way手工构造SQL profile的例子，确实能像outline一样，强制固定住执行计划，这顿时让我觉得柳暗花明，因为我之前一直对SQL profiles的稳定性大伤脑筋。结合最近的几次项目调优，使用这种办法固定SQL计划，效果相当不错。 &#160;&#160;&#160;&#160;&#160;&#160;&#160; 手工构造SQL Profiles，可以使用oracle提供的dbms_sqltune.import_sql_profile过程。 SQL&#62; desc dbms_sqltune.import_sql_profile Parameter&#160;&#160; Type&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Mode Default? &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;- &#8212;&#8212;&#8211; SQL_TEXT&#160;&#160;&#160; CLOB&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;-sql文本 PROFILE&#160;&#160;&#160;&#160; SYS.SQLPROF_ATTR IN&#160;&#160;&#160;&#160;&#160; &#8212;-profile info NAME&#160;&#160;&#160;&#160;&#160;&#160;&#160; VARCHAR2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y&#160;&#160;&#160;&#160; &#8212;profile名称 DESCRIPTION VARCHAR2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y CATEGORY&#160;&#160;&#160; VARCHAR2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 一直以来对SQL profiles都是爱恨有加。SQL profiles的灵活和一些特性(比如对SQL语句级的类似cursor_sharing功能，对非绑定变量环境非常实用)，在不很多不能修改应用代码的场景下最小风险的对SQL语句进行调优，是传统的outline无法比拟的;但是用过SQL profile的朋友应该都清楚，按官方的SQL tuning Advisor提供的sql profies生成办法，由于包含了太多了nodirective Hints(比如OPT_ESTIMATE/COLUMN_STATS/TABLE_STATS等),并不能保证执行计划的稳定性，会随着外界的因素发生改变(比如表和索引的信息，柱状图等信息的变化) 。尽管二者都是依靠hints来提示或者指挥优化器完成执行计划的解析，但却不尽相同。通过SQL Tuning Advisor 生成的hints更多是为执行计划的生成提供评估和参考信息，而Outlinie Hints，倾向于指挥命令。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 前几天在查阅新书&lt;Pro Oracle SQL&gt;介绍的时候，看到作者blog上有提出了undocmented way手工构造SQL profile的例子，确实能像outline一样，强制固定住执行计划，这顿时让我觉得柳暗花明，因为我之前一直对SQL profiles的稳定性大伤脑筋。结合最近的几次项目调优，使用这种办法固定SQL计划，效果相当不错。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 手工构造SQL Profiles，可以使用oracle提供的<strong>dbms_sqltune.import_sql_profile</strong>过程。</p>
</p>
<p> <span id="more-624"></span>
</p>
<blockquote><p>SQL&gt; desc dbms_sqltune.import_sql_profile      <br />Parameter&#160;&#160; Type&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Mode Default?       <br />&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;- &#8212;- &#8212;&#8212;&#8211;       <br />SQL_TEXT&#160;&#160;&#160; CLOB&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;-sql文本       <br />PROFILE&#160;&#160;&#160;&#160; SYS.SQLPROF_ATTR IN&#160;&#160;&#160;&#160;&#160; &#8212;-profile info       <br />NAME&#160;&#160;&#160;&#160;&#160;&#160;&#160; VARCHAR2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y&#160;&#160;&#160;&#160; &#8212;profile名称       <br />DESCRIPTION VARCHAR2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y       <br />CATEGORY&#160;&#160;&#160; VARCHAR2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y&#160;&#160; &#8212;类别       <br />VALIDATE&#160;&#160;&#160; BOOLEAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y       <br />REPLACE&#160;&#160;&#160;&#160; BOOLEAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y       <br />FORCE_MATCH BOOLEAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; IN&#160;&#160; Y&#160;&#160;&#160;&#160; &#8211;是否对sql语句进行匹配，游标共享。</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 其中Profile参数，我们可以按照既定格式手工填充，因为一般要调优的SQL语句相对比较长，如果手工填充，不是很现实，可以用已生成的执行计划，从v$sql_plan中提取(当然也可以从awr的dba_hist_sql_plan中提取，提取方法可参见后面脚本)</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 从v$sql_plan中提取sql profiles信息: <a href="http://download.easyora.net/download.php?fname=./script/create_sql_cursor_profiles.sql">create_sql_cursor_profiles.sql</a>(该脚本基于Kerry Osborne完善而成，增加了SQL Profile信息调换功能，更方便的为我们选择想要的执行计划)</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 以下是一个调优案例：</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 项目中有个模块需要进行日结报表统计，没有使用绑定变量,应用返回超时，涉及语句和生产执行计划如下：</p>
<blockquote><p>select a.*      <br />b.ofr_create_time as FILE_CREATETIME,       <br />b.ofr_file_name as FILE_name,       <br />b.ofr_completetime as FILE_RECRONTIME,       <br />b.ofr_deal_type as DEAL_TYPE,       <br />c.ubr_last_send as UBR_LAST_SEND,       <br />c.ubr_completetime as UBR_COMPLETETIME,       <br />c.ubr_state as UBR_STATE,       <br />d.ofc_reckonaccount as ofc_reckonaccount,       <br />d.ofc_province as ofc_province       <br />from UNP_PAYRECORD a, unp_orafile b, unp_paybatch c, unp_orarecord d       <br />where a.ubc_ofc_id = d.ofc_id       <br />and a.ubc_ofc_sn = d.ofc_sn       <br />and a.ubc_id = c.ubr_id       <br />and a.ubc_ofc_id = b.ofr_id       <br />and <strong>b.ofr_deal_type = &#8217;101003&#8242;</strong>       <br />and <strong>c.ubr_last_send between to_date(&#8217;2010-11-12&#8242;, &#8216;yyyy-mm-dd&#8217;) and        <br />to_date(&#8217;2010-11-12&#8242;, &#8216;yyyy-mm-dd&#8217;) + 1         <br /></strong>and b.OFR_COMPLETETIME is not null       <br />and <strong>a.UBC_OFC_PAY_CHANNEL = &#8217;010501&#8242;</strong>       <br />order by a.ubc_id desc, a.ubc_sn asc       <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;&#8211;       <br />| Id&#160; | Operation&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Rows&#160; | Bytes |TempSpc       <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;&#8211;       <br />|&#160;&#160; 0 | SELECT STATEMENT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|&#160;&#160; 1 |&#160; SORT ORDER BY&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93172 |&#160;&#160;&#160; 27M|&#160;&#160;&#160; 58M       <br />|*&#160; 2 |&#160;&#160; HASH JOIN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93172 |&#160;&#160;&#160; 27M|&#160;&#160;&#160; 23M       <br />|*&#160; 3 |&#160;&#160;&#160; HASH JOIN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 92549 |&#160;&#160;&#160; 21M|&#160;&#160;&#160; 21M       <br />|*&#160; 4 |&#160;&#160;&#160;&#160; HASH JOIN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93486 |&#160;&#160;&#160; 20M|&#160; 3656K       <br />|&#160;&#160; 5 |&#160;&#160;&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID| UNP_PAYBATCH&#160; | 87005 |&#160; 2633K|       <br />|*&#160; 6 |&#160;&#160;&#160;&#160;&#160;&#160; INDEX RANGE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | IDX_LAST_SEND | 87005 |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|*&#160; 7 |&#160;&#160;&#160;&#160;&#160; TABLE ACCESS FULL&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | UNP_PAYRECORD |&#160; 5468K|&#160; 1053M|       <br />|&#160;&#160; 8 |&#160;&#160;&#160;&#160; TABLE ACCESS FULL&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | UNP_ORARECORD |&#160;&#160;&#160; 21M|&#160;&#160; 322M|       <br />|*&#160; 9 |&#160;&#160;&#160; TABLE ACCESS FULL&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | UNP_ORAFILE&#160;&#160; |&#160;&#160; 451K|&#160;&#160;&#160; 23M|       <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;&#8211;</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 通过添加Hints，我们认为如下优化后的语句和执行计划可以被接受：</p>
<blockquote><p>select<strong> /*+&#160; ordered use_nl(a,b,c,d) */</strong> a.*,       <br />b.ofr_create_time as FILE_CREATETIME,       <br />b.ofr_file_name as FILE_NAME,       <br />b.ofr_completetime as FILE_RECRONTIME,       <br />b.ofr_deal_type as DEAL_TYPE,       <br />c.ubr_last_send as UBR_LAST_SEND,       <br />c.ubr_completetime as UBR_COMPLETETIME,       <br />c.ubr_state as UBR_STATE,       <br />d.ofc_reckonaccount as ofc_reckonaccount,       <br />d.ofc_province as ofc_province       <br />from&#160;&#160; unp_paybatch c,UNP_PAYRECORD a ,unp_orafile b,unp_orarecord d       <br />where a.ubc_ofc_id = d.ofc_id       <br />and a.ubc_ofc_sn = d.ofc_sn       <br />and a.ubc_id = c.ubr_id       <br />and a.ubc_ofc_id = b.ofr_id       <br />and b.ofr_deal_type = &#8217;101003&#8242;       <br />and c.ubr_last_send between to_date(&#8217;2010-11-12&#8242;, &#8216;yyyy-mm-dd&#8217;) and       <br />to_date(&#8217;2010-11-12&#8242;, &#8216;yyyy-mm-dd&#8217;) + 1       <br />and b.OFR_COMPLETETIME is not null       <br />and a.UBC_OFC_PAY_CHANNEL = &#8217;010501&#8242;       <br />order by a.ubc_id desc, a.ubc_sn asc</p>
<p>&#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;&#8211;      <br />| Id&#160; | Operation&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Rows&#160; | Bytes |TempSpc       <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;&#8211;       <br />|&#160;&#160; 0 | SELECT STATEMENT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|&#160;&#160; 1 |&#160; SORT ORDER BY&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93172 |&#160;&#160;&#160; 27M|&#160;&#160;&#160; 58M       <br />|&#160;&#160; 2 |&#160;&#160; NESTED LOOPS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93172 |&#160;&#160;&#160; 27M|       <br />|&#160;&#160; 3 |&#160;&#160;&#160; NESTED LOOPS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 94116 |&#160;&#160;&#160; 25M|       <br />|&#160;&#160; 4 |&#160;&#160;&#160;&#160; NESTED LOOPS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93486 |&#160;&#160;&#160; 20M|       <br />|&#160;&#160; 5 |&#160;&#160;&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID| UNP_PAYBATCH&#160; | 87005 |&#160; 2633K|       <br />|*&#160; 6 |&#160;&#160;&#160;&#160;&#160;&#160; INDEX RANGE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | IDX_LAST_SEND | 87005 |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|*&#160; 7 |&#160;&#160;&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID| UNP_PAYRECORD |&#160;&#160;&#160;&#160; 1 |&#160;&#160; 202 |       <br />|*&#160; 8 |&#160;&#160;&#160;&#160;&#160;&#160; INDEX RANGE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | SYS_C003463&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|*&#160; 9 |&#160;&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID | UNP_ORAFILE&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160; 55 |       <br />|* 10 |&#160;&#160;&#160;&#160;&#160; INDEX UNIQUE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | SYS_C003412&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|&#160; 11 |&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID&#160; | UNP_ORARECORD |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160; 16 |       <br />|* 12 |&#160;&#160;&#160;&#160; INDEX UNIQUE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | SYS_C003427&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160;&#160;&#160;&#160; |       <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;&#8211;</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 因为该语句有3个传入参数，没有使用绑定变量，因此不能通过outline的方式进行SQL语句固定，而且，由于亚运期间运维保证封网，无法进行前台应用程序的修改。因此只能寻找别的数据库层上的途径。</p>
<p><strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 尝试去手工去构造SQL Profile。用的就是偷梁换柱的思想，将原始的SQL语句的profiles和优化后的SQL语句的profiles信息调换(这种办法,也常常用在outline的构造中)</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 查询到原始的SQL语句，其sql_id为&#8217;ar6qss94q5m9b&#8217;,child_number为0</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 加过Hints优化后的SQL语句，其sql_id为&#8217;4brxrmxzhavtr&#8217;,child_number为0</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 生成SQL profile，其sql文本对应为ar6qss94q5m9b的sqltext(原始文本)，而执行计划信息对应为4brxrmxzhavtr的执行计划(调优后的计划)。</p>
<blockquote><p>SQL&gt; @create_sql_cursor_profiles.sql      <br /><strong>Enter value for sql_id1(used to generate sql_text):</strong> ar6qss94q5m9b       <br />Enter value for child_no1 (used to generate sql_text) (0): 0       <br /><strong>Enter value for sql_id2(used to generate sql_hints):</strong> 4brxrmxzhavtr       <br />Enter value for child_no2(used to generate sql_hints) (0):       <br />Enter value for profile_name (PROF_sqlid_planhash): PROF_1       <br />Enter value for category (DEFAULT):       <br />Enter value for force_matching (FALSE): true       <br />old&#160;&#160; 9: decode(&#8216;&amp;&amp;profile_name&#8217;,'X0X0X0X0&#8242;,&#8217;PROF_&amp;&amp;sql_id1&#8242;||&#8217;_'||plan_hash_value,&#8217;&amp;&amp;profile_name&#8217;)       <br />new&#160;&#160; 9: decode(&#8216;X0X0X0X0&#8242;,&#8217;X0X0X0X0&#8242;,&#8217;PROF_ar6qss94q5m9b&#8217;||&#8217;_'||plan_hash_value,&#8217;X0X0X0X0&#8242;)       <br />old&#160; 15: sql_id = &#8216;&amp;&amp;sql_id1&#8242;       <br />new&#160; 15: sql_id = &#8216;ar6qss94q5m9b&#8217;       <br />old&#160; 16: and child_number = &amp;&amp;child_no1;       <br />new&#160; 16: and child_number = 0;       <br />old&#160; 31: sql_id = &#8216;&amp;&amp;sql_id2&#8242;       <br />new&#160; 31: sql_id = &#8217;4brxrmxzhavtr&#8217;       <br />old&#160; 32: and child_number = &amp;&amp;child_no2       <br />new&#160; 32: and child_number = 0       <br />old&#160; 40: category =&gt; &#8216;&amp;&amp;category&#8217;,       <br />new&#160; 40: category =&gt; &#8216;DEFAULT&#8217;,       <br />old&#160; 42: force_match =&gt; &amp;&amp;force_matching       <br />new&#160; 42: force_match =&gt; true       <br />old&#160; 53:&#160;&#160; dbms_output.put_line(&#8216;ERROR: sql_id: &#8216;||&#8217;&amp;&amp;sql_id1&#8242;||&#8217; Child: &#8216;||&#8217;&amp;&amp;child_no1&#8242;||&#8217; not found in v$sql.&#8217;);       <br />new&#160; 53:&#160;&#160; dbms_output.put_line(&#8216;ERROR: sql_id: &#8216;||&#8217;ar6qss94q5m9b&#8217;||&#8217; Child: &#8216;||&#8217;0&#8242;||&#8217; not found in v$sql.&#8217;);</p>
<p>PL/SQL procedure successfully completed.</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 查看是否有SQL profile生成.</p>
<blockquote><p>SQL&gt; select name,category,signature,sql_text,created,status,force_matching from dba_sql_profiles;      <br />NAME&#160;&#160;&#160;&#160;&#160;&#160; CATEGORY&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SIGNATURE SQL_TEXT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CREATED&#160;&#160;&#160;&#160; STATUS&#160;&#160; FORCE_MATCHING       <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;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;       <br />PROF_1&#160;&#160;&#160;&#160;&#160;&#160; DEFAULT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 8.70867244&#160;&#160;&#160;&#160;&#160;&#160;&#160; (略)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2010/12/20&#160; ENABLED&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; YES</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 查看该PROF_1的outline hints</p>
<blockquote><p>SQL&gt; select attr_val&#160; from dba_sql_profiles p, sys.sqlprof$attr h where p.signature = h.signature&#160; and p.category = h.category and a.name=&#8217;PROF_1&#8242;;</p>
<p>IGNORE_OPTIM_EMBEDDED_HINTS      <br />OPTIMIZER_FEATURES_ENABLE(&#8217;10.2.0.4&#8242;)       <br />ALL_ROWS       <br />OUTLINE_LEAF(@&quot;SEL$1&quot;)       <br />INDEX_RS_ASC(@&quot;SEL$1&quot; &quot;C&quot;@&quot;SEL$1&quot; (&quot;UNP_PAYBATCH&quot;.&quot;UBR_LAST_SEND&quot;))       <br />INDEX_RS_ASC(@&quot;SEL$1&quot; &quot;A&quot;@&quot;SEL$1&quot; (&quot;UNP_PAYRECORD&quot;.&quot;UBC_ID&quot; &quot;UNP_PAYRECORD&quot;.&quot;UBC_SN&quot;))       <br />INDEX_RS_ASC(@&quot;SEL$1&quot; &quot;B&quot;@&quot;SEL$1&quot; (&quot;UNP_ORAFILE&quot;.&quot;OFR_ID&quot;))       <br />INDEX_RS_ASC(@&quot;SEL$1&quot; &quot;D&quot;@&quot;SEL$1&quot; (&quot;UNP_ORARECORD&quot;.&quot;OFC_ID&quot; &quot;UNP_ORARECORD&quot;.&quot;OFC_SN&quot;))       <br />LEADING(@&quot;SEL$1&quot; &quot;C&quot;@&quot;SEL$1&quot; &quot;A&quot;@&quot;SEL$1&quot; &quot;B&quot;@&quot;SEL$1&quot; &quot;D&quot;@&quot;SEL$1&quot;)       <br />USE_NL(@&quot;SEL$1&quot; &quot;A&quot;@&quot;SEL$1&quot;)       <br />USE_NL(@&quot;SEL$1&quot; &quot;B&quot;@&quot;SEL$1&quot;)       <br />USE_NL(@&quot;SEL$1&quot; &quot;D&quot;@&quot;SEL$1&quot;)</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 可见，该语句的SQL Profile已经生成，来验证一下这个语句现在使用的执行计划。</p>
<blockquote><p>SQL&gt; select * from table(dbms_xplan.display_cursor(&#8216;ar6qss94q5m9b&#8217;));      <br />PLAN_TABLE_OUTPUT       <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;&#8211;       <br />SQL_ID&#160; ar6qss94q5m9b, child number 0       <br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-       <br />select a.*,&#160;&#160;&#160;&#160;&#160;&#160;&#160; b.ofr_create_time as FILE_CREATETIME,&#160;&#160;&#160;&#160;&#160;&#160;&#160; b.ofr_file_name       <br />b.ofr_completetime as FILE_RECRONTIME,&#160;&#160;&#160;&#160;&#160;&#160;&#160; b.ofr_deal_type as DEAL_TYPE,       <br />c.ubr_last_send as UBR_LAST_SEND,&#160;&#160;&#160;&#160;&#160;&#160;&#160; c.ubr_completetime as UBR_COMPLETETIME,       <br />c.ubr_state as UBR_STATE,&#160;&#160;&#160;&#160;&#160;&#160;&#160; d.ofc_reckonaccount as ofc_reckonaccount,       <br />as ofc_province&#160;&#160; from UNP_PAYRECORD a, unp_orafile b, unp_paybatch c, unp_orare       <br />a.ubc_ofc_id = d.ofc_id&#160;&#160;&#160; and a.ubc_ofc_sn = d.ofc_sn&#160;&#160;&#160; and a.ubc_id = c.ubr_i       <br />a.ubc_ofc_id = b.ofr_id&#160;&#160;&#160; and b.ofr_deal_type = &#8217;101003&#8242;&#160;&#160;&#160; and c.ubr_last_send       <br />to_date(&#8217;2010-11-12&#8242;, &#8216;yyyy-mm-dd&#8217;) and&#160;&#160;&#160;&#160;&#160;&#160;&#160; to_date(&#8217;2010-11-12&#8242;, &#8216;yyyy-mm-dd       <br />b.OFR_COMPLETETIME is not null&#160;&#160;&#160; and a.UBC_OFC_PAY_CHANNEL = &#8217;010501&#8242;&#160; order by       <br />a.ubc_sn asc       <br />Plan hash value: 724325605       <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;&#8211;       <br />| Id&#160; | Operation&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | Rows&#160; | Bytes |TempSpc       <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;&#8211;       <br />|&#160;&#160; 0 | SELECT STATEMENT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|&#160;&#160; 1 |&#160; SORT ORDER BY&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93172 |&#160;&#160;&#160; 27M|&#160;&#160;&#160; 58M       <br />|&#160;&#160; 2 |&#160;&#160; NESTED LOOPS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93172 |&#160;&#160;&#160; 27M|       <br />|&#160;&#160; 3 |&#160;&#160;&#160; NESTED LOOPS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 94116 |&#160;&#160;&#160; 25M|       <br />|&#160;&#160; 4 |&#160;&#160;&#160;&#160; NESTED LOOPS&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; |&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | 93486 |&#160;&#160;&#160; 20M|       <br />|&#160;&#160; 5 |&#160;&#160;&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID| UNP_PAYBATCH&#160; | 87005 |&#160; 2633K|       <br />|*&#160; 6 |&#160;&#160;&#160;&#160;&#160;&#160; INDEX RANGE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | IDX_LAST_SEND | 87005 |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|*&#160; 7 |&#160;&#160;&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID| UNP_PAYRECORD |&#160;&#160;&#160;&#160; 1 |&#160;&#160; 202 |       <br />|*&#160; 8 |&#160;&#160;&#160;&#160;&#160;&#160; INDEX RANGE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | SYS_C003463&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|*&#160; 9 |&#160;&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID | UNP_ORAFILE&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160; 55 |       <br />|* 10 |&#160;&#160;&#160;&#160;&#160; INDEX UNIQUE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | SYS_C003412&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160;&#160;&#160;&#160; |       <br />|&#160; 11 |&#160;&#160;&#160; TABLE ACCESS BY INDEX ROWID&#160; | UNP_ORARECORD |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160; 16 |       <br />|* 12 |&#160;&#160;&#160;&#160; INDEX UNIQUE SCAN&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | SYS_C003427&#160;&#160; |&#160;&#160;&#160;&#160; 1 |&#160;&#160;&#160;&#160;&#160;&#160; |       <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;&#8211;       <br />Predicate Information (identified by operation id):       <br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;       <br />6 &#8211; access(&quot;C&quot;.&quot;UBR_LAST_SEND&quot;&gt;=TIMESTAMP&#8217; 2010-11-12 00:00:00&#8242; AND       <br />&quot;C&quot;.&quot;UBR_LAST_SEND&quot;&lt;=TIMESTAMP&#8217; 2010-11-13 00:00:00&#8242;)       <br />7 &#8211; filter(&quot;A&quot;.&quot;UBC_OFC_PAY_CHANNEL&quot;=&#8217;010501&#8242;)       <br />8 &#8211; access(&quot;A&quot;.&quot;UBC_ID&quot;=&quot;C&quot;.&quot;UBR_ID&quot;)       <br />9 &#8211; filter((&quot;B&quot;.&quot;OFR_DEAL_TYPE&quot;=&#8217;101003&#8242; AND &quot;B&quot;.&quot;OFR_COMPLETETIME&quot; IS NOT NU       <br />PLAN_TABLE_OUTPUT       <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;&#8211;       <br />10 &#8211; access(&quot;A&quot;.&quot;UBC_OFC_ID&quot;=&quot;B&quot;.&quot;OFR_ID&quot;)       <br />12 &#8211; access(&quot;A&quot;.&quot;UBC_OFC_ID&quot;=&quot;D&quot;.&quot;OFC_ID&quot; AND &quot;A&quot;.&quot;UBC_OFC_SN&quot;=&quot;D&quot;.&quot;OFC_SN&quot;)       <br />Note       <br />&#8212;&#8211;       <br /><strong><span style="color: #ff0000">- SQL profile &quot;PROF_1&quot; used for this statement          <br /></span></strong></p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 执行计划与我们预期的一致，由于SQL Profile的设置了force match，因此，可以替入其他参数值，验证执行计划依然是完美保持的，对执行计划的固定原理上，同outline也就没有太大区别了。</p>
<ul class="related_post">
<li><a href="http://www.easyora.net/blog/oracle_read_write_separated_architecture.html" title="Oracle读写分离架构">Oracle读写分离架构</a></li>
<li><a href="http://www.easyora.net/blog/manual_fix_asm_disk_header2.html" title="完全手工重构ASM Disk Header &lt;二&gt;">完全手工重构ASM Disk Header &lt;二&gt;</a></li>
<li><a href="http://www.easyora.net/blog/manual_fix_asm_disk_header1.html" title="完全手工重构ASM Disk Header &lt;一&gt;">完全手工重构ASM Disk Header &lt;一&gt;</a></li>
<li><a href="http://www.easyora.net/blog/dataguard_log_gap_mechanism.html" title="Dataguard的两种Log Gap检测和处理机制">Dataguard的两种Log Gap检测和处理机制</a></li>
<li><a href="http://www.easyora.net/blog/monitor_dg_sync_script.html" title="Physical Dataguard同步状态Shell巡检监控一则">Physical Dataguard同步状态Shell巡检监控一则</a></li>
<li><a href="http://www.easyora.net/blog/mma_dataguard_tuning_network.html" title="Dataguard高级调整之一&#8212;&#8211;网络调整">Dataguard高级调整之一&#8212;&#8211;网络调整</a></li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/manual_create_sql_profile_lock_sqlplan.html&title=Undocumented+Way%26%238211%3B%E9%80%9A%E8%BF%87%E6%89%8B%E5%B7%A5%E5%88%9B%E5%BB%BAsql+profiles%E5%9B%BA%E5%AE%9A%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92%E8%BF%9B%E8%A1%8CSQL%E8%B0%83%E4%BC%98&tags=dbms_sqltune.import_sql_profile, oracle, performance tuning, sql profile, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/manual_create_sql_profile_lock_sqlplan.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>完全手工重构ASM Disk Header &lt;二&gt;</title>
		<link>http://www.easyora.net/blog/manual_fix_asm_disk_header2.html</link>
		<comments>http://www.easyora.net/blog/manual_fix_asm_disk_header2.html#comments</comments>
		<pubDate>Mon, 20 Dec 2010 08:16:42 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[asm]]></category>
		<category><![CDATA[asm disk header]]></category>
		<category><![CDATA[kfed]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[重构]]></category>

		<guid isPermaLink="false">http://www.easyora.net/?p=614</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ASM disk header 相关信息如何获取，可参考 完全手工重构ASM Disk Header &#60;一&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 以下是一个ASM diskgroup中disk文件头全部损坏重构的例子。 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 启动asm实例，diskgroup TEST无法挂载。 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 以下是alert.log错误信息： &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#160; NOTE: cache registered group TEST number=2 incarn=0xc868c69a Sun Dec 19 14:44:38 2010 ERROR: no PST quorum in group 2: required 2, found 0 Sun Dec 19 14:44:38 2010 NOTE: cache dismounting group 2/0xC868C69A (TEST) NOTE: dbwr not [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ASM disk header 相关信息如何获取，可参考 <a href="http://www.easyora.net/blog/manual_fix_asm_disk_header1.html">完全手工重构ASM Disk Header &lt;一&gt;</a></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 以下是一个ASM diskgroup中disk文件头全部损坏重构的例子。 </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 启动asm实例，diskgroup TEST无法挂载。 </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 以下是alert.log错误信息： </p>
<blockquote><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#160; <br />NOTE: cache registered group TEST number=2 incarn=0xc868c69a     <br />Sun Dec 19 14:44:38 2010     <br />ERROR: no PST quorum in group 2: required 2, found 0     <br />Sun Dec 19 14:44:38 2010     <br />NOTE: cache dismounting group 2/0xC868C69A (TEST)     <br />NOTE: dbwr not being msg&#8217;d to dismount     <br />ERROR: diskgroup TEST was not mounted </p></blockquote>
<p> <span id="more-614"></span>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Diskgroup TEST无法mount，需要2块asm disk，但都已经丢失。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 接下来判断TEST diskgroup所使用的磁盘。 先获取OS上可用的asm disk. </p>
<blockquote><p>[oracle@node1 ~]$ kfod disk=all    <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;&#8211;     <br />Disk&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Size Path&#160;&#160;&#160;&#160;&#160; <br />=============================================================     <br />&#160;&#160; 1:&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1000 Mb /dev/raw/raw1     <br />&#160;&#160; 2:&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1000 Mb /dev/raw/raw101     <br />&#160;&#160; 3:&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1000 Mb /dev/raw/raw102     <br />&#160;&#160; 4:&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1000 Mb /dev/raw/raw103     <br />&#160;&#160; 5:&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1000 Mb /dev/raw/raw104     <br />&#160;&#160; 6:&#160;&#160;&#160;&#160;&#160; 10240 Mb /dev/raw/raw11     </p></blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 结合asm实例的v$asm_disk和操作系统上设备的使用情况，对asm磁盘信息进行筛除，定位到 TEST使用的磁盘为/dev/raw/raw101 和/dev/raw/raw102.   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 利用shell脚本对这两个asm disk进行扫描，首先找到disk directory.<br />
<blockquote>[oracle@node1 ~]$ ./echo_asm_info.sh &#8211;scan&#160; 10 3 /dev/raw/raw101 KFBTYP_DISKDIR </p></blockquote>
<blockquote><p>[oracle@node1 ~]$ sh echo.sh &#8211;scan&#160; 10 3 /dev/raw/raw102 KFBTYP_DISKDIR      <br />aunum=2 blknum=0 : kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6 ; 0&#215;002: KFBTYP_DISKDIR       <br />aunum=2 blknum=1 : kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6 ; 0&#215;002: KFBTYP_DISKDIR       <br />aunum=2 blknum=2 : kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6 ; 0&#215;002: KFBTYP_DISKDIR </p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 可知disk directory位于设备raw102上的AU2 blknum0 上。&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 对raw102 AU2 blknum0做kfed read，获得我们需要的相关信息：<br />
<blockquote>kfddde[0].dsknum:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;034: 0&#215;0000    <br />kfddde[0].state:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0&#215;036: KFDSTA_NORMAL     <br />kfddde[0].ub1spare:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;037: 0&#215;00     <br />kfddde[0].dskname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TEST_0000 ; 0&#215;038: length=9     <br />kfddde[0].fgname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TEST_0000 ; 0&#215;058: length=9     <br />kfddde[0].crestmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944750 ; 0&#215;078: HOUR=0xe DAYS=0&#215;13 MNTH=0xc YEAR=0x7da     <br />kfddde[0].crestmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 4442112 ; 0x07c: USEC=0&#215;0 MSEC=0xf2 SECS=0&#215;4 MINS=0&#215;0     <br />kfddde[0].size:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 100 ; 0x08c: 0&#215;00000064     <br />TEST_0000     <br />&lt;&#8212;&#8212;&#8212;&#8212; 略 &#8212;&#8212;&#8212;&#8211;&gt;     <br />kfddde[1].dsknum:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0x1f4: 0&#215;0001     <br />kfddde[1].state:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0x1f6: KFDSTA_NORMAL     <br />kfddde[1].ub1spare:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1f7: 0&#215;00     <br />kfddde[1].dskname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TEST_0001 ; 0x1f8: length=9     <br />kfddde[1].fgname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TEST_0001 ; 0&#215;218: length=9     <br />kfddde[1].crestmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944750 ; 0&#215;238: HOUR=0xe DAYS=0&#215;13 MNTH=0xc YEAR=0x7da     <br />kfddde[1].crestmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 4442112 ; 0x23c: USEC=0&#215;0 MSEC=0xf2 SECS=0&#215;4 MINS=0&#215;0     <br />kfddde[1].size:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 100 ; 0x08c: 0&#215;00000064     <br />TEST_0000的dsknum为0 ；TEST_0001的dsknum为1。     <br />[oracle@node1 ~]$ kfed read /dev/raw/raw102 aunum=0 blknum=1|grep obj     <br />kfbh.block.obj:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2147483649 ; 0&#215;008: TYPE=0&#215;8 NUMB=0&#215;1     <br />[oracle@node1 ~]$ kfed read /dev/raw/raw101 aunum=0 blknum=1|grep obj     <br />kfbh.block.obj:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2147483648 ; 0&#215;008: TYPE=0&#215;8 NUMB=0&#215;0 </p></blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 可知raw101 对应TEST_0000 raw102对应TEST_0001   <br />&#160;&#160;&#160;&#160; ASM header上的如下信息可获得(以下不说明，指raw101信息，raw102信息略)：   <br />&#160;&#160;&#160;&#160; /dev/raw/raw101:<br />
<blockquote><strong>kfdhdb.dsknum:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0      <br />kfdhdb.dskname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TEST_0000 ;       <br />kfdhdb.grpname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TEST ;       <br />kfdhdb.fgname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TEST_0000 ;       <br />kfdhdb.dsksize:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 100;&#160;&#160; <br />kfdhdb.crestmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944750&#160; ;       <br />kfdhdb.crestmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3943035904 ;</strong>&#160; </p></blockquote>
<p>&#160;&#160;&#160;&#160;&#160; 对同一磁盘组内asm disk上的kfdhdb.grpstmp.hi和kfdhdb.grpstmp.lo，取相同值，时间上早于dsknum=0的disk上kfdhdb.crestmp.hi和kfdhdb.crestmp.lo值。    <br />&#160;&#160;&#160;&#160;&#160;&#160; kfdhdb.mntstmp时间上取值晚于kfdhdb.crestmp</p>
<blockquote><p><strong>kfdhdb.mntstmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944750&#160; ;        <br />kfdhdb.mntstmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 4943035900 ;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; kfdhdb.grpstmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944750&#160; ;         <br />kfdhdb.grpstmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2043035901 ;</strong>&#160;&#160; </p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 接下来获取kfdhdb.fstlocn/kfdhdb.altlocn/kfdhdb.f1b1locn值 </p>
<blockquote><p>[oracle@nagios kfed]$ ./echo_asm_info.sh &#8211;scan 5 2 /dev/raw/raw1 KFBTYP_FREESPC </p>
<p>&#8212;&#8212;&#8212;aunum=0 blknum=1 &#8212;&#8212;&#8212;&#8212;-      <br />kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0&#215;002: KFBTYP_FREESPC       </p>
</blockquote>
<p> <strong>kfdhdb.fstlocn: 1</strong><br />
<blockquote>[oracle@nagios kfed]$ ./echo_asm_info.sh &#8211;scan 5 2 /dev/raw/raw1 KFBTYP_ALLOCTBL     <br />&#8212;&#8212;&#8212;aunum=0 blknum=2 &#8212;&#8212;&#8212;&#8212;-     <br />kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3 ; 0&#215;002: KFBTYP_ALLOCTBL </p></blockquote>
<p> <strong>kfdhdb.altlocn：2</strong><br />
<blockquote>
<p>[oracle@node1 ~]$&#160; ./echo_asm_info.sh &#8211;scan 5 2 /dev/raw/raw101 kfffde[0].xptr.au      <br />&#8212;&#8212;&#8211;aunum=2 blknum=1 &#8212;&#8212;&#8212;&#8212;&#8211;       <br />kfffde[0].xptr.au:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0x4a0: 0&#215;00000002 </p>
</blockquote>
<p><strong>kfdhdb.f1b1locn=2</strong> </p>
<p>kfdhdb.grptyp,从PST中获得。</p>
<blockquote><p>[oracle@node1 ~]$&#160; kfed /dev/raw/raw1 aunum=0 blknum=1|grep copyCnt      <br />kfdpHdrB.copyCnt:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;010: 0&#215;01 </p>
</blockquote>
<p><strong>kfdhdb.grptyp=0</strong>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; 取一个asm disk header的模版，将定值和我们获取的信息修改进去，利用kfed merge。 </p>
<blockquote><p>kfed merge /dev/raw/raw101 text=raw101    <br />kfed merge /dev/raw/raw102 text=raw101 </p></blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 接下来尝试对Diskgroup TEST做mount</p>
<blockquote><p>&#160; SQL&gt;alter diskgroup test mount ;</p>
<p>&#160; done</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 验证过程，略。</p>
<ul class="related_post">
<li><a href="http://www.easyora.net/blog/manual_fix_asm_disk_header1.html" title="完全手工重构ASM Disk Header &lt;一&gt;">完全手工重构ASM Disk Header &lt;一&gt;</a></li>
<li><a href="http://www.easyora.net/blog/asm_migrate.html" title=" ASM下的存储更换迁移方案"> ASM下的存储更换迁移方案</a></li>
<li><a href="http://www.easyora.net/blog/oracle_read_write_separated_architecture.html" title="Oracle读写分离架构">Oracle读写分离架构</a></li>
<li><a href="http://www.easyora.net/blog/manual_create_sql_profile_lock_sqlplan.html" title="Undocumented Way&#8211;通过手工创建sql profiles固定执行计划进行SQL调优">Undocumented Way&#8211;通过手工创建sql profiles固定执行计划进行SQL调优</a></li>
<li><a href="http://www.easyora.net/blog/dataguard_log_gap_mechanism.html" title="Dataguard的两种Log Gap检测和处理机制">Dataguard的两种Log Gap检测和处理机制</a></li>
<li><a href="http://www.easyora.net/blog/monitor_dg_sync_script.html" title="Physical Dataguard同步状态Shell巡检监控一则">Physical Dataguard同步状态Shell巡检监控一则</a></li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/manual_fix_asm_disk_header2.html&title=%E5%AE%8C%E5%85%A8%E6%89%8B%E5%B7%A5%E9%87%8D%E6%9E%84ASM+Disk+Header+%26lt%3B%E4%BA%8C%26gt%3B&tags=asm, asm disk header, kfed, oracle, 重构, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/manual_fix_asm_disk_header2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>完全手工重构ASM Disk Header &lt;一&gt;</title>
		<link>http://www.easyora.net/blog/manual_fix_asm_disk_header1.html</link>
		<comments>http://www.easyora.net/blog/manual_fix_asm_disk_header1.html#comments</comments>
		<pubDate>Mon, 20 Dec 2010 07:25:00 +0000</pubDate>
		<dc:creator>Kevin.yuan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[asm]]></category>
		<category><![CDATA[asm disk header]]></category>
		<category><![CDATA[kfed]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[重构]]></category>

		<guid isPermaLink="false">http://www.easyora.net/blog/%e5%ae%8c%e5%85%a8%e6%89%8b%e5%b7%a5%e9%87%8d%e6%9e%84asm-disk-header-%e4%b8%80.html</guid>
		<description><![CDATA[完全手工重构ASM Disk Header]]></description>
			<content:encoded><![CDATA[<p>&#160;&#160;&#160;&#160;&#160;&#160; 上周帮朋友处理了一个ASM磁盘的故障，反馈到我这里，看到asm disk header的信息已经全部丢失，由于只是损坏了diskgroup组中的一个disk，很多信息可以从该组内的其他disk上获得，处理起来不是太麻烦，用kfed merge了一下，受损的diskgroup被重新挂载。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 如果问题再延伸一下，假设一个diskgroup的上所有的disk header信息全部丢失，重新构造一个全新的header的工作量就大了不少，相关数值又是如何获得呢？经过几天的研究，一个asm disk header上的核心信息完全可以从disk上其他AU中获取或计算出来，通过这些信息，<strong>ASM disk header可以完全重构</strong>。当然，作为一个甲方dba，这种需要借助非常规处理的极端故障情况，几乎在我们的环境中不可能出现，绝大部分隐患故障理所应当通过技术、管理和其他手段规避。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 重构asm disk header，比较方便的方法就是使用kfed，另外，很多信息需要根据disk上的其他au和block位置上的结构体来定位，如果对这部分结构不熟悉，要提高效率快速定位，在unix下，比较方便的办法就是利用shell脚本，对disk根据AU和block遍历查找，从而获得我们想要的信息。11g下某些信息和属性有别，以下信息仅供10g参考。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 比如，我重构ASM Disk Header,常用的两样东西：kfed 和自己写的一个简单的shell脚本(以下称之为echo_asm_status.sh，作用就是根据指定关键字获取AU和block,脚本很简单，就不列出来了，弄个循环跑，grep我们想要的关键字就行了)</p>
<p> <span id="more-608"></span>&#160;&#160;&#160;&#160;&#160; 先拿一个asm disk header做例子，来解读一下它的结构和核心数据如何计算。
</p>
<blockquote><p>kfbh.endian:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;000: 0&#215;01&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* endianness of writer&#160;&#160;&#160; Little endian = 1|Big endian = 0&#160; 1 高字节为0*/       <br /></span>kfbh.hard:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 130 ; 0&#215;001: 0&#215;82&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* H.A.R.D. magic # and block size */       <br /></span>kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;002: KFBTYP_DISKHEAD&#160; <span style="color: #ff0000">/* metadata block type 此处取值为1.对于我们重构需要的类型有 1.KFBTYP_DISKHEAD&#160; 2.KFBTYP_FREESPC 3.KFBTYP_ALLOCTBL 4.KFBTYP_FILEDIR 5.KFBTYP_LISTHEAD 6.KFBTYP_DISKDIR&#160;&#160; 17.KFBTYP_PST_META 等 */       <br /></span>kfbh.datfmt:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;003: 0&#215;01&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* metadata block data format 取值为1,表示已经格式化*/       <br /></span>kfbh.block.blk:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;004: T=0 NUMB=0&#215;0&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* block location of this block*&#160; Disk header should have T=0 and NUMB=0&#215;0 取值为0 */</span><span style="color: #ff0000">       <br /></span>kfbh.block.obj:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2147483648 ; 0&#215;008: TYPE=0&#215;8 NUMB=0&#215;0&#160; <span style="color: #ff0000">/* block object id&#160;&#160;&#160;&#160; Disk header 的type为8 ，num表示asm disk在group中的编号,即kfdhdb.dsknum，TYPE=0&#215;8 NUMB=0&#215;0表示为8000000，十进制也就是2147483648 */       <br /></span>kfbh.check:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3359966064 ; 0x00c: 0xc8450370&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* check value to verify consistency *&#160; 通过kfed可自动计算/</span>      <br />kfbh.fcn.base:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 108 ; 0&#215;010: 0x0000006c&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* change number of last change*/       <br /></span>kfbh.fcn.wrap:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;014: 0&#215;00000000      <br />kfbh.spare1:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;018: 0&#215;00000000      <br />kfbh.spare2:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x01c: 0&#215;00000000      <br />kfdhdb.driver.provstr:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ORCLDISK ; 0&#215;000: length=8&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* ASMLIB driver reserved block&#160; If no driver is defined &quot;ORCLDISK&quot; is used. 如果没使用ASMlib，默认为 ORCLDISK，否则为ORCLDISK+Name*/       <br /></span>kfdhdb.driver.reserved[0]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;008: 0&#215;00000000      <br />kfdhdb.driver.reserved[1]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x00c: 0&#215;00000000      <br />kfdhdb.driver.reserved[2]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;010: 0&#215;00000000      <br />kfdhdb.driver.reserved[3]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;014: 0&#215;00000000      <br />kfdhdb.driver.reserved[4]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;018: 0&#215;00000000      <br />kfdhdb.driver.reserved[5]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x01c: 0&#215;00000000      <br />kfdhdb.compat:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 168820736 ; 0&#215;020: 0x0a100000&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Comaptible software version&#160;&#160; 0x0a100000:10.1.0.0.0 */       <br /></span>kfdhdb.dsknum:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;024: 0&#215;0000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* This is the disk number.&#160;&#160; 可以通过kfbh.block.obj获得编号，也可以通过disk directory获得 */       <br /></span>kfdhdb.grptyp:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;026: KFDGTP_EXTERNAL&#160;&#160;&#160; <span style="color: #ff0000">/* Disk group type 通过PST获得&#160; 0:KFDGTP_INVALID 1:KFDGTP_EXTERNAL 2:KFDGTP_NORMAL 3:KFDGTP_HIGH&#160; */       <br /></span>kfdhdb.hdrsts:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3 ; 0&#215;027: KFDHDR_MEMBER&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Disk header status */       <br />KFDHDR_INVALID&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211;&#160; Illegal value        <br />KFDHDR_UNKNOWN&#160;&#160;&#160;&#160; &#8211;&#160; Disk header block unreadable        <br />KFDHDR_CANDIDATE&#160;&#160;&#160;&#160; &#8211;&#160; No OSM or OS disk header found        <br />KFDHDR_MEMBER&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211;&#160; Normal member of the group </span></p>
<p><span style="color: #ff0000">KFDHDR_FORMER&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211;&#160; Disk dropped cleanly from group       <br />KFDHDR_CONFLICT&#160;&#160;&#160;&#160;&#160;&#160; &#8211;&#160; Header conflicts        <br />KFDHDR_INCOMPAT&#160;&#160;&#160;&#160;&#160; &#8211;&#160; Written by incompatible software        <br />KFDHDR_PROVISIONED&#160; &#8211;&#160; Disk was prepared beforehand&#160;&#160;&#160;&#160; */        <br /></span>kfdhdb.dskname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KAO_0000 ; 0&#215;028: length=8&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* ASM disk name */       <br /></span>kfdhdb.grpname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KAO ; 0&#215;048: length=3&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* ASM diskgroup name，通过disk directory 获得 */       <br /></span>kfdhdb.fgname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KAO_0000 ; 0&#215;068: length=8&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* ASM failgroup name ，通过disk directory 获得*/       <br /></span>kfdhdb.capname:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ; 0&#215;088: length=0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Capacity group name, unused*/</span>      <br />kfdhdb.crestmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944719 ; 0x0a8: HOUR=0xf DAYS=0&#215;12 MNTH=0xc YEAR=0x7da&#160;&#160; <span style="color: #ff0000">/* Creation timestamp 通过disk directory 获得*/       <br /></span>kfdhdb.crestmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3943035904 ; 0x0ac: USEC=0&#215;0 MSEC=0x17d SECS=0&#215;30 MINS=0x3a <span style="color: #ff0000">/* Creation timestamp 通过disk directory 获得*/       <br /></span>kfdhdb.mntstmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944743 ; 0x0b0: HOUR=0&#215;7 DAYS=0&#215;13 MNTH=0xc YEAR=0x7da&#160; <span style="color: #ff0000">/* mount timestamp*&#160; 非定值，可根据规则自定值*/       <br /></span>kfdhdb.mntstmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1611210752 ; 0x0b4: USEC=0&#215;0 MSEC=0&#215;248 SECS=0&#215;0 MINS=0&#215;18&#160;&#160; <span style="color: #ff0000">/* mount timestamp* 非定值，可根据规则自定值*/       <br /></span>kfdhdb.secsize:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 512 ; 0x0b8: 0&#215;0200&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Disk sector size (bytes)&#160; 默认取值512*/       <br /></span>kfdhdb.blksize:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 4096 ; 0x0ba: 0&#215;1000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Metadata block (bytes)&#160; 默认取值4096*/</span>      <br />kfdhdb.ausize:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1048576 ; 0x0bc: 0&#215;00100000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Allocation Unit (bytes)&#160; 默认取值1M*/</span>      <br />kfdhdb.mfact:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 113792 ; 0x0c0: 0x0001bc80&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Stride between phys addr AUs&#160; 默认取值113792 */</span>      <br />kfdhdb.dsksize:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 200 ; 0x0c4: 0x000000c8&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Disk size&#160; 可通过KFBTYP_FREESPC获得，也可通过disk directory获得*/       <br /></span>kfdhdb.pmcnt:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0x0c8: 0&#215;00000002&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* Number of physically addressed allocation units */</span>      <br />kfdhdb.fstlocn:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0x0cc: 0&#215;00000001&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* First FreeSpace table blk num&#160; 用于记录freespace信息的首个block,通过KFBTYP_FREESPC 获得 */</span>      <br />kfdhdb.altlocn:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0x0d0: 0&#215;00000002&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* First Alocation table blk num&#160; 用于记录allocation信息的首个block ,通过KFBTYP_ALLOCTBL</span> <span style="color: #ff0000">获得*/       <br /></span>kfdhdb.f1b1locn:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0x0d4: 0&#215;00000002&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/* File Directory blk 1 AU num&#160; File Directory起始地址 */       <br /></span>kfdhdb.redomirrors[0]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x0d8: 0&#215;0000      <br />kfdhdb.redomirrors[1]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 65535 ; 0x0da: 0xffff      <br />kfdhdb.redomirrors[2]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 65535 ; 0x0dc: 0xffff      <br />kfdhdb.redomirrors[3]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 65535 ; 0x0de: 0xffff      <br />kfdhdb.dbcompat:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 168820736 ; 0x0e0: 0x0a100000&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #ff0000">/*Comaptible database version&#160;&#160; 0x0a100000:10.1.0.0.0 */       <br /></span>kfdhdb.grpstmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944719 ; 0x0e4: HOUR=0xf DAYS=0&#215;12 MNTH=0xc YEAR=0x7da&#160;&#160; <span style="color: #ff0000">/* diskgroup create time&#160; 可根据规则重新定义 */       <br /></span>kfdhdb.grpstmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3943035904 ; 0x0e8: USEC=0&#215;0 MSEC=0x17d SECS=0&#215;30 MINS=0x3a&#160; <span style="color: #ff0000">/* diskgroup create time&#160; 可根据规则重新定义 */       <br /></span>kfdhdb.ub4spare[0]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x0ec: 0&#215;00000000      <br />kfdhdb.ub4spare[1]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x0f0: 0&#215;00000000      <br />&lt;&lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; 略 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;      <br />kfdhdb.ub4spare[56]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1cc: 0&#215;00000000      <br />kfdhdb.ub4spare[57]:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1d0: 0&#215;00000000      <br />kfdhdb.acdb.aba.seq:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1d4: 0&#215;00000000      <br />kfdhdb.acdb.aba.blk:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1d8: 0&#215;00000000      <br />kfdhdb.acdb.ents:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1dc: 0&#215;0000      <br />kfdhdb.acdb.ub2spare:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1de: 0&#215;0000</p>
</blockquote>
<p><strong>1) 如何获得disk directory     <br /></strong>&#160;&#160;&#160;&#160;&#160;&#160; 判断diskgroup中由哪几个asm disk组成，核心就是要找到asm disk directory。disk directory的类型为KFBTYP_DISKDIR。该类型block记录了一个diskgroup中所有的asm disk信息，包括disk的编号、名称、创建时间和容量等。可以利用脚本扫描获得。</p>
<blockquote><p>[oracle@node1 kfed]$ ./echo_asm_info.sh &#8211;scan 5 2 /dev/raw/raw2 KFBTYP_DISKDIR     <br />&#8212;&#8212;&#8212;aunum=2 blknum=0 &#8212;&#8212;&#8212;&#8212;-      <br />kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6 ; 0&#215;002: KFBTYP_DISKDIR      <br />&#8212;&#8212;&#8212;aunum=2 blknum=1 &#8212;&#8212;&#8212;&#8212;-      <br />kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6 ; 0&#215;002: KFBTYP_DISKDIR</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 可知KFBTYP_DISKDIR从 AU2 block 0上起始。查看这部分信息：</p>
<blockquote><p>kfed read /dev/raw/raw2 aunum=2 blknum=0</p>
</blockquote>
<blockquote><p>kfddde[0].entry.incarn:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;024: A=1 NUMM=0&#215;0     <br />kfddde[0].entry.hash:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;028: 0&#215;00000000      <br />kfddde[0].entry.refer.number:4294967295 ; 0x02c: 0xffffffff      <br />kfddde[0].entry.refer.incarn:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;030: A=0 NUMM=0&#215;0      <br /><strong>kfddde[0].dsknum</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;034: 0&#215;0000      <br />kfddde[0].state:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0&#215;036: KFDSTA_NORMAL      <br />kfddde[0].ub1spare:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;037: 0&#215;00      <br /><strong>kfddde[0].dskname</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KAO_0000 ; 0&#215;038: length=8      <br /><strong>kfddde[0].fgname</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KAO_0000 ; 0&#215;058: length=8      <br /><strong>kfddde[0].crestmp.hi</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944719 ; 0&#215;078: HOUR=0xf DAYS=0&#215;12 MNTH=0xc YEAR=0x7da      <br /><strong>kfddde[0].crestmp.lo</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3943035904 ; 0x07c: USEC=0&#215;0 MSEC=0x17d SECS=0&#215;30 MINS=0x3a      <br />kfddde[0].failstmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;080: HOUR=0&#215;0 DAYS=0&#215;0 MNTH=0&#215;0 YEAR=0&#215;0      <br />kfddde[0].failstmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;084: USEC=0&#215;0 MSEC=0&#215;0 SECS=0&#215;0 MINS=0&#215;0      <br />kfddde[0].timer:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;088: 0&#215;00000000      <br /><strong>kfddde[0].size</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 200 ; 0x08c: 0x000000c8      <br />&lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; 略 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;      <br />kfddde[1].entry.incarn:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3 ; 0x1e4: A=1 NUMM=0&#215;1      <br />kfddde[1].entry.hash:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0x1e8: 0&#215;00000001      <br />kfddde[1].entry.refer.number:4294967295 ; 0x1ec: 0xffffffff      <br />kfddde[1].entry.refer.incarn:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1f0: A=0 NUMM=0&#215;0      <br /><strong>kfddde[1].dsknum</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0x1f4: 0&#215;0001      <br />kfddde[1].state:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0x1f6: KFDSTA_NORMAL      <br />kfddde[1].ub1spare:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0x1f7: 0&#215;00      <br /><strong>kfddde[1].dskname</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KAO_0001 ; 0x1f8: length=8      <br /><strong>kfddde[1].fgname</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KAO_0001 ; 0&#215;218: length=8      <br /><strong>kfddde[1].crestmp.hi</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 32944751 ; 0&#215;238: HOUR=0xf DAYS=0&#215;13 MNTH=0xc YEAR=0x7da      <br /><strong>kfddde[1].crestmp.lo</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1955419136 ; 0x23c: USEC=0&#215;0 MSEC=0&#215;355 SECS=0&#215;8 MINS=0x1d      <br />kfddde[1].failstmp.hi:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;240: HOUR=0&#215;0 DAYS=0&#215;0 MNTH=0&#215;0 YEAR=0&#215;0      <br />kfddde[1].failstmp.lo:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;244: USEC=0&#215;0 MSEC=0&#215;0 SECS=0&#215;0 MINS=0&#215;0      <br />kfddde[1].timer:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0 ; 0&#215;248: 0&#215;00000000      <br /><strong>kfddde[1].size</strong>:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 200 ; 0x24c: 0x000000c8</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 从这部分信息可知，该diskgroup包含2个asm disk(KAO_0000和KAO_0001),并且我们可以获知各自对应的disknum,createtimestamp，size等。   <br />那如何将asm diskname与相应的设备对应起来呢。关联关系便为dsknum与kfbh.block.obj。    <br />&#160;&#160;&#160;&#160;&#160;&#160; 查询相关的设备的kfbh.block.obj(由于AU0 Block0已经损坏，可从AU0上非block 0上获得)</p>
<blockquote><p>[oracle@node1 kfed]$ kfed read /dev/raw/raw2 aunum=0 blknum=1|grep obj     <br />kfbh.block.obj:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2147483649 ; 0&#215;008: TYPE=0&#215;8 NUMB=0&#215;1      <br />[oracle@node1 kfed]$ kfed read /dev/raw/raw1 aunum=0 blknum=1|grep obj      <br />kfbh.block.obj:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2147483648 ; 0&#215;008: TYPE=0&#215;8 NUMB=0&#215;0</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 可知，raw1对应的obj为NUMB=0&#215;0，表明raw1对应为KAO_00000,而raw2的obj为NUMB=0&#215;1，其对应的asm diskname便是KAO_00001.</p>
<p>从而我们可以至少获得如下重构的信息：</p>
<blockquote><p><strong>kfbh.block.obj       <br />kfdhdb.dsknum        <br />kfdhdb.dskname        <br />kfdhdb.fgname        <br />kfdhdb.crestmp.hi        <br />kfdhdb.crestmp.lo        <br />kfdhdb.blksize </strong></p>
</blockquote>
<p><strong>2) kfbh.endian/kfbh.hard</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 可从disk上其他AU block上获得.</p>
<blockquote><p>[oracle@node1 ~]$ kfed read /dev/raw/raw1 aunum=0 blknum=1|grep -E &quot;endian|hard&quot;     <br />kfbh.endian:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;000: 0&#215;01      <br />kfbh.hard:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 130 ; 0&#215;001: 0&#215;82</p>
</blockquote>
<p><strong>3) kfdhdb.grptyp：</strong>    <br />&#160;&#160;&#160;&#160;&#160;&#160; 通过PST可以获得diskgroup的冗余模式。PST位于asm disk的 AU1 Block 0上，可以通过扫描获得，其类型为KFBTYP_PST_META。</p>
<blockquote><p>[oracle@node1 ~]$ kfed read /dev/raw/raw1 aunum=1 blknum=0|grep copyCnt     <br />kfdpHdrB.copyCnt:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1 ; 0&#215;010: 0&#215;01</p>
</blockquote>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 如果copyCnt的数值为1，则为extenal类型，如果copyCnt为2，为normal类型。   <br /><strong>4) fdhdb.fstlocn</strong>    <br />&#160;&#160;&#160;&#160;&#160;&#160; 查找类型为KFBTYP_FREESPC的block    <br /><strong>5)kfdhdb.altlocn</strong>    <br />&#160;&#160;&#160;&#160;&#160;&#160; 查找类型为KFBTYP_ALLOCTBL的block    <br />&#160;&#160;&#160;&#160;&#160;&#160; 通常fstlocn为AU0/block 1 ;altlocn为AU0/block 2</p>
<blockquote><p>[oracle@node1 kfed]$ ./echo_asm_info.sh &#8211;scan 5 2 /dev/raw/raw1 KFBTYP_FREESPC     <br />&#8212;&#8212;&#8212;aunum=0 blknum=1 &#8212;&#8212;&#8212;&#8212;- <span style="color: #ff0000">位于AU0 block 1</span>      <br />kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2 ; 0&#215;002: KFBTYP_FREESPC</p>
</blockquote>
<blockquote><p>[oracle@node1 kfed]$ ./echo_asm_info.sh –scan 5 2 /dev/raw/raw1 KFBTYP_ALLOCTBL     <br />&#8212;&#8212;&#8212;aunum=0 blknum=2 &#8212;&#8212;&#8212;&#8212;-<span style="color: #ff0000">位于AU0 block 2</span>      <br />kfbh.type:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3 ; 0&#215;002: KFBTYP_ALLOCTBL</p>
</blockquote>
<p><strong>6)kfdhdb.dsksize</strong>    <br />&#160;&#160;&#160;&#160;&#160;&#160; 上面提过，该数值可以通过disk directory中的记录获得。另外，还可以通过查找类型为KFBTYP_FREESPC的block中相关记录计算得出。</p>
<p><strong>7) kfdhdb.f1b1locn:</strong>    <br />&#160;&#160;&#160;&#160;&#160;&#160; 查找kfffde[0].xptr.au的AU地址，即为f1b1locn的值，如不存在，取值为0.</p>
<blockquote><p>[oracle@node1 kfed]$ ./echo_asm_info.sh &#8211;scan 5 2 /dev/raw/raw1 kfffde[0].xptr.au</p>
<p>&#8212;&#8212;&#8212;aunum=2 blknum=1 &#8212;&#8212;&#8212;&#8212;-</p>
</blockquote>
<p><strong>8)kfdhdb.grpstmp/kfdhdb.mntstmp：</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; kfdhdb.grpstmp/kfdhdb.mntstmp非确定值,可以自指定。同groupdisk内各asm disk上kfdhdb.crestmp取值需要对应一致；在时间序列上，kfdhdb.grpstmp要早于kfdhdb.crestmp，而kfdhdb.mntstmp要晚于kfdhdb.crestmp。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 这样用于重构ASM disk header的信息已经全部获取到，利用kfed merge功能，便可将头部损坏的asm disk修复并成功mount起来。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; 接下来给出一个完全重构ASM disk header的案例&#8212;<a href="http://www.easyora.net/blog/manual_fix_asm_disk_header2.html">完全手工重构ASM Disk Header &lt;二&gt;</a></p>
<ul class="related_post">
<li><a href="http://www.easyora.net/blog/manual_fix_asm_disk_header2.html" title="完全手工重构ASM Disk Header &lt;二&gt;">完全手工重构ASM Disk Header &lt;二&gt;</a></li>
<li><a href="http://www.easyora.net/blog/asm_migrate.html" title=" ASM下的存储更换迁移方案"> ASM下的存储更换迁移方案</a></li>
<li><a href="http://www.easyora.net/blog/oracle_read_write_separated_architecture.html" title="Oracle读写分离架构">Oracle读写分离架构</a></li>
<li><a href="http://www.easyora.net/blog/manual_create_sql_profile_lock_sqlplan.html" title="Undocumented Way&#8211;通过手工创建sql profiles固定执行计划进行SQL调优">Undocumented Way&#8211;通过手工创建sql profiles固定执行计划进行SQL调优</a></li>
<li><a href="http://www.easyora.net/blog/dataguard_log_gap_mechanism.html" title="Dataguard的两种Log Gap检测和处理机制">Dataguard的两种Log Gap检测和处理机制</a></li>
<li><a href="http://www.easyora.net/blog/monitor_dg_sync_script.html" title="Physical Dataguard同步状态Shell巡检监控一则">Physical Dataguard同步状态Shell巡检监控一则</a></li>
</ul>
 <p><a href="http://fairyfish.net/bookmark/?url=http://www.easyora.net/blog/manual_fix_asm_disk_header1.html&title=%E5%AE%8C%E5%85%A8%E6%89%8B%E5%B7%A5%E9%87%8D%E6%9E%84ASM+Disk+Header+%26lt%3B%E4%B8%80%26gt%3B&tags=asm, asm disk header, kfed, oracle, 重构, "><img src="/bookmark.gif" alt="bookmark" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.easyora.net/blog/manual_fix_asm_disk_header1.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

