<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Oracle@Innotiive Asia</title>
	<atom:link href="http://oracleinnotiive.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://oracleinnotiive.wordpress.com</link>
	<description>We exist to do great things with freedom, responsibility and integrity</description>
	<lastBuildDate>Wed, 07 Dec 2011 10:26:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='oracleinnotiive.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Oracle@Innotiive Asia</title>
		<link>http://oracleinnotiive.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://oracleinnotiive.wordpress.com/osd.xml" title="Oracle@Innotiive Asia" />
	<atom:link rel='hub' href='http://oracleinnotiive.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Virtual indexes</title>
		<link>http://oracleinnotiive.wordpress.com/2011/12/07/virtual-indexes/</link>
		<comments>http://oracleinnotiive.wordpress.com/2011/12/07/virtual-indexes/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 10:26:45 +0000</pubDate>
		<dc:creator>oracleinnotiive</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=207</guid>
		<description><![CDATA[To tune SQL statements, sometimes you need to create different indexes to test which is the  correct  one that gives &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2011/12/07/virtual-indexes/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=207&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To tune SQL statements, sometimes you need to create different indexes to test which is the  correct  one that gives you the best result. Creating and dropping indexes on large tables  will be very time consuming and will take up disk space especially on a production environment.</p>
<p>Oracle has a feature called<strong> virtual index</strong> that doesn&#8217;t take up space or time when creating. It is mostly used by developers or tuning experts when tuning  sql statements. This virtual index simulates a convential index whitout taking up space. it updates certain data dictionary where it is able to use by the cost based optimizer.<br />
This feature is very useful when using explain plan and you can set it at session level so it doesn&#8217;t effect other sessions<br />
For this feature to work  you must be using the <strong> cost based optimizer</strong> and <strong>an undocumented parameter has to be enabled</strong></p>
<p>This feature need to be created with the <strong>nosegment</strong> clause<br />
The example below was tested in a 11gR2 environment.<br />
SQL*Plus: Release 11.2.0.2.0 Production on Wed Dec 7 17:41:17 2011<br />
Copyright (c) 1982, 2010, Oracle.  All rights reserved.<br />
Connected to:<br />
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 &#8211; 64bit Production<br />
With the Partitioning, OLAP, Data Mining and Real Application Testing options<br />
SQL&gt; ALTER SESSION SET &#8220;_use_nosegment_indexes&#8221; = TRUE;<br />
Session altered.<br />
SQL&gt; create table inno (a number, b number);<br />
Table created.<br />
SQL&gt; create index v_ind on inno(a) nosegment;<br />
Index created.</p>
<p>This virtual index doesn&#8217;t show up in dba_indexes but it does in dba_objects and dba_ind_columns<br />
SQL&gt; select index_name, owner from dba_indexes where index_name =&#8217;V_IND&#8217; and owner=&#8217;SYS&#8217;;<br />
no rows selected<br />
SQL&gt; select index_owner,index_name,column_name,table_name from dba_ind_columns<br />
where index_owner=&#8217;SYS&#8217; and index_name=&#8217;V_IND&#8217;;</p>
<p>INDEX_OWNER                    INDEX_NAME<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
COLUMN_NAME<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 />
TABLE_NAME<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
SYS                            V_IND<br />
A<br />
INNO</p>
<p>Statistics can be collected for a virtual index.<br />
SQL&gt; EXEC DBMS_STATS.gather_index_stats(USER, &#8216;v_ind&#8217;);<br />
PL/SQL procedure successfully completed.</p>
<p>We cannot create another virtual index on the same column list but we can create a real one<br />
SQL&gt; create index v_ind2 on inno(a) nosegment;<br />
create index v_ind2 on inno(a) nosegment<br />
*<br />
ERROR at line 1:<br />
ORA-01408: such column list already indexed<br />
After doing you testing, please make sure to drop the index.<br />
SQL&gt; drop index v_ind;<br />
Index dropped.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=207&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2011/12/07/virtual-indexes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8c00e81ceae6be8d9be49cb966b58ec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oracleinnotiive</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle Invisible Indexes in brief</title>
		<link>http://oracleinnotiive.wordpress.com/2011/05/11/oracle-invisible-indexes-in-brief/</link>
		<comments>http://oracleinnotiive.wordpress.com/2011/05/11/oracle-invisible-indexes-in-brief/#comments</comments>
		<pubDate>Wed, 11 May 2011 01:56:02 +0000</pubDate>
		<dc:creator>oracleinnotiive</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle 11g]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=202</guid>
		<description><![CDATA[Invisible Indexes Invisible index was introduced in Oracle 11g. An invisible index is an index maintained by the database but &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2011/05/11/oracle-invisible-indexes-in-brief/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=202&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration:underline;">Invisible Indexes</span></strong></p>
<ul>
<li>
Invisible index was introduced<br />
in Oracle 11g. An invisible index is an index maintained by the database but ignored<br />
by the optimizer unless it is explicitly specified by issuing ALTER SYSTEM SET<br />
OPTIMIZER_USE_INVISIBLE_INDEXES to TRUE statement. It is<br />
an alternative way to dropping or making the index unusable.</li>
<li>
This feature is very useful<br />
when a DBA needs to remove an index to monitor on how the index impacts on the<br />
database. Also can be used to create temporary index structures for certain<br />
operations or modules of an application without affecting the overall<br />
application.</li>
</ul>
<p><strong><span style="text-decoration:underline;">Creating an Invisible Index</span></strong></p>
<ul>
<li>
To create and invisible index,<br />
use the CREATE INDEX statement with INVISIBLE clause. The SQL statement below creates an invisible index named test_index for testcolumn of the test_table.<strong></strong></li>
</ul>
<p>CREATE INDEX test_index on<br />
test_table(testcolumn)</p>
<p>TABLESPACES users INVISIBLE;</p>
<p><strong><span style="text-decoration:underline;">Altering an<br />
existing index to be invisible or visible</span></strong></p>
<ul>
<li>
To make a visible index INVISIBLE, the following statement is issued<strong></strong></li>
</ul>
<p>ALTER INDEX <em>indexname </em>INVISIBLE;</p>
<ul>
<li>
To make an invisible index VISIBLE,<br />
the following statement is issued<strong></strong></li>
</ul>
<p>ALTER INDEX <em>indexname </em>VISIBLE;</p>
<ul>
<li>
To find out whether or not a particular index is INVISIBLE or VISIBLE the following statement issued by<br />
querying DBA_INDEXES, ALL_INDEXES and USER_INDEXES dictionary views.</li>
</ul>
<p>SELECT INDEX_NAME, VISIBILITY FROM<br />
USER_INDEXES</p>
<p>WHERE INDEX_NAME=’<em>indexname</em>’;</p>
<p>INDEX_NAME      VISIBILITY</p>
<p>&#8212;&#8212;&#8212;-      &#8212;&#8212;&#8212;-</p>
<p><em>indexname       </em>VISIBLE</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/202/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=202&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2011/05/11/oracle-invisible-indexes-in-brief/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8c00e81ceae6be8d9be49cb966b58ec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oracleinnotiive</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle Cursor Sharing</title>
		<link>http://oracleinnotiive.wordpress.com/2011/05/05/oracle-cursor-sharing-2/</link>
		<comments>http://oracleinnotiive.wordpress.com/2011/05/05/oracle-cursor-sharing-2/#comments</comments>
		<pubDate>Thu, 05 May 2011 07:32:47 +0000</pubDate>
		<dc:creator>ilanggoh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=199</guid>
		<description><![CDATA[CURSOR_SHARING is an init.ora parameter which decides whether a SQL statement issued by a user is parsed freshly or will &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2011/05/05/oracle-cursor-sharing-2/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=199&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>CURSOR_SHARING is an init.ora parameter which decides whether a SQL statement issued by a user is parsed freshly or will use an existing plan. This parameter has 3 values:</p>
<p><strong>1.       </strong><strong>EXACT </strong></p>
<p>This is the default value. This value share the plan only if text of SQL matches exactly with the text of SQL which is in shared pool.  For example:</p>
<p><em>SQL&gt; conn ilan/ilan</em></p>
<p><em>Connected.</em></p>
<p><em>SQL&gt; select * from test where id=1;</em></p>
<p><em>         ID</em></p>
<p><em>&#8212;&#8212;&#8212;-</em></p>
<p><em>         1</em></p>
<p><em> SQL&gt; select * from test where id=2;</em></p>
<p><em>         ID</em></p>
<p><em>&#8212;&#8212;&#8212;-</em></p>
<p><em>         2</em></p>
<p><em>SQL&gt; select sql_text</em></p>
<p><em>from v$sql</em></p>
<p><em>where sql_text like &#8216;select * from test%&#8217;</em></p>
<p><em>order by sql_text;  2    3    4</em></p>
<p><em> </em></p>
<p><em>SQL_TEXT</em></p>
<p><em>&#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;</em></p>
<p><em>select * from test where id=1</em></p>
<p><em>select * from test where id=2</em></p>
<p>As you can see from v$sql view, oracle need to generate 2 different plans as the SQL statements are not the same.</p>
<p><strong>2.       </strong><strong>FORCE</strong></p>
<p>When cursor_sharing set to force, this will force the same SQL statements to be reused provided the text is similar except the literal values. For example:</p>
<p><em>SQL&gt; alter system set cursor_sharing=force;</em></p>
<p><em> System altered.</em></p>
<p><em> SQL&gt; show parameter cursor</em></p>
<p><em> NAME                                 TYPE        VALUE</em></p>
<p><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</em></p>
<p><em>cursor_sharing                       string      FORCE</em></p>
<p><em>cursor_space_for_time                boolean     FALSE</em></p>
<p><em>open_cursors                         integer     300</em></p>
<p><em>session_cached_cursors               integer     20</em></p>
<p><em> </em></p>
<p><em>SQL&gt; alter system flush shared_pool;</em></p>
<p><em> System altered.</em></p>
<p><em> </em></p>
<p><em>SQL&gt; conn ilan/ilan</em></p>
<p><em>Connected.</em></p>
<p><em>SQL&gt; select * from test where id=1;</em></p>
<p><em>         ID</em></p>
<p><em>&#8212;&#8212;&#8212;-</em></p>
<p><em>         1</em></p>
<p><em> </em></p>
<p><em>SQL&gt; select * from test where id=2;</em></p>
<p><em>         ID</em></p>
<p><em>&#8212;&#8212;&#8212;-</em></p>
<p><em>         2</em></p>
<p><em> </em></p>
<p><em>SQL&gt; select sql_text</em></p>
<p><em>from v$sql</em></p>
<p><em>where sql_text like &#8216;select * from test%&#8217;</em></p>
<p><em>order by sql_text;  2    3    4</em></p>
<p><em>SQL_TEXT</em></p>
<p><em>&#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;</em></p>
<p><em>select * from test where id=:&#8221;SYS_B_0&#8243;</em></p>
<p>As you can see, oracles still reparse the same SQL statement for the second execution. This is done by replacing the literal value with system generated bind variable (SYS_B_0). Even if we run the same statement again, oracle will use the same plan by just replacing the bind variable with the value specified in the ‘where clause’.</p>
<p>This option seems good but there is a drawback.  Using the same plan for both the statement might not good for 1 of them.  For example:</p>
<p><em>SQL&gt; select count(*),id from test group by id;</em></p>
<p><em>  COUNT(*)         ID</em></p>
<p><em>&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-</em></p>
<p><em>         9          1</em></p>
<p><em>         1          2</em></p>
<p>‘test’ table consist of 10 rows with value ‘1’ the most. If the column ID is indexed and the below statement issued, oracle will use index which is a good execution plan:</p>
<p><em>SQL&gt;  select * from test where id=2;</em></p>
<p><em>Execution Plan</em></p>
<p><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</em></p>
<p><em>Plan hash value: 578627003</em></p>
<p><em>&#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;</em></p>
<p><em>| Id  | Operation        | Name   | Rows  | Bytes | Cost (%CPU)| Time     |</em></p>
<p><em>&#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;</em></p>
<p><em>|   0 | SELECT STATEMENT |        |     1 |    13 |     1   (0)| 00:00:01 |</em></p>
<p><em>|*  1 |  INDEX RANGE SCAN| IDX_ID |     1 |    13 |     1   (0)| 00:00:01 |</em></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;</p>
<p>The same plan will be reused for the below statement as well when we set cursor_sharing =force:</p>
<p><em>SQL&gt; select * from test where id=1;</em></p>
<p><em>Execution Plan</em></p>
<p><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</em></p>
<p><em>Plan hash value: 578627003</em></p>
<p><em>&#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;</em></p>
<p><em>| Id  | Operation        | Name   | Rows  | Bytes | Cost (%CPU)| Time     |</em></p>
<p><em>&#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;</em></p>
<p><em>|   0 | SELECT STATEMENT |        |     9 |   117 |     1   (0)| 00:00:01 |</em></p>
<p><em>|*  1 |  INDEX RANGE SCAN| IDX_ID |     9 |   117 |     1   (0)| 00:00:01 |</em></p>
<p><em>&#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;</em></p>
<p>Index scan is not appropriate for this statement as 90% of data in table ‘test’ is with value ‘2’. So, setting cursor sharing to force is not always an appropriate solution when there a number of similar SQL statements.</p>
<p><strong>3.       </strong><strong>SIMILAR</strong></p>
<p>This option is introduced to overcome the force option issue. ‘SIMILAR’ option works the same way like force where it reuses the SQL statements with same text except the literal value. But, when histogram present on a particular column (like on ID column in the example earlier), another plan will be created. For example:</p>
<p><em>SQL&gt; alter system set cursor_sharing=similar;</em></p>
<p><em>System altered.</em></p>
<p><em>SQL&gt; show parameter cursor</em></p>
<p><em>NAME                                 TYPE        VALUE</em></p>
<p><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</em></p>
<p><em>cursor_sharing                       string      SIMILAR</em></p>
<p><em>cursor_space_for_time                boolean     FALSE</em></p>
<p><em>open_cursors                         integer     300</em></p>
<p><em>session_cached_cursors               integer     20</em></p>
<p><em>SQL&gt; conn ilan/ilan</em></p>
<p><em>Connected.</em></p>
<p><em>SQL&gt; select * from test where id=1;</em></p>
<p><em>        ID</em></p>
<p><em>&#8212;&#8212;&#8212;-</em></p>
<p><em>         1</em></p>
<p><em><br />
</em></p>
<p><em>SQL&gt; select * from test where id=2;</em></p>
<p><em>        ID</em></p>
<p><em>&#8212;&#8212;&#8212;-</em></p>
<p><em>         2</em></p>
<p><em>SQL&gt; select sql_text</em></p>
<p><em>from v$sql</em></p>
<p><em>where sql_text like &#8216;select * from test%&#8217;</em></p>
<p><em>order by sql_text;  2    3    4</em></p>
<p><em> </em></p>
<p><em>SQL_TEXT</em></p>
<p><em>&#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;</em></p>
<p><em>select * from test where id=:&#8221;SYS_B_0&#8243;</em></p>
<p><em>select * from test where id=:&#8221;SYS_B_0&#8243;</em></p>
<p>As we can see above, though same SQL statement present, oracle will create another ‘child’ cursor to provide the best execution plan based on the histogram.</p>
<p><strong>Conclusion  </strong></p>
<p><strong> </strong></p>
<ol>
<li>Cursor sharing=similar is used when there is high number library cache misses provided most of the SQL statements are differ in literal values</li>
<li>cursor sharing=force/similar will reduces the number of plans in shared pool</li>
<li>if both the above requirements are not important in your database environment, it is always better to leave cursor sharing setting to default value (EXACT)</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/199/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=199&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2011/05/05/oracle-cursor-sharing-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff9b4a989dbaeac652e1f6f3bb6558df?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilanggoh</media:title>
		</media:content>
	</item>
		<item>
		<title>Runstats: SQL execution statistics comparison tool</title>
		<link>http://oracleinnotiive.wordpress.com/2011/04/27/runstats-sql-execution-statistics-comparison-tool/</link>
		<comments>http://oracleinnotiive.wordpress.com/2011/04/27/runstats-sql-execution-statistics-comparison-tool/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 01:00:16 +0000</pubDate>
		<dc:creator>niradj</dc:creator>
				<category><![CDATA[Execution statistics]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Oracle 10g]]></category>
		<category><![CDATA[Oracle 11g]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=178</guid>
		<description><![CDATA[Sometimes when tuning/improving the performance of  a SQL statement, it can be useful to immediately ascertain the difference in run-time &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2011/04/27/runstats-sql-execution-statistics-comparison-tool/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=178&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Calibri;font-size:small;">Sometimes when tuning/improving the performance of  a SQL statement, it can be useful to immediately ascertain the difference in run-time statistics (resource usage, latch contention, etc), especially on development environments before rolling out the SQL into production.</span></p>
<p><span style="font-family:Calibri;font-size:small;">While Oracle supplies us with many tracing tools and techniques to achieve this goal, sometimes a simple script with immediate output is preferable. It is this goal that is addressed by the runstats script (a collection of objects and packages designed to present run-time statistics for SQL executions, and provide comparisons between 2 separate runs), designed by the venerable <a title="Ask Tom" href="http://asktom.oracle.com/pls/apex/f?p=100:1:0" target="_blank">Tom Kyte</a>, one of the most respected voices in the Oracle community.</span></p>
<p><span style="font-family:Calibri;font-size:small;">The script (listing provided below), is run by first creating the necessary objects in a user schema (the runstats account), as well as a SYSDBA schema (the SYS account) to create the necessary objects and grant the required privileges.</span></p>
<p><span style="font-family:Calibri;font-size:small;">Once this is done, we can test it out as shown below:</span></p>
<p><span style="font-family:Calibri;font-size:small;">i.</span>          <span style="font-family:Calibri;font-size:small;">Connect as the runstats user schema (in this case, NIRADJ) and run the runstats.sql script</span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; @runstats;</span></p>
<p><span style="font-family:Calibri;font-size:small;">Table created.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">View created.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">Package created.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">Package body created.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">ii.</span>          <span style="font-family:Calibri;font-size:small;">Create a test table (from the DBA_USERS view)</span></p>
<p>SQL&gt; create table teststat as select * from dba_users;</p>
<p><span style="font-family:Calibri;font-size:small;">Table created.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">iii.</span>          <span style="font-family:Calibri;font-size:small;">Create an index on this table for the USER_ID column</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; create index teststat_idx1 on teststat (user_id);</span></p>
<p><span style="font-family:Calibri;font-size:small;">Index created.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">iv.</span>          <span style="font-family:Calibri;font-size:small;">Start the runstats statistics collection (1st run)</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; set serveroutput on</span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; exec runstats_pkg.RS_START;</span></p>
<p><span style="font-family:Calibri;font-size:small;">PL/SQL procedure successfully completed.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">v.</span>          <span style="font-family:Calibri;font-size:small;">Run a simple SQL statement,</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; select min(user_id) from teststat;</span></p>
<p><span style="font-family:Calibri;font-size:small;">MIN(USER_ID)</span></p>
<p><span style="font-family:Calibri;font-size:small;">&#8212;&#8212;&#8212;&#8212;</span></p>
<p><span style="font-size:small;"><span style="font-family:Calibri;">           0</span></span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">vi.</span>          <span style="font-family:Calibri;font-size:small;">Start the runstats statistics collection for the second SQL statement (2nd run)</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; set serveroutput on</span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; exec runstats_pkg.RS_MIDDLE;</span></p>
<p><span style="font-family:Calibri;font-size:small;">PL/SQL procedure successfully completed.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">vii.</span>          <span style="font-family:Calibri;font-size:small;">Run a similar statement, but with added +FULL (force full table scan) hint</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; select /*+ FULL(teststat) */  min(user_id) from teststat;</span></p>
<p><span style="font-family:Calibri;font-size:small;">MIN(USER_ID)</span></p>
<p><span style="font-family:Calibri;font-size:small;">&#8212;&#8212;&#8212;&#8212;</span></p>
<p><span style="font-size:small;"><span style="font-family:Calibri;">           0</span></span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">viii.</span>          <span style="font-family:Calibri;font-size:small;">Stop the collection and view the runstats output, with only the results matching the minimum requirement (difference value) shown:</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">SQL&gt; exec runstats_pkg.RS_STOP(100);</span></p>
<p><span style="font-family:Calibri;font-size:small;">Run1 ran in 911 hsecs</span></p>
<p><span style="font-family:Calibri;font-size:small;">Run2 ran in 1020 hsecs</span></p>
<p><span style="font-family:Calibri;font-size:small;">run 1 ran in 89.31% of the time</span></p>
<p><span style="font-family:Calibri;font-size:small;">Name                                  Run1        Run2        Diff</span></p>
<p><span style="font-family:Calibri;font-size:small;">STAT&#8230;Elapsed Time                    912       1,022         110</span></p>
<p><span style="font-family:Calibri;font-size:small;">STAT&#8230;undo change vector size       2,272       2,404         132</span></p>
<p><span style="font-family:Calibri;font-size:small;">STAT&#8230;redo size                     3,052       3,312         260</span></p>
<p><span style="font-family:Calibri;font-size:small;">STAT&#8230;session pga memory                0     196,608     196,608</span></p>
<p><span style="font-family:Calibri;font-size:small;">Run1 latches total versus runs &#8212; difference and pct</span></p>
<p><span style="font-family:Calibri;font-size:small;">Run1        Run2        Diff       Pct</span></p>
<p><span style="font-family:Calibri;font-size:small;">1,357       1,718         361     78.99%</span></p>
<p><span style="font-family:Calibri;font-size:small;">PL/SQL procedure successfully completed.</span></p>
<p><span style="font-family:Calibri;font-size:small;"> </span></p>
<p><span style="font-family:Calibri;font-size:small;">So here we can easily compare the difference in execution statistics between the 2 similar SQL statements.</span></p>
<p><em><span style="font-size:small;"><span style="font-family:Calibri;">Runstats code listing:</span></span></em></p>
<p><span style="font-family:Calibri;">create global temporary table run_stats</span></p>
<p><span style="font-family:Calibri;">( runid varchar2(15),</span></p>
<p><span style="font-family:Calibri;">  name varchar2(80),</span></p>
<p><span style="font-family:Calibri;">  value int )</span></p>
<p><span style="font-family:Calibri;">on commit preserve rows;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">create or replace view stats</span></p>
<p><span style="font-family:Calibri;">as select &#8216;STAT&#8230;&#8217; || a.name name, b.value</span></p>
<p><span style="font-family:Calibri;">      from v$statname a, v$mystat b</span></p>
<p><span style="font-family:Calibri;">     where a.statistic# = b.statistic#</span></p>
<p><span style="font-family:Calibri;">    union all</span></p>
<p><span style="font-family:Calibri;">    select &#8216;LATCH.&#8217; || name,  gets</span></p>
<p><span style="font-family:Calibri;">      from v$latch</span></p>
<p><span style="font-family:Calibri;">                    union all</span></p>
<p><span style="font-family:Calibri;">                    select &#8216;STAT&#8230;Elapsed Time&#8217;, hsecs from v$timer;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">create or replace package runstats_pkg</span></p>
<p><span style="font-family:Calibri;">as</span></p>
<p><span style="font-family:Calibri;">    procedure rs_start;</span></p>
<p><span style="font-family:Calibri;">    procedure rs_middle;</span></p>
<p><span style="font-family:Calibri;">    procedure rs_stop( p_difference_threshold in number default 0 );</span></p>
<p><span style="font-family:Calibri;">end;</span></p>
<p><span style="font-family:Calibri;">/</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">create or replace package body runstats_pkg</span></p>
<p><span style="font-family:Calibri;">as</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">g_start number;</span></p>
<p><span style="font-family:Calibri;">g_run1  number;</span></p>
<p><span style="font-family:Calibri;">g_run2  number;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">procedure rs_start</span></p>
<p><span style="font-family:Calibri;">is </span></p>
<p><span style="font-family:Calibri;">begin</span></p>
<p><span style="font-family:Calibri;">    delete from run_stats;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    insert into run_stats </span></p>
<p><span style="font-family:Calibri;">    select &#8216;before&#8217;, stats.* from stats;</span></p>
<p><span style="font-family:Calibri;">        </span></p>
<p><span style="font-family:Calibri;">    g_start := dbms_utility.get_time;</span></p>
<p><span style="font-family:Calibri;">end;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">procedure rs_middle</span></p>
<p><span style="font-family:Calibri;">is</span></p>
<p><span style="font-family:Calibri;">begin</span></p>
<p><span style="font-family:Calibri;">    g_run1 := (dbms_utility.get_time-g_start);</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    insert into run_stats </span></p>
<p><span style="font-family:Calibri;">    select &#8216;after 1&#8242;, stats.* from stats;</span></p>
<p><span style="font-family:Calibri;">    g_start := dbms_utility.get_time;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">end;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">procedure rs_stop(p_difference_threshold in number default 0)</span></p>
<p><span style="font-family:Calibri;">is</span></p>
<p><span style="font-family:Calibri;">begin</span></p>
<p><span style="font-family:Calibri;">    g_run2 := (dbms_utility.get_time-g_start);</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line</span></p>
<p><span style="font-family:Calibri;">    ( &#8216;Run1 ran in &#8216; || g_run1 || &#8216; hsecs&#8217; );</span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line</span></p>
<p><span style="font-family:Calibri;">    ( &#8216;Run2 ran in &#8216; || g_run2 || &#8216; hsecs&#8217; );</span></p>
<p><span style="font-family:Calibri;">                    if ( g_run2 &lt;&gt; 0 )</span></p>
<p><span style="font-family:Calibri;">                    then</span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line</span></p>
<p><span style="font-family:Calibri;">    ( &#8216;run 1 ran in &#8216; || round(g_run1/g_run2*100,2) || </span></p>
<p><span style="font-family:Calibri;">      &#8216;% of the time&#8217; );</span></p>
<p><span style="font-family:Calibri;">                    end if;</span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line( chr(9) );</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    insert into run_stats </span></p>
<p><span style="font-family:Calibri;">    select &#8216;after 2&#8242;, stats.* from stats;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line</span></p>
<p><span style="font-family:Calibri;">    ( rpad( &#8216;Name&#8217;, 30 ) || lpad( &#8216;Run1&#8242;, 12 ) || </span></p>
<p><span style="font-family:Calibri;">      lpad( &#8216;Run2&#8242;, 12 ) || lpad( &#8216;Diff&#8217;, 12 ) );</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    for x in </span></p>
<p><span style="font-family:Calibri;">    ( select rpad( a.name, 30 ) || </span></p>
<p><span style="font-family:Calibri;">             to_char( b.value-a.value, &#8217;999,999,999&#8242; ) || </span></p>
<p><span style="font-family:Calibri;">             to_char( c.value-b.value, &#8217;999,999,999&#8242; ) || </span></p>
<p><span style="font-family:Calibri;">             to_char( ( (c.value-b.value)-(b.value-a.value)), &#8217;999,999,999&#8242; ) data</span></p>
<p><span style="font-family:Calibri;">        from run_stats a, run_stats b, run_stats c</span></p>
<p><span style="font-family:Calibri;">       where a.name = b.name</span></p>
<p><span style="font-family:Calibri;">         and b.name = c.name</span></p>
<p><span style="font-family:Calibri;">         and a.runid = &#8216;before&#8217;</span></p>
<p><span style="font-family:Calibri;">         and b.runid = &#8216;after 1&#8242;</span></p>
<p><span style="font-family:Calibri;">         and c.runid = &#8216;after 2&#8242;</span></p>
<p><span style="font-family:Calibri;">         &#8212; and (c.value-a.value) &gt; 0</span></p>
<p><span style="font-family:Calibri;">         and abs( (c.value-b.value) &#8211; (b.value-a.value) ) </span></p>
<p><span style="font-family:Calibri;">               &gt; p_difference_threshold</span></p>
<p><span style="font-family:Calibri;">       order by abs( (c.value-b.value)-(b.value-a.value))</span></p>
<p><span style="font-family:Calibri;">    ) loop</span></p>
<p><span style="font-family:Calibri;">        dbms_output.put_line( x.data );</span></p>
<p><span style="font-family:Calibri;">    end loop;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line( chr(9) );</span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line</span></p>
<p><span style="font-family:Calibri;">    ( &#8216;Run1 latches total versus runs &#8212; difference and pct&#8217; );</span></p>
<p><span style="font-family:Calibri;">    dbms_output.put_line</span></p>
<p><span style="font-family:Calibri;">    ( lpad( &#8216;Run1&#8242;, 12 ) || lpad( &#8216;Run2&#8242;, 12 ) || </span></p>
<p><span style="font-family:Calibri;">      lpad( &#8216;Diff&#8217;, 12 ) || lpad( &#8216;Pct&#8217;, 10 ) );</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">    for x in </span></p>
<p><span style="font-family:Calibri;">    ( select to_char( run1, &#8217;999,999,999&#8242; ) ||</span></p>
<p><span style="font-family:Calibri;">             to_char( run2, &#8217;999,999,999&#8242; ) ||</span></p>
<p><span style="font-family:Calibri;">             to_char( diff, &#8217;999,999,999&#8242; ) ||</span></p>
<p><span style="font-family:Calibri;">             to_char( round( run1/decode( run2, 0, to_number(0), run2) *100,2 ), &#8217;99,999.99&#8242; ) || &#8216;%&#8217; data</span></p>
<p><span style="font-family:Calibri;">        from ( select sum(b.value-a.value) run1, sum(c.value-b.value) run2,</span></p>
<p><span style="font-family:Calibri;">                      sum( (c.value-b.value)-(b.value-a.value)) diff</span></p>
<p><span style="font-family:Calibri;">                 from run_stats a, run_stats b, run_stats c</span></p>
<p><span style="font-family:Calibri;">                where a.name = b.name</span></p>
<p><span style="font-family:Calibri;">                  and b.name = c.name</span></p>
<p><span style="font-family:Calibri;">                  and a.runid = &#8216;before&#8217;</span></p>
<p><span style="font-family:Calibri;">                  and b.runid = &#8216;after 1&#8242;</span></p>
<p><span style="font-family:Calibri;">                  and c.runid = &#8216;after 2&#8242;</span></p>
<p><span style="font-family:Calibri;">                  and a.name like &#8216;LATCH%&#8217;</span></p>
<p><span style="font-family:Calibri;">                )</span></p>
<p><span style="font-family:Calibri;">    ) loop</span></p>
<p><span style="font-family:Calibri;">        dbms_output.put_line( x.data );</span></p>
<p><span style="font-family:Calibri;">    end loop;</span></p>
<p><span style="font-family:Calibri;">end;</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">end;</span></p>
<p><span style="font-family:Calibri;">/</span></p>
<p><span style="font-family:Calibri;"> </span></p>
<p><span style="font-family:Calibri;">/*</span></p>
<p><span style="font-family:Calibri;">exec runStats_pkg.rs_start;</span></p>
<p><span style="font-family:Calibri;">exec runStats_pkg.rs_middle;</span></p>
<p><span style="font-family:Calibri;">exec runStats_pkg.rs_stop;<br />
*/</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=178&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2011/04/27/runstats-sql-execution-statistics-comparison-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/feab28045f7340df821f3da534760a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">niradj</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating an Oracle Database 10g Dataguard Fast Start Failover Configuration</title>
		<link>http://oracleinnotiive.wordpress.com/2010/10/08/creating-an-oracle-database-10g-dataguard-fast-start-failover-configuration/</link>
		<comments>http://oracleinnotiive.wordpress.com/2010/10/08/creating-an-oracle-database-10g-dataguard-fast-start-failover-configuration/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 00:37:41 +0000</pubDate>
		<dc:creator>niradj</dc:creator>
				<category><![CDATA[Dataguard]]></category>
		<category><![CDATA[Oracle 10g]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=168</guid>
		<description><![CDATA[With Oracle database 10g Release 2, there is a feature called Fast Start Failover (FSFO), that can be configured to &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2010/10/08/creating-an-oracle-database-10g-dataguard-fast-start-failover-configuration/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=168&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>With Oracle database 10g Release 2, there is a feature called Fast Start Failover (FSFO), that can be configured to enable the production Dataguard configuration to automatically trigger a role change (switchover or failover) to an appropriate standby database in the event of any outages to production.</p>
<p>To demonstrate this, I will setup a simple 10g Dataguard configuration using the Dataguard Broker client (DGMGRL), and then enable FSFO. Before proceeding further, a simple explanation of the components involved will be useful. The main components in a Dataguard Broker configuration are</p>
<p>       i.          Primary database</p>
<p>     ii.          Up to nine standby databases</p>
<p>    iii.          Dataguard broker client (DGMGRL)</p>
<p>    iv.          Associated background processes (DMON, INSV, etc)</p>
<p>In order to configure the Dataguard Broker, first we will need to have a standby database created, and start recovery. This can easily be done via RMAN (Recovery Manager), or even with a manual copy and transfer of database files to the standby server, setting the relevant initialization parameters, and running the relevant SQLplus commands (not listed here).</p>
<p>In my case, the working environment has been setup as per the configuration (named MSDPOB) below:</p>
<div>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td width="24%" valign="bottom"><strong>DB Unique Name / Role</strong></td>
<td width="20%" valign="bottom"><strong>Server Hostname</strong></td>
<td width="25%" valign="bottom"><strong>Server IP Address</strong></td>
<td width="14%" valign="top"><strong>Operating Sytem</strong></td>
<td width="14%" valign="top"><strong>Service Name</strong></td>
</tr>
<tr>
<td width="24%" valign="bottom">MSDP / Primary</td>
<td width="20%" valign="bottom">solaris1</td>
<td width="25%" valign="bottom">192.168.247.131</td>
<td width="14%" valign="top">Solaris 10</td>
<td width="14%" valign="top">MSDP</td>
</tr>
<tr>
<td width="24%" valign="bottom">MSDP_DG / Standby</td>
<td width="20%" valign="bottom">solaris2</td>
<td width="25%" valign="bottom">192.168.247.132</td>
<td width="14%" valign="top">Solaris 10</td>
<td width="14%" valign="top">MSDP_DG</td>
</tr>
</tbody>
</table>
</div>
<p> </p>
<p>The tasks that need to be completed can be divided into the following categories:</p>
<p>       i.          enable and start dataguard broker processes on both primary and standby databases</p>
<p>     ii.          create a dataguard configuration with Oracle Dataguard Broker</p>
<p>    iii.          enable Fast Start Failover for the configuration</p>
<p><strong> </strong></p>
<p><strong>I. Enable and start dataguard broker processes on both primary and standby databases</strong></p>
<p>We need to start the relevant background processes, and also set the location for the Dataguard broker configuration files (by default located in $ORACLE_HOME/dbs):</p>
<p><strong>SQL&gt; ALTER SYSTEM SET dg_broker_config_file1 = &#8216; /u01/app/oracle/product/10.2.0/ /db_1/dbs/dr1msdp_dg.dat&#8217; scope=both sid=&#8217;*';<br />
SQL&gt; ALTER SYSTEM SET dg_broker_config_file2 = &#8216; /u01/app/oracle/product/10.2.0/ /db_1/dbs/dr2msdp_dg.dat&#8217; scope=both sid=&#8217;*';</strong></p>
<p>Next, we will need to start the Dataguard broker process on both nodes by using the following command on the primary and standby databases:</p>
<p><strong>SQL&gt;ALTER SYSTEM SET DG_BROKER_START=TRUE;</strong> </p>
<p><strong>II. Create a dataguard configuration with Oracle Dataguard Broker</strong></p>
<p>First, we need to ensure that the databases have been manually registered with the listeners on both the primary and standby servers, and that a separate TNS names entry for the Dataguard broker has been created:</p>
<p>Sample TNSNAMES.ORA entries</p>
<p><strong>LISTENER_MSDPDG =                                                                   </strong></p>
<p><strong>  (DESCRIPTION_LIST =</strong></p>
<p><strong>    (DESCRIPTION =</strong></p>
<p><strong>      (ADDRESS = (PROTOCOL = TCP)(HOST = solaris2)(PORT = 1523))</strong></p>
<p><strong>    )</strong></p>
<p><strong>  )</strong></p>
<p><strong> </strong></p>
<p><strong>MSDP =</strong></p>
<p><strong>  (DESCRIPTION =</strong></p>
<p><strong>    (ADDRESS_LIST =</strong></p>
<p><strong>      (ADDRESS = (PROTOCOL = TCP)(HOST = solaris1)(PORT = 1523))</strong></p>
<p><strong>    )</strong></p>
<p><strong>    (CONNECT_DATA =</strong></p>
<p><strong>      (SERVER = DEDICATED)</strong></p>
<p><strong>      (SERVICE_NAME = msdp_DGMGRL)</strong></p>
<p><strong>    )</strong></p>
<p><strong>  )</strong></p>
<p><strong> </strong></p>
<p><strong>MSDP_DG =</strong></p>
<p><strong>  (DESCRIPTION =</strong></p>
<p><strong>    (ADDRESS_LIST =</strong></p>
<p><strong>      (ADDRESS = (PROTOCOL = TCP)(HOST = solaris2)(PORT = 1523))</strong></p>
<p><strong>    )</strong></p>
<p><strong>    (CONNECT_DATA =</strong></p>
<p><strong>      (SERVER = DEDICATED)</strong></p>
<p><strong>      (SERVICE_NAME = msdp_dg_DGMGRL)</strong></p>
<p><strong>    )</strong></p>
<p><strong>  )</strong></p>
<p><strong> </strong></p>
<p><strong>MSDP =</strong></p>
<p><strong>  (DESCRIPTION =</strong></p>
<p><strong>    (ADDRESS_LIST =</strong></p>
<p><strong>      (ADDRESS = (PROTOCOL = TCP)(HOST = solaris1)(PORT = 1523))</strong></p>
<p><strong>    )</strong></p>
<p><strong>    (CONNECT_DATA =</strong></p>
<p><strong>      (SERVER = DEDICATED)</strong></p>
<p><strong>      (SERVICE_NAME = msdp)</strong></p>
<p><strong>    )</strong></p>
<p><strong>  )</strong></p>
<p><strong> </strong></p>
<p><strong>MSDP_DG =</strong></p>
<p><strong>  (DESCRIPTION =</strong></p>
<p><strong>    (ADDRESS_LIST =</strong></p>
<p><strong>      (ADDRESS = (PROTOCOL = TCP)(HOST = solaris2)(PORT = 1523))</strong></p>
<p><strong>    )</strong></p>
<p><strong>    (CONNECT_DATA =</strong></p>
<p><strong>      (SERVER = DEDICATED)</strong></p>
<p><strong>      (SERVICE_NAME = msdp_dg)</strong></p>
<p><strong>    )</strong></p>
<p><strong>  )</strong></p>
<p>Note*: Please ensure that the service name entries have been configured correctly for each of the services.</p>
<p>Sample LISTENER.ORA entries:</p>
<p><strong>SID_LIST_LISTENER_MSDPDG =</strong></p>
<p><strong>  (SID_LIST =</strong></p>
<p><strong>    (SID_DESC =</strong></p>
<p><strong>      (SID_NAME = PLSExtProc)</strong></p>
<p><strong>      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)</strong></p>
<p><strong>      (PROGRAM = extproc)</strong></p>
<p><strong>    )</strong></p>
<p><strong>    (SID_DESC =</strong></p>
<p><strong>      (GLOBAL_DBNAME = msdp_dg_DGMGRL)</strong></p>
<p><strong>      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)</strong></p>
<p><strong>      (SID_NAME = msdp_dg)</strong><strong> </strong></p>
<p><strong>    )</strong></p>
<p><strong>  )</strong></p>
<p><strong> </strong></p>
<p><strong>LISTENER_MSDPDG =</strong></p>
<p><strong>  (DESCRIPTION_LIST =</strong></p>
<p><strong>    (DESCRIPTION =</strong></p>
<p><strong>      (ADDRESS = (PROTOCOL = TCP)(HOST = solaris2)(PORT = 1523))</strong></p>
<p><strong>    )</strong></p>
<p><strong>    (DESCRIPTION =</strong></p>
<p><strong>      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))</strong></p>
<p><strong>    )</strong></p>
<p><strong>  )</strong><strong><br />
</strong>Note*: Please ensure that database instance on each server have been listed in the listener.ora file to enable Dataguard broker to perform switchovers that involve shutdown.<strong> </strong></p>
<p>We also need to set the LOCAL_LISTENER parameter in both the primary and standby databases accordingly (as shown below):</p>
<p><strong>SQL&gt; show parameter local</strong></p>
<p><strong>NAME                   TYPE       VALUE</strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-   &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</strong></p>
<p><strong>local_listener     string      (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=solaris1)(PORT=1523)))</strong></p>
<p><strong><br />
SQL&gt; show parameter local</strong></p>
<p><strong>NAME                   TYPE       VALUE</strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-   &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</strong></p>
<p><strong>local_listener     string      (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=solaris2)(PORT=1523)))</strong></p>
<p>Connect to the DGMGRL client (from either the primary or standby servers) and create the Dataguard broker configuration:</p>
<p><strong>$ dgmgrl<br />
DGMGRL&gt; create configuration msdpconf as primary database is msdp connect identifier is mdsp;<br />
DGMGRL&gt; add database msdp_dg as connect identifier is msdp_dg maintained as physical;<br />
DGMGRL&gt; show configuration verbose;<br />
DGMGRL&gt; show configuration verbose;<br />
Configuration<br />
  Name:                msdpconf<br />
  Enabled:             NO<br />
  Protection Mode:     MaxPerformance<br />
  Fast-Start Failover: DISABLED<br />
  Databases:<br />
    msdp &#8211; Primary database<br />
    msdp_dg    &#8211; Physical standby database<br />
Current status for &#8220;msdpconf&#8221;:<br />
DISABLED</strong></p>
<p>Enable the configuration and ensure that it is functioning as expected:<br />
<strong>DGMGRL&gt; enable configuration<br />
DGMGRL&gt; show configuration verbose;<br />
Configuration</strong></p>
<p><strong>  Name:                msdpconf</strong></p>
<p><strong>  Enabled:             YES</strong></p>
<p><strong>  Protection Mode:     MaxPerformance</strong></p>
<p><strong>  Fast-Start Failover: DISABLED</strong></p>
<p><strong>  Databases:</strong></p>
<p><strong>    msdp &#8211; Primary database</strong></p>
<p><strong>    msdp_dg    &#8211; Physical standby database</strong></p>
<p><strong> </strong></p>
<p><strong>Current status for &#8220;msdpconf&#8221;:</strong></p>
<p><strong>SUCCESS</strong></p>
<p><strong>I. Enable Fast Start Failover for the configuration</strong></p>
<p><strong></strong></p>
<p>Now that we have an Oracle Dataguard broker configuration created, we are ready to enable Fast Start Failover (FSFO).</p>
<p> Fast-start failover provides the ability to totally automate the failover of database processing from the production to standby database, without any human intervention. Fast-start failover automatically, quickly, and reliably fails over to a designated, synchronized standby database in the event of loss of the primary database.  </p>
<p>To enable the functionality described above, a separate Observer process must be started for the Dataguard Broker, to monitor the entire configuration, and trigger a switchover if required. As such, it is recommended to run the Observer from a separate server/workstation entirely.</p>
<p>However, to implement FSFO, there are several additional pre-requisites that have to be met, namely:</p>
<p>       i.          the primary and standby databases must have Flashback enabled (consequently, the Flash Recovery Area must be created first)</p>
<p>     ii.          both the primary and standby databases must be running with FORCELOGGING enabled</p>
<p>    iii.          the standby database (and the primary database during switchover) must have standby archived logs created</p>
<p>    iv.          the transport mode for archived log files must be in SYNC mode</p>
<p>      v.          the protection mode for the Dataguard configuration must be upgraded to Maximum Availability, at least</p>
<p>    vi.          the FSFO target must be set for both the primary and standby databases</p>
<p>To enable Flashback, first create a designated area for the Flash Recovery Area (FRA), and then enable Flashback as shown below (must be carried out on primary and standby):</p>
<p><strong>SQL&gt; show parameter recovery_file</strong></p>
<p><strong>NAME                                                 TYPE                      VALUE</strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;               &#8212;&#8212;&#8212;&#8211;                               &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</strong></p>
<p><strong>db_recovery_file_dest                    string                    /u01/app/oracle/flash_recovery_area</strong></p>
<p><strong>db_recovery_file_dest_size                          big integer           2G</strong></p>
<p><strong> </strong></p>
<p><strong>SQL&gt; shutdown immediate;</strong></p>
<p><strong>SQL&gt; startup mount;</strong></p>
<p><strong>SQL&gt; alter database flashback on;</strong></p>
<p><strong> </strong></p>
<p>To place the database in FORCELOGGING mode, run the following in SQLplus:</p>
<p><strong>SQL&gt; alter database force logging;</strong></p>
<p><strong> </strong></p>
<p>Verify using the following command:</p>
<p><strong>SQL&gt; select db_unique_name, open_mode,flashback_on, force_logging from v$database;</strong></p>
<p><strong>DB_UNIQUE_NAME         OPEN_MODE      FLASHBACK_ON  FOR</strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;        &#8212;&#8212;&#8212;-                  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;        &#8212;</strong></p>
<p><strong>msdp                                   READ WRITE        YES                        YES</strong></p>
<p><strong>SQL&gt; select db_unique_name, open_mode,flashback_on, force_logging from v$database;</strong></p>
<p><strong>DB_UNIQUE_NAME         OPEN_MODE      FLASHBACK_ON  FOR</strong></p>
<p><strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;        &#8212;&#8212;&#8212;-                  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;        &#8212;</strong></p>
<p><strong>msdp_dg                             MOUNTED           YES                        YES</strong></p>
<p>To create the standby redo logs, run the following commands in SQLplus on the standby and primary databases:</p>
<p><strong><em>SQL&gt;  select a.GROUP#,a.BYTES/1024/1024 &#8220;MB&#8221;,b.type, b.member from v$log a, v$logfile b where a.group#=b.group#;</em></strong></p>
<p><strong><em>GROUP#                              MB         TYPE       MEMBER</em></strong></p>
<p><strong><em>&#8212;&#8212;&#8212;-                  &#8212;&#8212;&#8212;-   &#8212;&#8212;-      &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</em></strong></p>
<p><strong><em>         1                   50           ONLINE  /u01/app/oracle/oradata/msdpdg/redo01.log</em></strong></p>
<p><strong><em>         3                   50           ONLINE  /u01/app/oracle/oradata/msdpdg/redo03.log</em></strong></p>
<p><strong><em>         2                   50           ONLINE  /u01/app/oracle/oradata/msdpdg/redo02.log</em></strong></p>
<p><strong><em>SQL&gt; alter database add standby logfile group 4 &#8216;/u01/app/oracle/oradata/msdpdg/stdbyredo01.log&#8217; size 50m;</em></strong></p>
<p><strong><em>SQL&gt; alter database add standby logfile group 5 &#8216;/u01/app/oracle/oradata/msdpdg/stdbyredo02.log&#8217; size 50m;</em></strong></p>
<p><strong><em>SQL&gt; alter database add standby logfile group 6 &#8216;/u01/app/oracle/oradata/msdpdg/stdbyredo03.log&#8217; size 50m;</em></strong></p>
<p><strong><em>SQL&gt; alter database add standby logfile group 7 &#8216;/u01/app/oracle/oradata/msdpdg/stdbyredo04.log&#8217; size 50m;</em></strong></p>
<p>Note*: The number of standby log files (in this case for our single instance primary database MSDP) is equivalent to (#of online logfile groups + 1). We do not need to multiplex standby redo log files, as it is only used for recovery.</p>
<p>After this, we need to change the Dataguard Broker configuration settings, as shown below:</p>
<p><strong><em>DGMGRL&gt; edit database msdp set property LogXptMode=&#8217;SYNC&#8217;;</em></strong></p>
<p><strong><em>Property &#8220;logxptmode&#8221; updated</em></strong></p>
<p><strong><em>DGMGRL&gt; edit database msdp_dg set property LogXptMode=&#8217;SYNC&#8217;;</em></strong></p>
<p><strong><em>Property &#8220;logxptmode&#8221; updated</em></strong></p>
<p><strong><em> </em></strong></p>
<p>Next we need to define the failover targets for both the primary and standby databases. This is to enable the Oracle Observer process to automatically switchover in the event of an outage to the primary database, as shown below:</p>
<p><strong><em>DGMGRL&gt; EDIT DATABASE msdp SET PROPERTY FastStartFailoverTarget=&#8217;msdp_dg&#8217;;</em></strong></p>
<p><strong><em>Property &#8220;faststartfailovertarget&#8221; updated</em></strong></p>
<p><strong><em>DGMGRL&gt; EDIT DATABASE msdp_dg SET PROPERTY FastStartFailoverTarget=&#8217;msdp&#8217;;</em></strong></p>
<p><strong><em>Property &#8220;faststartfailovertarget&#8221; updated</em></strong></p>
<p><strong><em> </em></strong></p>
<p>After that, we will upgrade the Dataguard protection level to Maximum Availability. This is a pre-requisite before enabling FSFO, with the following:</p>
<p><strong><em>DGMGRL&gt; EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;</em></strong></p>
<p><strong><em>Succeeded.</em></strong></p>
<p>Finally, we are able to enable the FSFO for our Dataguard configuration, by running the following command:</p>
<p><strong><em>DGMGRL&gt; ENABLE FAST_START FAILOVER;</em></strong></p>
<p><strong><em>Enabled.</em></strong></p>
<p><strong><em> </em></strong></p>
<p>To verify, start the Observer process and run the following:</p>
<p>In a separate window, run the following command from DGMGRL to start the Observer process (connect to either the primary or standby database)</p>
<p><strong><em>DGMGRL&gt; connect sys/oracle@msdp</em></strong></p>
<p><strong><em>DGMGRL&gt; start observer;</em></strong></p>
<p><strong><em> </em></strong></p>
<p>Verify configuration from DGMGRL:<strong><em></em></strong></p>
<p><strong><em>DGMGRL&gt; show configuration verbose;</em></strong></p>
<p><strong><em>Configuration</em></strong></p>
<p><strong><em>  Name:                msdpconf</em></strong></p>
<p><strong><em>  Enabled:             YES</em></strong></p>
<p><strong><em>  Protection Mode:     MaxAvailability</em></strong></p>
<p><strong><em>  Fast-Start Failover: ENABLED</em></strong></p>
<p><strong><em>  Databases:</em></strong></p>
<p><strong><em>    msdp_dg &#8211; Physical standby database</em></strong></p>
<p><strong><em>            &#8211; Fast-Start Failover target</em></strong></p>
<p><strong><em>    msdp    &#8211; Primary database</em></strong></p>
<p><strong><em>Fast-Start Failover</em></strong></p>
<p><strong><em>  Threshold:           30 seconds</em></strong></p>
<p><strong><em>  Observer:            solaris2</em></strong></p>
<p><strong><em>  Shutdown Primary:    TRUE</em></strong></p>
<p><strong><em>Current status for &#8220;msdpconf&#8221;:</em></strong></p>
<p><strong><em>SUCCESS</em></strong></p>
<p>Verify from SQLplus as well:</p>
<p><strong><em>SQL&gt; select DB_UNIQUE_NAME,DATABASE_ROLE,OPEN_MODE,FS_FAILOVER_STATUS,FS_FAILOVER_CURRENT_TARGET from v$database;</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>DB_UNIQUE_NAME                 DATABASE_ROLE    OPEN_MODE  FS_FAILOVER_STATUS</em></strong></p>
<p><strong><em>&#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;</em></strong></p>
<p><strong><em>FS_FAILOVER_CURRENT_TARGET</em></strong></p>
<p><strong><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</em></strong></p>
<p><strong><em>msdp                           PRIMARY          READ WRITE SYNCHRONIZED</em></strong></p>
<p><strong><em>msdp_dg</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>SQL&gt; select DB_UNIQUE_NAME,DATABASE_ROLE,OPEN_MODE,FS_FAILOVER_STATUS,FS_FAILOVER_CURRENT_TARGET from v$database;</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>DB_UNIQUE_NAME                 DATABASE_ROLE    OPEN_MODE  FS_FAILOVER_STATUS</em></strong></p>
<p><strong><em>&#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;</em></strong></p>
<p><strong><em>FS_FAILOVER_CURRENT_TARGET</em></strong></p>
<p><strong><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</em></strong></p>
<p><strong><em>msdp_dg                        PHYSICAL STANDBY MOUNTED    SYNCHRONIZED</em></strong></p>
<p><strong><em>msdp_dg</em></strong></p>
<p><strong><em> </em></strong></p>
<p>Now that we have a working FSFO configuration, we can test the automated failover functionality.</p>
<p>To do this, we will:</p>
<p>       i.          simulate a failure on the production database</p>
<p>     ii.          allow the primary database to be switched over to the standby server</p>
<p>    iii.          carry out some changes on the new primary database</p>
<p>    iv.          reinstate (re-enable) the former primary database</p>
<p>The easiest way to simulate a failure on the primary database, is to run the SHUTDOWN ABORT command via SQLplus. This will shutdown the primary database, without going through the steps involved in a &#8216;clean&#8217; shutdown (flushing the memory buffers, performing a checkpoint, synchronizing datafile headers, etc) and is similar to a power failure of the primary server.</p>
<p><strong><em>SQL&gt; shut abort</em></strong></p>
<p><strong><em>ORACLE instance shut down.</em></strong></p>
<p>From the DGMGRL log, we can observe the following:</p>
<p><strong><em>DGMGRL&gt; start observer;</em></strong></p>
<p><strong><em>Observer started</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>18:44:48.74  Tuesday, October 05, 2010</em></strong></p>
<p><strong><em>Initiating fast-start failover to database &#8220;msdp_dg&#8221;&#8230;</em></strong></p>
<p><strong><em>Performing failover NOW, please wait&#8230;</em></strong></p>
<p><strong><em>Operation requires shutdown of instance &#8220;msdp_dg&#8221; on database &#8220;msdp_dg&#8221;</em></strong></p>
<p><strong><em>Shutting down instance &#8220;msdp_dg&#8221;&#8230;</em></strong></p>
<p><strong><em>ORA-01109: database not open</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>Database dismounted.</em></strong></p>
<p><strong><em>ORACLE instance shut down.</em></strong></p>
<p><strong><em>Operation requires startup of instance &#8220;msdp_dg&#8221; on database &#8220;msdp_dg&#8221;</em></strong></p>
<p><strong><em>Starting instance &#8220;msdp_dg&#8221;&#8230;</em></strong></p>
<p><strong><em>ORACLE instance started.</em></strong></p>
<p><strong><em>Database mounted.</em></strong></p>
<p><strong><em>Failover succeeded, new primary is &#8220;msdp_dg&#8221;</em></strong></p>
<p><strong><em>18:45:57.98  Tuesday, October 05, 2010</em></strong></p>
<p>The Observer process detected a disconnect from the primary database, and after the threshold specified (the Threshold parameter in the FSFO configuration, default 30 seconds) it automatically initiated a switchover to the standby MSDP_DG instance.</p>
<p>To continue our simulation, we will then carry out some changes on the new primary database. For this example, the STANDBY_FILE_MANAGEME NT parameter should have been set to AUTO earlier, and the datafile path /u01/app/oracle/oradata/msdp must be mirrored in the standby server.</p>
<p><strong><em>SQL&gt; select name from v$datafile;</em></strong></p>
<p><strong><em>NAME</em></strong></p>
<p><strong><em>&#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;</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdpdg/system01.dbf</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdpdg/undotbs01.dbf</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdpdg/sysaux01.dbf</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdpdg/users01.dbf</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>SQL&gt; create tablespace fsfotest datafile &#8216;/u01/app/oracle/oradata/msdpdg/fsfotest01.dbf&#8217; size 10m;</em></strong></p>
<p><strong><em>Tablespace created.</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em> </em></strong></p>
<p>Finally, we will look at how we reinstate the former primary instance (MSDP) into our Dataguard Broker configuration, using the FSFO functionality. First, we will bring up the MSDP instance in NOMOUNT state:</p>
<p><strong><em>SQL&gt; startup nomount</em></strong></p>
<p><strong><em>ORACLE instance started.</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>Total System Global Area  209715200 bytes</em></strong></p>
<p><strong><em>Fixed Size                  2095120 bytes</em></strong></p>
<p><strong><em>Variable Size              96471024 bytes</em></strong></p>
<p><strong><em>Database Buffers          104857600 bytes</em></strong></p>
<p><strong><em>Redo Buffers                6291456 bytes</em></strong></p>
<p>Next, we will mount the MSDP database. At this point, note the output from the FSFO logfile (or from the screen, if starting the observer manually):</p>
<p><strong><em>SQL&gt; alter database mount;</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>DGMGRL output:</em></strong></p>
<p><strong><em>18:56:37.09  Tuesday, October 05, 2010</em></strong></p>
<p><strong><em>Initiating reinstatement for database &#8220;msdp&#8221;&#8230;</em></strong></p>
<p><strong><em>Reinstating database &#8220;msdp&#8221;, please wait&#8230;</em></strong></p>
<p><strong><em>Operation requires shutdown of instance &#8220;msdp&#8221; on database &#8220;msdp&#8221;</em></strong></p>
<p><strong><em>Shutting down instance &#8220;msdp&#8221;&#8230;</em></strong></p>
<p><strong><em>ORA-01109: database not open</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>Database dismounted.</em></strong></p>
<p><strong><em>ORACLE instance shut down.</em></strong></p>
<p><strong><em>Operation requires startup of instance &#8220;msdp&#8221; on database &#8220;msdp&#8221;</em></strong></p>
<p><strong><em>Starting instance &#8220;msdp&#8221;&#8230;</em></strong></p>
<p><strong><em>ORACLE instance started.</em></strong></p>
<p><strong><em>Database mounted.</em></strong></p>
<p><strong><em>Continuing to reinstate database &#8220;msdp&#8221; &#8230;</em></strong></p>
<p><strong><em>Reinstatement of database &#8220;msdp&#8221; succeeded</em></strong></p>
<p><strong><em>18:57:56.94  Tuesday, October 05, 2010</em></strong></p>
<p>From the output, we can see that when the MSDP instance is mounted, the Dataguard Broker processes are also started in the background. At this point, the Observer is able to detect that the former primary database MSDP needs to be reinstated into the configuration, with its role changed to that of a physical standby database.</p>
<p>As part of the reinstatement process, the MSDP instance will be synchronized to a point of time before the failover happened (via Flashback), and then re-started as a standby database before recovery is carried out.</p>
<p>When this entire process is completed, the new configuration will be as below:</p>
<p><strong><em>DGMGRL&gt; show configuration verbose;</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>Configuration</em></strong></p>
<p><strong><em>  Name:                msdpconf</em></strong></p>
<p><strong><em>  Enabled:             YES</em></strong></p>
<p><strong><em>  Protection Mode:     MaxAvailability</em></strong></p>
<p><strong><em>  Fast-Start Failover: ENABLED</em></strong></p>
<p><strong><em>  Databases:</em></strong></p>
<p><strong><em>    msdp_dg &#8211; Primary database</em></strong></p>
<p><strong><em>    msdp    &#8211; Physical standby database</em></strong></p>
<p><strong><em>            - Fast-Start Failover target</em></strong></p>
<p><strong><em>Fast-Start Failover</em></strong></p>
<p><strong><em>  Threshold:           30 seconds</em></strong></p>
<p><strong><em>  Observer:            solaris1</em></strong></p>
<p><strong><em>  Shutdown Primary:    TRUE</em></strong></p>
<p><strong><em>Current status for &#8220;msdpconf&#8221;:</em></strong></p>
<p><strong><em>SUCCESS</em></strong></p>
<p>Additionally, the changes we carried out earlier have been reflected on the MSDP instance:</p>
<p><strong><em>SQL&gt; select DB_UNIQUE_NAME,DATABASE_ROLE,OPEN_MODE,FS_FAILOVER_STATUS,FS_FAILOVER_CURRENT_TARGET from v$database;</em></strong></p>
<p><strong><em>DB_UNIQUE_NAME                 DATABASE_ROLE    OPEN_MODE  FS_FAILOVER_STATUS</em></strong></p>
<p><strong><em>&#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;</em></strong></p>
<p><strong><em>FS_FAILOVER_CURRENT_TARGET</em></strong></p>
<p><strong><em>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</em></strong></p>
<p><strong><em>msdp                           PHYSICAL STANDBY MOUNTED    SYNCHRONIZED</em></strong></p>
<p><strong><em>msdp</em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em> </em></strong></p>
<p><strong><em>SQL&gt; select name from v$datafile;</em></strong></p>
<p><strong><em>NAME</em></strong></p>
<p><strong><em>&#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;</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdp/system01.dbf</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdp/undotbs01.dbf</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdp/sysaux01.dbf</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdp/users01.dbf</em></strong></p>
<p><strong><em>/u01/app/oracle/oradata/msdpdg/fsfotest01.dbf</em></strong><strong><em></em></strong></p>
<p>This demonstrates briefly the functionality of FSFO with Oracle Dataguard 10g, as a means of automatically performing role transitions in a configuration, as well as re-enabling a former primary database after a failover. This, in addition to recommended client failover strategies, help to create a easily manageable, highly available disaster recovery solution with Oracle Dataguard 10g.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/168/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=168&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2010/10/08/creating-an-oracle-database-10g-dataguard-fast-start-failover-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/feab28045f7340df821f3da534760a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">niradj</media:title>
		</media:content>
	</item>
		<item>
		<title>11g New features</title>
		<link>http://oracleinnotiive.wordpress.com/2010/08/11/11g-new-features/</link>
		<comments>http://oracleinnotiive.wordpress.com/2010/08/11/11g-new-features/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 11:15:45 +0000</pubDate>
		<dc:creator>oracleinnotiive</dc:creator>
				<category><![CDATA[Oracle 11g]]></category>
		<category><![CDATA[oracle 11g]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=160</guid>
		<description><![CDATA[Oracle 11g has introduced many new features to ease the DBA workload, As there are many new features in oracle &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2010/08/11/11g-new-features/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=160&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Oracle 11g has introduced many new features to ease the DBA workload,</p>
<p>As there are many new features in oracle 11g, I will start with one new feature and will add on the many new features soon.</p>
<p>The new diagnosability infrastructure aim is</p>
<ul>
<li>Preventing problem</li>
<li>To find Proactive detections of problems</li>
<li>Limiting the damage caused by database problems</li>
<li>Reducing the time it takes to diagnose problems</li>
<li>Easier interaction with Oracle support</li>
</ul>
<p>The new features introduced by Oracle Fault management</p>
<ul>
<li>Automatic Diagnostic Repository</li>
<li>The support workbench</li>
<li>The health monitor</li>
<li>The Sql repair advisor</li>
<li>The data recovery advisor</li>
</ul>
<p>I will start off <strong>with Oracle 11g fault management</strong>-<strong>Automatic Diagnostic repository</strong></p>
<p><strong>Automatic Diagnostic repository</strong></p>
<p>The automatic diagnostic repository (ADR) is a <strong>special storage facility that is located outside the database i.e in the file system.</strong></p>
<ol>
<li>We can access the file with a command line utility (CMD) or Enterprise manager.ADR works based on the timely capture of the critical error information following a Database failure.</li>
<li>A memory base trace system collects the diagnostic and stores it in ADR.ADR contains Diagnostic files like alert log, tracefile, dump files and core files and Health monitor reports.</li>
<li>Please note in Oracle 11g not only the database, but ASM, CRS and other Oracle products and components store all their diagnostic data in ADR.</li>
<li>For example in the environment with RAC and ASM storage, each of the database instances and ASM instances have their own directory under ADR.</li>
<li>ADR uses a consistent diagnostic data format across all Oracle products and all instances thus making it easy for users and Oracle Support to correlate diagnostic data from multiple instances.</li>
<li>ADR also replaces the traditional diagnostic directories such as the bdump and cdump.</li>
</ol>
<p><strong>The Structure of the ADR</strong></p>
<p>The new initialization parameter <strong>DIAGNOSTIC_DEST can</strong> be used to set the location of ADR base.</p>
<p>Please note the location of the parameter above is optional and ,if we don’t specify the value above the Oracle will determine the default location of the <strong>ADR base</strong>:</p>
<ol>
<li>If we set the ORACLE_BASE environment variable, the database sets the diagnostic_dest parameter value to the ORACLE_BASE.</li>
<li>Or else the database set the diagnostic_dest parameter value to $ORACLE_HOME/log</li>
</ol>
<p>Example in my test database I set the value of ORACLE_BASE= /u01/app/oracle</p>
<p>[oracle@oraclelinux oracle]$ echo $ORACLE_BASE</p>
<p>/u01/app/oracle</p>
<p>SQL&gt; show parameter diagnostic_dest</p>
<p>NAME                                 TYPE        VALUE</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>Diagnostic_dest                      string      /u01/app/oracle</p>
<p>What is the difference between ADR_BASE and ADR home?</p>
<p>ADR base is the location we set with the help of diagnostic_dest parameter</p>
<p>ADR home represent the path of the ADR home for <strong>current database instance</strong></p>
<p><strong>ADR home subdirectories</strong></p>
<p><strong> </strong></p>
<p>Each database instance stores its diagnostic data in various subdirectories</p>
<ul>
<li>Alert-Oracle stores an alert log in the XML format</li>
<li>Hm-Contains the checker run reports, which are generated by the new Health Monitor facility</li>
<li>Incident-Contain incident report for the instance</li>
<li>Trace-Contains the text-based alert log, similar to the traditional alert log file.</li>
</ul>
<p><strong><span style="text-decoration:underline;"> </span></strong></p>
<p><strong><span style="text-decoration:underline;">Viewing the ADR locations</span></strong></p>
<p>We use the view V$DIAG_INFO view to see all the ADR locations for the ORACLE database instance</p>
<p>SQL&gt; select * from v$diag_info;</p>
<p>INST_ID NAME                           VALUE</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;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>1 Diag Enabled                   TRUE</p>
<p>1 ADR Base                       /u01/app/oracle</p>
<p>1 ADR Home                     /u01/app/oracle/diag/rdbms/prod/PROD</p>
<p>1 Diag Trace                      /u01/app/oracle/diag/rdbms/prod/PROD/trace</p>
<p>1 Diag Alert                       /u01/app/oracle/diag/rdbms/prod/PROD/alert</p>
<p>1 Diag Incident                  /u01/app/oracle/diag/rdbms/prod/PROD/incident</p>
<p>1 Diag Cdump                    /u01/app/oracle/diag/rdbms/prod/PROD/cdump</p>
<p>1 Health Monitor               /u01/app/oracle/diag/rdbms/prod/PROD/hm</p>
<p>1 Default Trace File           /u01/app/oracle/diag/rdbms/prod/PROD/trace/PROD_ora_5283.trc</p>
<p>1 Active Problem Count           0</p>
<p>1 Active Incident Count          0</p>
<p>11 rows selected.</p>
<p><strong> </strong></p>
<p><strong>ADRCI</strong></p>
<p>The ADR command interpreter (ADRCI) is a brand new command –line tool that is a key component of the new fault diagnosability infrastructure.ADRCI tool enables us to interact with the ADR from the command line:</p>
<p>Starting ADRCI</p>
<p>By default the homepath to ADR is null when we start ADRCI meaning that all ADR homes under the ADR base are current. Hence we need to set the ADR home for ADRCI</p>
<p>[oracle@oraclelinux ~]$ adrci</p>
<p>ADRCI: Release 11.1.0.6.0 &#8211; Beta on Tue Aug 10 00:40:20 2010</p>
<p>Copyright (c) 1982, 2007, Oracle.  All rights reserved.</p>
<p>ADR base = &#8220;/u01/app/oracle&#8221;</p>
<p>adrci&gt;</p>
<p>Once ADRCI is started, we can enter various ADR interactive commands at the ADRCI prompt. Once done we can leave by typing exit or quit.</p>
<p>To view the list of ADRCI command type help in the ADRCI prompt</p>
<p>adrci&gt; help</p>
<p>HELP [topic]</p>
<p>Available Topics:</p>
<p>CREATE REPORT</p>
<p>ECHO</p>
<p>EXIT</p>
<p>HELP</p>
<p>HOST</p>
<p>IPS</p>
<p>PURGE</p>
<p>RUN</p>
<p>SET BASE</p>
<p>SET BROWSER</p>
<p>SET CONTROL</p>
<p>SET ECHO</p>
<p>SET EDITOR</p>
<p>SET HOMES | HOME | HOMEPATH</p>
<p>SET TERMOUT</p>
<p>SHOW ALERT</p>
<p>SHOW BASE</p>
<p>SHOW CONTROL</p>
<p>SHOW HM_RUN</p>
<p>SHOW HOMES | HOME | HOMEPATH</p>
<p>SHOW INCDIR</p>
<p>SHOW INCIDENT</p>
<p>SHOW PROBLEM</p>
<p>SHOW REPORT</p>
<p>SHOW TRACEFILE</p>
<p>SPOOL</p>
<p>There are other commands intended to be used directly by Oracle, type</p>
<p>&#8220;HELP EXTENDED&#8221; to see the list</p>
<p>adrci&gt; help set homepath</p>
<p>Usage:  SET HOMES | HOME| HOMEPATH &lt;homepath_str1 homepath_str2 &#8230;&gt;</p>
<p>Purathpose: Set the ADR homes to query in the current ADRCI session.</p>
<p>Setting the homepath for ADR</p>
<p>Step 1:show all the homes currently set for ADR</p>
<p>adrci&gt; show homes</p>
<p>ADR Homes:</p>
<p>diag/rdbms/prod/PROD</p>
<p>diag/rdbms/prod/PRODUCTION</p>
<p>Step 2:changing the homepath to PRODUCTION</p>
<p>adrci&gt; set homepath diag/rdbms/prod/PRODUCTION</p>
<p>adrci&gt; show homes</p>
<p>ADR Homes:</p>
<p>diag/rdbms/prod/PRODUCTION</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>Running adrci using batch mode</strong></p>
<p><strong> </strong></p>
<p>We can run adrci command in batch mode too by using a script and invoking it from adrci</p>
<p><span style="text-decoration:underline;">Script.txt</span></p>
<p>Set homepath diag/rdbms/prod/PRODUCTION</p>
<p>Show alert</p>
<p>In order to run the script enter the following command</p>
<p><strong>Adrci script=script.txt </strong></p>
<p><strong> </strong></p>
<p><strong>Viewing the ALERT log contents with ADRCI</strong></p>
<p>There are two types of alert logs for each database instance in an Oracle Database 11g Release 1 Database</p>
<p>1. In Trace directory</p>
<p>2. In the Alert directory under the ADR</p>
<p>To view the alert log ,set the ADR homepath to the database instance we are interested in and then issue the command</p>
<p><strong>SHOW ALERT</strong> or <strong>SHOW ALERT -TAIL</strong></p>
<p>The show alert –tail commands shows the last few lines of the alert log</p>
<p>Example when database startup you can check against the alert log</p>
<p>adrci&gt; show alert -tail</p>
<p>2010-08-10 18:40:00.111000 +08:00</p>
<p>Thread 1 opened at log sequence 2</p>
<p>Current log# 2 seq# 2 mem# 0: /u01/app/oradata/PROD/redo02.log</p>
<p>Successful open of redo thread 1</p>
<p>MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set</p>
<p>SMON: enabling cache recovery</p>
<p>2010-08-10 18:40:04.812000 +08:00</p>
<p>Successfully onlined Undo Tablespace 2.</p>
<p>Verifying file header compatibility for 11g tablespace encryption..</p>
<p>Verifying 11g file header compatibility for tablespace encryption completed</p>
<p>SMON: enabling tx recovery</p>
<p>Database Characterset is WE8MSWIN1252</p>
<p>2010-08-10 18:40:07.189000 +08:00</p>
<p>Opening with internal Resource Manager plan</p>
<p>2010-08-10 18:40:09.596000 +08:00</p>
<p>Starting background process SMCO</p>
<p>SMCO started with pid=23, OS</p>
<p>Starting background process FBDA</p>
<p>FBDA started with pid=24, OS</p>
<p>replication_dependency_tracking turned off (no async multimaster replication found)</p>
<p>2010-08-10 18:40:12.278000 +08:00</p>
<p>Starting background process QMNC</p>
<p>QMNC started with pid=25, OS</p>
<p>2010-08-10 18:40:38.981000 +08:00</p>
<p>Completed: ALTER DATABASE OPEN</p>
<p>adrci&gt;</p>
<p>You can return to the ADRCI command prompt after issuing the   show alert –tail   command line by pressing   CTL +C. You can also specify the number of lines to be shown and also spool the results of the command, just as you can in SQL*Plus.</p>
<p><strong>Incidents and Problems</strong></p>
<p>Oracle introduces two new diagnostic concepts in Oracle Database 11: problems and incidents.</p>
<p>These concepts are crucial to the understanding of the new fault diagnosability infrastructure</p>
<ul>
<li><strong>Any critical error in the database is called a   problem</strong> for example, a critical error such as the one manifested by the Oracle error ORA-4031 (unable to allocate more bytes of shared memory). A problem is identified by a problem key and includes Oracle error codes.</li>
</ul>
<ul>
<li><strong>A single occurrence of a problem is called an   incident.</strong> Multiple occurrences of the same problem lead to multiple incidents. An incident is identified by a unique incident ID.</li>
</ul>
<p>When the ADR track both problems and incident it displays in Enterprise manager</p>
<p>Each incident is tagged with a problem key that relates the incident to a problem.</p>
<p>ADR automatically creates a problem when the first incident of that problem key</p>
<p>occurs. It removes the problem metadata after the last incident with that problem</p>
<p>key is removed from the ADR.</p>
<p><strong><em>The MMON background process is in charge of automatically purging expired </em></strong></p>
<p><strong><em>ADR data.</em></strong></p>
<p>ADR uses what it refers to as a flood-controlled incident system, whereby it allows only a certain number of incidents under a problem to log diagnostic data.</p>
<p><span style="text-decoration:underline;">Important</span></p>
<p><span style="text-decoration:underline;"> </span></p>
<p>ADR allows 5 diagnostic Data dumps per hour for a single problem</p>
<p>Hence if the incident occur 20 times for a same incident type,we only have to report once for Oracle support.</p>
<p>The set of diagnostic data pertaining to an incident or incidents to a problem(or problems) is called an <strong>INCIDENT PACKAGE</strong>.</p>
<p>ADR follows a retention policy so it can limit the amount of diagnostic data it must store.The retention policy actually includes two different settings,</p>
<p>1. Metadata retention        &#8211; default setting one year</p>
<p>2. Incident files and dump retention – default setting one month</p>
<p>To check an incident’s current status in ADR,type the command below</p>
<p>Adrci&gt; show incident –mode detail</p>
<p>If there is no incident then the following status will appear</p>
<p>adrci&gt; show incident -mode detail</p>
<p>ADR Home = /u01/app/oracle/diag/rdbms/prod/PROD:</p>
<p>*************************************************************************</p>
<p>0 rows fetched</p>
<p><strong><span style="text-decoration:underline;">Incident packaging services</span></strong></p>
<p><strong><span style="text-decoration:underline;"> </span></strong></p>
<p>In earlier version of Oracle,we had to manually gather diagnostic data from multiple sources to submit to Oracle Support when we want to notify them of a problem.</p>
<p>Oracle Database 11g provides a new feature called the incident packaging services(IPS).</p>
<p>IPS will let us automatically gather all diagnostic data pertaining to a critical error such as the trace files and dump files. Plus the new Health check reports,SQL test cases,and related information,and package the data into a ZIP file to send to Oracle Support</p>
<p>We manage the IPS through either new Support Workbench, or through ADRCI tool.</p>
<p><strong><span style="text-decoration:underline;">Packaging Incident with ADRCI</span></strong></p>
<p><strong><span style="text-decoration:underline;"> </span></strong></p>
<p>You can use incident package to transmit incident information to Oracle Support.</p>
<p><strong><span style="text-decoration:underline;">Creating a logical package</span></strong></p>
<p><strong><span style="text-decoration:underline;"> </span></strong></p>
<p>Before posting an incident report we need to create a logical package.</p>
<p>ADR stores Logical package as METADATA.</p>
<p>Adrci&gt;ips create package</p>
<p>Created package 1 without any contents, correlation level typical</p>
<p>Adrci&gt;</p>
<p>The above package is an empty package.</p>
<p>To create a non empty logical package  issue the command below</p>
<p>Adrci&gt;ips create package incident &lt;incident number&gt;</p>
<p>Created package 5 based on incident id 17060</p>
<p>Correlation level typical</p>
<p>Adrci&gt;</p>
<p>You can add file to an existing package by using the following</p>
<p>Adrci&gt;ips add file &lt;file_name&gt; package &lt;package_number&gt;</p>
<p>Note that you can add only those files that are located in the ADR directory hierarchy(under the ADR base)</p>
<p>Generating a physical Incident Package</p>
<p>Once we load the logical package with diagnostic data,its  the time to create the physical package to send to Oracle support</p>
<p>adrci&gt; ips generate package 1 in /u01/app/oracle/diag</p>
<p>Generated package 1 in file /u01/app/oracle/diag/IPSPKG_20100810231616_COM_1.zip, mode complete</p>
<p>Adrci&gt;</p>
<p>The above command generates a physical package in the directory /u01/app/oracle/support from the logical package 1 that we created earlier.</p>
<p>Note the suffix COM_1 is the filename for the physical file.</p>
<p>Once we incorporate all the diagnostic data and are ready to transmit the physical package</p>
<p>adrci&gt; ips finalize package 1</p>
<p>Finalized package 1</p>
<p>adrci&gt;</p>
<p>even though have generated the file ,we need to send the file old-fashioned way.through Oracle support workbench.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=160&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2010/08/11/11g-new-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8c00e81ceae6be8d9be49cb966b58ec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oracleinnotiive</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple Guide on Installing 2 Nodes Oracle 10g RAC on Solaris 10 64bit</title>
		<link>http://oracleinnotiive.wordpress.com/2010/07/26/simple-guide-on-installing-2-nodes-oracle-10g-rac-on-solaris-10-64bit/</link>
		<comments>http://oracleinnotiive.wordpress.com/2010/07/26/simple-guide-on-installing-2-nodes-oracle-10g-rac-on-solaris-10-64bit/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 02:42:49 +0000</pubDate>
		<dc:creator>mhafiz12</dc:creator>
				<category><![CDATA[Rac]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=67</guid>
		<description><![CDATA[Content Introduction Network Configuration (Hostname and IP address) Create Oracle groups and Oracle user Prepare disk for Oracle binaries (Local &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2010/07/26/simple-guide-on-installing-2-nodes-oracle-10g-rac-on-solaris-10-64bit/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=67&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Content </strong></p>
<p>Introduction</p>
<ol>
<li>Network Configuration (Hostname and IP address)</li>
<li>Create Oracle groups and Oracle user</li>
<li>Prepare disk for Oracle binaries (Local disk)</li>
<li>iSCSI Configuration</li>
<li>Prepare disk for OCR, Voting and ASM</li>
<li>Setting Kernel Parameters</li>
<li>Check and install required package</li>
<li>Installing Oracle Clusterware</li>
<li>Installing Oracle Database 10g Software</li>
<li>Create ASM instance and ASM diskgroup</li>
</ol>
<p><strong>Reference:</strong></p>
<p>www.oracle.com<br />
www.idevelopment.info</p>
<p><strong>Introduction</strong></p>
<p>These article are intended for people who have basic knowledge of Oracle RAC. This article does not detail everything required to be understood in order to configure a RAC database. Please refer to Oracle documentation for explanation.</p>
<p>This article, however, focuses on putting together your own Oracle RAC 10<em>g</em> environment for development and testing by using Solaris servers and a low cost shared disk solution; iSCSI by using Openfiler (Openfiler installation and disk management is not covered in this article).</p>
<p>The two Oracle RAC nodes will be configured as follows:</p>
<table border="0" cellspacing="0" cellpadding="0" width="97%">
<tbody>
<tr>
<td colspan="5" width="100%"><strong>Oracle Database Files</strong></td>
</tr>
<tr>
<td width="21%"><strong>RAC   Node Name</strong></td>
<td width="19%"><strong>Instance   Name</strong></td>
<td width="19%"><strong>Database   Name</strong></td>
<td width="16%"><strong>$ORACLE_BASE</strong></td>
<td width="22%"><strong>File   System for DB Files</strong></td>
</tr>
<tr>
<td width="21%">soladb1</td>
<td width="19%">sola1</td>
<td width="19%">sola</td>
<td width="16%">/oracle</td>
<td width="22%">ASM</td>
</tr>
<tr>
<td width="21%">soladb2</td>
<td width="19%">sola2</td>
<td width="19%">sola</td>
<td width="16%">/oracle</td>
<td width="22%">ASM</td>
</tr>
<tr>
<td colspan="5" width="100%"></td>
</tr>
<tr>
<td colspan="5" width="100%"><strong>Oracle Clusterware Shared Files</strong></td>
</tr>
<tr>
<td width="21%"><strong>File   Type</strong></td>
<td width="19%"><strong>File   Name</strong></td>
<td width="19%"><strong>iSCSI   Volume Name</strong></td>
<td width="16%"><strong>Mount   Point</strong></td>
<td width="22%"><strong>File   System</strong></td>
</tr>
<tr>
<td width="21%">Oracle   Cluster Registry</td>
<td width="19%">/dev/rdsk/c2t3d0s2</td>
<td width="19%">ocr</td>
<td width="16%"></td>
<td width="22%">RAW</td>
</tr>
<tr>
<td width="21%">CRS   Voting Disk</td>
<td width="19%">/dev/rdsk/c2t4d0s2</td>
<td width="19%">vot</td>
<td width="16%"></td>
<td width="22%">RAW</td>
</tr>
</tbody>
</table>
<p>The Oracle Clusterware software will be installed to /oracle/product/10.2.0/crs_1 on both the nodes that make up the RAC cluster. All of the Oracle physical database files (data, online redo logs, control files, archived redo logs) will be installed to shared volumes being managed by Automatic Storage Management (ASM).</p>
<p><strong>1. Network Configuration (Hostname and IP address)</strong></p>
<p><em>Perform the following network configuration on both Oracle RAC nodes in the cluster</em></p>
<p>Both of the Oracle RAC nodes should have one static IP address for the public network and one static IP address for the private cluster interconnect. The private interconnect should only be used by Oracle to transfer Cluster Manager and Cache Fusion related data along with data for the network storage server (Openfiler). Although it is possible to use the public network for the interconnect, this is not recommended as it may cause degraded database performance (reducing the amount of bandwidth for Cache Fusion and Cluster Manager traffic). For a production RAC implementation, the interconnect should be at least gigabit (or more) and only be used by Oracle as well as having the network storage server on a separate gigabit network.</p>
<p>The following example is from soladb1:</p>
<p><strong>i. Update entry of /etc/hosts</strong></p>
<p><em># cat /etc/hosts</em></p>
<p><em>127.0.0.1       localhost</em></p>
<p><em> </em><br />
<em># Public Network (e1000g0)</em><br />
<em>192.168.2.100     soladb1         loghost</em><br />
<em>192.168.2.101     soladb2</em><br />
<em> </em><br />
<em># Public Virtual IP (VIP) addresses</em><br />
<em>192.168.2.104     soladb1-vip</em><br />
<em>192.168.2.105     soladb2-vip</em><br />
<em> </em><br />
<em># Private Interconnect (e1000g1)</em><br />
<em>10.0.0.100            soladb1-priv<br />
soladb2-priv</em></p>
<p><strong>ii. Edit name of server hostname by update /etc/nodename file</strong><br />
<code><em># cat /etc/nodename</em><strong><br />
</strong><em>soladb1</em></code><br />
<strong>iii. Update/add file /etc/hostname.&lt;interface name&gt; to<br />
</strong><code><em># cat hostname.e1000g0</em><strong><br />
</strong><em>soladb1</em></code></p>
<p><code><em># cat hostname.e1000g1</em><br />
<em>soladb1-priv</em></code></p>
<p>Once the network is configured, you can use the <code>ifconfig</code> command to verify everything is working. The following example is from soladb1:</p>
<p><code># ifconfig -a<br />
lo0: flags=2001000849&lt;UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL&gt; mtu 8232 index 1<br />
inet 127.0.0.1 netmask ff000000<br />
e1000g0: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 2<br />
inet 192.168.2.100 netmask ffffff00 broadcast 192.168.2.255<br />
ether 0:50:56:99:45:20<br />
e1000g1: flags=1000843&lt;UP,BROADCAST,RUNNING,MULTICAST,IPv4&gt; mtu 1500 index 3<br />
inet 10.0.0.100 netmask ff000000 broadcast 10.255.255.255<br />
ether 0:50:56:99:4f:a1</code></p>
<p><strong> </strong></p>
<p><strong>Adjusting Network Settings<br />
</strong>The UDP (User Datagram Protocol) settings affect cluster interconnect transmissions. If the buffers set by these parameters are too small, then incoming UDP datagrams can be dropped due to insufficient space, which requires send-side retransmission. This can result in poor cluster performance.</p>
<p>On Solaris, the UDP parameters are <strong>udp_recv_hiwat</strong> and <strong>udp_xmit_hiwat</strong>. The default values for these paramaters on Solaris 10 are 57344 bytes. Oracle recommends that you set these parameters to at least 65536 bytes.</p>
<p>To see what these parameters are currently set to, enter the following commands:<br />
<code><em># ndd /dev/udp udp_xmit_hiwat<br />
# ndd /dev/udp udp_recv_hiwat</em></code></p>
<p>To set the values of these parameters to 65536 bytes in current memory, enter the following commands:<br />
<code><em># ndd -set /dev/udp udp_xmit_hiwat 65536<br />
# ndd -set /dev/udp udp_recv_hiwat 65536</em></code></p>
<p>We need to write a startup script <strong>udp_rac</strong> in /etc/init.d with the following contents to set to these values when the system boots.</p>
<p><code><em>#!/sbin/sh</em><br />
<em>case "$1" in</em><br />
<em>'start')</em><br />
<em> ndd -set /dev/udp udp_xmit_hiwat 65536</em><br />
<em> ndd -set /dev/udp udp_recv_hiwat 65536</em><br />
<em> ;;</em><br />
<em>'state')</em><br />
<em> ndd /dev/udp udp_xmit_hiwat</em><br />
<em> ndd /dev/udp udp_recv_hiwat</em><br />
<em> ;;</em><br />
<em>*)</em><br />
<em> echo "Usage: $0 { start | state }"</em><br />
<em> exit 1</em><br />
<em> ;;</em><br />
<em>esac</em><br />
</code><br />
We now need to create a link to this script in the /etc/rc3.d directory.</p>
<p><code><em># ln -s /etc/init.d/udp_rac /etc/rc3.d/S86udp_rac</em></code></p>
<p><strong> </strong></p>
<p><strong>2. Create Oracle groups and Oracle user </strong><br />
<em>Perform the following task  on all Oracle RAC nodes in the cluster<br />
</em>We will create the dba group and the oracle user account along with all appropriate directories.</p>
<p><code># mkdir -p /oracle<br />
# groupadd –g 501 oinstall<br />
# groupadd –g 502 dba</code></p>
<p><code># useradd -s /usr/bin/bash -u 500 -g 501 -G 502 -d /oracle oracle -c "Oracle Software Owner" oracle<br />
# chown -R oracle:dba /oracle<br />
# passwd oracle</code></p>
<p><strong> </strong></p>
<p><strong>Modify Oracle user environment variable<br />
</strong><em>Perform the following task  on all Oracle RAC nodes in the cluster</em></p>
<p><em> </em><strong> </strong></p>
<p>After creating the oracle user account on both nodes, ensure that the environment is setup correctly by using the following .bash_profile (Please note that the .bash_profile will not exist on Solaris; you will have to create it).</p>
<p>The following example is from soladb1:</p>
<p><code><em># su – oracle</em><br />
<em>$ cat .bash_profile</em><br />
<em>PATH=/usr/sbin:/usr/bin</em><br />
<em>export ORACLE_SID=sola1</em><br />
<em>export ORACLE_BASE=/oracle</em><br />
<em>export ORACLE_HOME=/oracle/product/10.2.0/db_1</em><br />
<em>export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1</em><br />
<em>export PATH=$PATH:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin</em></code></p>
<p><strong> </strong></p>
<p><strong><br />
</strong></p>
<p><strong> </strong></p>
<p><strong>3. Prepare disk for Oracle binaries (Local disk)</strong></p>
<p><em>Perform the following task on all Oracle RAC nodes in the cluster</em></p>
<p><em> </em></p>
<p>1. Format the disk</p>
<p><code># format<br />
AVAILABLE DISK SELECTIONS:<br />
0. c1t0d0 &lt;DEFAULT cyl 2607 alt 2 hd 255 sec 63&gt;<br />
/pci@0,0/pci15ad,1976@10/sd@0,0<br />
1. c1t1d0 &lt;DEFAULT cyl 2607 alt 2 hd 255 sec 63&gt;<br />
/pci@0,0/pci15ad,1976@10/sd@1,0<br />
Specify disk (enter its number):  <strong>1</strong></code></p>
<p><code>format&gt; fdisk<br />
No fdisk table exists. The default partition for the disk is:<br />
a 100% "SOLARIS System" partition<br />
Type "y" to accept the default partition,  otherwise type "n" to edit the<br />
partition table.<br />
<strong>Y </strong></code></p>
<p><code>format&gt; <strong>p</strong><br />
<em>PARTITION MENU:</em><br />
<em> 0      - change `0' partition</em><br />
<em> 1      - change `1' partition</em><br />
<em> 2      - change `2' partition</em><br />
<em> 3      - change `3' partition</em><br />
<em> 4      - change `4' partition</em><br />
<em> 5      - change `5' partition</em><br />
<em> 6      - change `6' partition</em><br />
<em> 7      - change `7' partition</em><br />
<em> select - select a predefined table</em><br />
<em> modify - modify a predefined partition table</em><br />
<em> name   - name the current table</em><br />
<em> print  - display the current table</em><br />
<em> label  - write partition map and label to the disk</em><br />
<em> !&lt;cmd&gt; - execute &lt;cmd&gt;, then return</em><br />
<em> quit</em></code></p>
<p><code>partition&gt; <strong>p</strong> (print  - display the current table)<br />
Current partition table (original):<br />
Total disk cylinders available: 2607 + 2 (reserved cylinders)<br />
Part      Tag    Flag     Cylinders        Size            Blocks<br />
0 unassigned    wm       0               0         (0/0/0)           0<br />
1 unassigned    wm       0               0         (0/0/0)           0<br />
<strong> 2     backup    wu       0 - 2606       19.97GB    (2607/0/0) 41881455</strong><br />
3 unassigned    wm       0               0         (0/0/0)           0<br />
4 unassigned    wm       0               0         (0/0/0)           0<br />
5 unassigned    wm       0               0         (0/0/0)           0<br />
6 unassigned    wm       0               0         (0/0/0)           0<br />
7 unassigned    wm       0               0         (0/0/0)           0<br />
8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065<br />
9 unassigned    wm       0               0         (0/0/0)           0partition&gt; label</code></p>
<p><code>partition&gt; label<br />
Ready to label disk, continue? <strong>Y</strong></code></p>
<p>2. Create solaris file system<br />
<code># newfs /dev/dsk/c1t1d0s2</code></p>
<p>3. Add entry to /etc/vfstab<br />
<code># cat /etc/vfstab<br />
<em>/dev/dsk/c1t1d0s2       /dev/rdsk/c1t1d0s2      /oracle   ufs   -  yes  -</em></code></p>
<p>4. mount the filesystem<br />
<code><em># mkdir /oracle</em><br />
<em># mount /oracle</em></code></p>
<p>5.Change Owner of /oracle<br />
<code><em># chown -R oracle:oinstall /oracle</em></code></p>
<p><strong> </strong></p>
<p><strong>4. iSCSI Configuration</strong></p>
<p><em>Perform the following task  on all Oracle RAC nodes in the cluster</em></p>
<p><em> </em><strong> </strong></p>
<p>In this article, we will be using the Static Config method. We first need to verify that the iSCSI software packages are installed on our servers before we can proceed further.<br />
<code><br />
<em># pkginfo SUNWiscsiu SUNWiscsir<br />
system      SUNWiscsir Sun iSCSI Device Driver (root)</em><br />
<em>system      SUNWiscsiu Sun iSCSI Management Utilities (usr)</em></code></p>
<p>After verifying that the iSCSI software packages are installed to the client machines (soladb1, soladb2) and that the iSCSI Target (Openfiler) is configured, run the following from the client machine to discover all available iSCSI LUNs. Note that the IP address for the Openfiler network storage server is accessed through the private network and located at the address 10.0.0.108</p>
<p>Configure the iSCSI target device to be discovered static by specifying IQN, IP Address and port no:<br />
<code><br />
<em># iscsiadm add static-config iqn.2006-01.com.openfiler:tsn.2fc90b6b9c73,10.0.0.108:3260</em></code></p>
<p>Listing Current Discovery Settings<br />
<code><em># iscsiadm list discovery</em><br />
<em>Discovery:</em><br />
<em> Static: disable</em><br />
<em> Send Targets: disabled</em><br />
<em> iSNS: disabled</em></code></p>
<p>The iSCSI connection is not initiated until the discovery method is enabled. This is enabled using the following command:<strong> </strong></p>
<p><code><em># iscsiadm modify discovery --static enable</em></code></p>
<p>Create the iSCSI device links for the local system. The following command can be used to do this:</p>
<p><code><em># devfsadm -i iscsi</em></code></p>
<p>To verify that the iSCSI devices are available on the node, we will use the <code>format</code> command. The output of the <code>format</code> command should look like the following:</p>
<p><code># format<br />
AVAILABLE DISK SELECTIONS:<br />
0. c1t0d0 &lt;DEFAULT cyl 2607 alt 2 hd 255 sec 63&gt;<br />
/pci@0,0/pci15ad,1976@10/sd@0,0<br />
1. c1t1d0 &lt;DEFAULT cyl 2607 alt 2 hd 255 sec 63&gt;<br />
/pci@0,0/pci15ad,1976@10/sd@1,0<br />
2. c2t3d0 &lt;DEFAULT cyl 508 alt 2 hd 64 sec 32&gt;<br />
/iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,0<br />
3. c2t4d0 &lt;DEFAULT cyl 508 alt 2 hd 64 sec 32&gt;<br />
/iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,1<br />
4. c2t5d0 &lt;DEFAULT cyl 1783 alt 2 hd 255 sec 63&gt;<br />
/iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,2<br />
5. c2t6d0 &lt;DEFAULT cyl 1783 alt 2 hd 255 sec 63&gt;<br />
/iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,3<br />
6. c2t7d0 &lt;DEFAULT cyl 28 alt 2 hd 64 sec 32&gt;<br />
/iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,4<br />
Specify disk (enter its number):</code></p>
<p><strong><br />
</strong></p>
<p><strong>5.  Prepare disk for OCR, Voting and ASM</strong></p>
<p><em>Perform the following task on <strong>one(1)</strong> of the Oracle RAC nodes in the cluster</em></p>
<p><em> </em></p>
<p>Now, we need to create partitions on the iSCSI volumes. The main point is that when formatting the devices to be used for the OCR and the Voting Disk files, the disk slices to be used must skip the first cylinder (cylinder 0) to avoid overwriting the disk VTOC (Volume Table of Contents). The VTOC is a special area of disk set aside for aside for storing information about the disk&#8217;s controller, geometry and slices.</p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="6" width="632" valign="bottom"><strong>Oracle Shared Drive Configuration</strong></td>
</tr>
<tr>
<td width="67"><strong>File System Type</strong></td>
<td width="78"><strong>iSCSI Target<br />
(short) Name</strong></td>
<td width="66"><strong>Size</strong></td>
<td width="150"><strong>Device Name</strong></td>
<td width="54"><strong>ASM Dg Name</strong></td>
<td width="217"><strong>File Types</strong></td>
</tr>
<tr>
<td width="67">RAW</td>
<td width="78">ocr</td>
<td width="66">300 MB</td>
<td width="150">/dev/rdsk/c2t3d0s2</td>
<td width="54"></td>
<td width="217">Oracle Cluster Registry (OCR) File</td>
</tr>
<tr>
<td width="67">RAW</td>
<td width="78">vot</td>
<td width="66">300 MB</td>
<td width="150">/dev/rdsk/c2t4d0s2</td>
<td width="54"></td>
<td width="217">Voting Disk</td>
</tr>
<tr>
<td width="67">RAW</td>
<td width="78">asmspfile</td>
<td width="66">30 MB</td>
<td width="150">/dev/rdsk/c2t7d0s2</td>
<td width="54"></td>
<td width="217">ASM SPFILE</td>
</tr>
<tr>
<td width="67">ASM</td>
<td width="78">asm1</td>
<td width="66">14 GB</td>
<td width="150">/dev/rdsk/c2t5d0s2</td>
<td width="54">DATA</td>
<td width="217">Oracle Database Files</td>
</tr>
<tr>
<td width="67">ASM</td>
<td width="78">asm2</td>
<td width="66">14 GB</td>
<td width="150">/dev/rdsk/c2t6d0s2</td>
<td width="54">ARCH</td>
<td width="217">Oracle Database Files</td>
</tr>
</tbody>
</table>
<p>Perform below operation for all the disk from the solaris1 node only using <strong>format</strong> command.<br />
<code> </code></p>
<pre><em># format</em>
<em>Searching for disks...done</em>
<em> </em>
<em>AVAILABLE DISK SELECTIONS:</em>
<em>       0. c1t0d0 &lt;DEFAULT cyl 2607 alt 2 hd 255 sec 63&gt;</em>
<em>          /pci@0,0/pci15ad,1976@10/sd@0,0</em>
<em>       1. c1t1d0 &lt;DEFAULT cyl 2607 alt 2 hd 255 sec 63&gt;</em>
<em>          /pci@0,0/pci15ad,1976@10/sd@1,0</em>
<em>       2. c2t3d0 &lt;DEFAULT cyl 508 alt 2 hd 64 sec 32&gt;</em>
<em>          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,0</em>
<em>       3. c2t4d0 &lt;DEFAULT cyl 508 alt 2 hd 64 sec 32&gt;</em>
<em>          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,1</em>
<em>       4. c2t5d0 &lt;DEFAULT cyl 1783 alt 2 hd 255 sec 63&gt;</em>
<em>          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,2</em>
<em>       5. c2t6d0 &lt;DEFAULT cyl 1783 alt 2 hd 255 sec 63&gt;</em>
<em>          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,3</em>
<em>       6. c2t7d0 &lt;DEFAULT cyl 28 alt 2 hd 64 sec 32&gt;</em>
<em>          /iscsi/disk@0000iqn.2006-01.com.openfiler%3Atsn.0db3c7c0efb1FFFF,4</em>
<em>Specify disk (enter its number): 2</em>
<em>selecting c2t3d0</em>
<em>[disk formatted]</em>
<em> </em>
<em>FORMAT MENU:</em>
<em>        disk       - select a disk</em>
<em>        type       - select (define) a disk type</em>
<em>        partition  - select (define) a partition table</em>
<em>        current    - describe the current disk</em>
<em>        format     - format and analyze the disk</em>
<em>        fdisk      - run the fdisk program</em>
<em>        repair     - repair a defective sector</em>
<em>        label      - write label to the disk</em>
<em>        analyze    - surface analysis</em>
<em>        defect     - defect list management</em>
<em>        backup     - search for backup labels</em>
<em>        verify     - read and display labels</em>
<em>        save       - save new disk/partition definitions</em>
<em>        inquiry    - show vendor, product and revision</em>
<em>        volname    - set 8-character volume name</em>
<em>        !&lt;cmd&gt;     - execute &lt;cmd&gt;, then return</em>
<em>        quit</em>
<em> </em>
<em>format&gt; partition</em>
<em>Please run fdisk first</em>
<em>format&gt; fdisk</em>
<em>No fdisk table exists. The default partition for the disk is:</em>
<em> </em>
<em>   a 100% "SOLARIS system" partition</em>
<em> </em>
<em>Type "y" to accept the default partition, otherwise type "n" to edit the partition table.</em>
<strong><em>y</em></strong>
<em>format&gt; partition</em>
<em>PARTITION MENU:</em>
<em>        0      - change `0' partition</em>
<em>        1      - change `1' partition</em>
<em>        2      - change `2' partition</em>
<em>        3      - change `3' partition</em>
<em>        4      - change `4' partition</em>
<em>        5      - change `5' partition</em>
<em>        6      - change `6' partition</em>
<em>        7      - change `7' partition</em>
<em>        select - select a predefined table</em>
<em>        modify - modify a predefined partition table</em>
<em>        name   - name the current table</em>
<em>        print  - display the current table</em>
<em>        label  - write partition map and label to the disk</em>
<em>        !&lt;cmd&gt; - execute &lt;cmd&gt;, then return</em>
<em>        quit</em>
<em> </em>
<em>partition&gt; print</em>
<em>Current partition table (unnamed):</em>
<em>Total disk cylinders available: 508 + 2 (reserved cylinders)</em>
<em> </em>
<em>Part      Tag    Flag     Cylinders       Size            Blocks</em>
<em>  0 unassigned    wm       0              0         (0/0/0)         0</em>
<em>  1 unassigned    wm       0              0         (0/0/0)         0</em>
<em>  2     backup    wu       0 - 507      508.00MB    (508/0/0) 1040384</em>
<em>  3 unassigned    wm       0              0         (0/0/0)         0</em>
<em>  4 unassigned    wm       0              0         (0/0/0)         0</em>
<em>  5 unassigned    wm       0              0         (0/0/0)         0</em>
<em>  6 unassigned    wm       0              0         (0/0/0)         0</em>
<em>  7 unassigned    wm       0              0         (0/0/0)         0</em>
<em>  8       boot    wu       0 -   0        1.00MB    (1/0/0)      2048</em>
<em>  9 unassigned    wm       0              0         (0/0/0)         0</em>
<em> </em>
<em>partition&gt; 2</em>
<em>Part      Tag    Flag     Cylinders       Size            Blocks</em>
<em>  2 unassigned    wm       0 - 507      508.00MB    (508/0/0) 1040384</em>
<em> </em>
<em>Enter partition id tag[backup]: 

Enter partition permission flags[wm]:</em>
<em>Enter new starting cyl[0]: 5</em>
<em>Enter partition size[0b, 0c, 3e, 0.00mb, 0.00gb]: $</em>
<em>partition&gt; label</em>
<em>Ready to label disk, continue? y</em>
<em> </em>
<em>partition&gt; quit</em>

Repeat this operation for all the iSCSI disk.</pre>
<p><strong>Setting Device Permissions</strong></p>
<p><strong> </strong>The devices we will be using for the various components of this article (e.g. the OCR and the voting disk) must have the appropriate ownership and permissions set on them before we can proceed to the installation stage. We will the set the permissions and ownerships using the chown and chmod commands as follows: (this must be done as the root user)</p>
<p><code><em># chown root:oinstall </em><em>/dev/rdsk/c2t3d0s2</em><em><br />
# chmod 660 /dev/rdsk/c2t1d0s1<br />
# chown oracle:oinstall </em><em>/dev/rdsk/c2t4d0s2</em><em><br />
# chmod 660 </em><em>/dev/rdsk/c2t4d0s2</em><em><br />
# chown oracle: oinstall </em><em>/dev/rdsk/c2t7d0s2</em><em><br />
# chown oracle: oinstall </em><em>/dev/rdsk/c2t5d0s2</em><em><br />
# chown oracle: oinstall </em><em>/dev/rdsk/c2t6d0s2</em></code></p>
<p>These permissions will be persistent accross reboots. No further configuration needs to be performed with the permissions. <strong> </strong><br />
<strong> </strong></p>
<h3>6. Setting Kernel Parameters</h3>
<p>In Solaris 10, there is a new way of setting kernel parameters. The old Solaris 8 and 9 way of setting kernel parameters by editing the /etc/system file is deprecated. A new method of setting kernel parameters exists in Solaris 10 using the resource control facility and this method does not require the system to be re-booted for the change to take effect.</p>
<p>Create a default project for the oracle user.<br />
<code><em># projadd -U oracle -K "project.max-shm-memory=(priv,4096MB,deny)" user.oracle</em></code></p>
<p><em> </em><br />
Modify the max-shm-memory Parameter<br />
<code><em># projmod -s -K "project.max-shm-memory=(priv,4096MB,deny)" user.oracle</em></code></p>
<p><strong> </strong></p>
<p>Modify the max-sem-ids Parameter<br />
<code><em># projmod -s -K "project.max-sem-ids=(priv,256,deny)" user.oracle</em></code></p>
<p>Check the Parameters as User oracle<br />
<code><em>$ prctl -i project user.oracle</em></code></p>
<p><strong>Configure RAC Nodes for Remote Access<br />
</strong><em>Perform the following configuration procedures on both Oracle RAC nodes in the cluster.</em></p>
<p>Before you can install and use Oracle RAC, you must configure either secure shell (SSH) or remote shell (RSH) for the oracle user account both of the Oracle RAC nodes in the cluster. The goal here is to setup user equivalence for the oracle user account. User equivalence enables the oracle user account to access all other nodes in the cluster without the need for a password. This can be configured using either SSH or RSH where SSH is the preferred method.<br />
Perform below operation as User oracle to setup RSH between all nodes.</p>
<p><code><em># su – oracle</em><br />
<em>$ cd</em><br />
<em>$ vi .rhosts</em><br />
<em>+</em></code></p>
<p><strong>7. Check and install required package </strong></p>
<p><em>Perform the following checks on all Oracle RAC nodes in the cluster</em></p>
<p><em> </em></p>
<p>The following packages must be installed on each server before you can continue. To check whether any of these required packages are installed on your system, use the <code>pkginfo -i </code>command as follows:<br />
<code><em># pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibmr SUNWlibm SUNWsprot SUNWtoo SUNWi1of SUNWi1cs SUNWi15cs SUNWxwfnt SUNWxwplt SUNWmfrun SUNWxwplr SUNWxwdv SUNWbinutils  SUNWgcc SUNWuiu8 </em></code></p>
<p>If you need to install any of the above packages, use the pkgadd –d  command. E.g.<br />
<code><em># pkgadd -d /cdrom/sol_10_1009_x86/Solaris_10/Product -s /var/spool/pkg SUNWi15cs</em><br />
<em># pkgadd SUNWi15cs</em></code></p>
<p><strong>8. Installing Oracle Clusterware<br />
</strong><em>Perform the following installation procedures from only one of the Oracle RAC nodes in the cluster (soladb1). The Oracle Clusterware software will be installed to both of the Oracle RAC nodes in the cluster by the OUI.</em> <strong> </strong></p>
<p>Using xstart or any xterm client, login as Oracle user and start the installation.</p>
<p><em>$ ./runInstaller.sh</em></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><strong>Screen Name</strong></td>
<td><strong>Response</strong></td>
</tr>
<tr>
<td><strong>Welcome Screen</strong></td>
<td>Click Next</td>
</tr>
<tr>
<td><strong>Specify   Inventory directory and credentials</strong></td>
<td>Accept the   default values:<br />
<strong>Inventory directory:</strong> /oracle/oraInventory<br />
<strong>Operating System group name:</strong> oinstall</td>
</tr>
<tr>
<td><strong>Specify Home   Details</strong></td>
<td>Set the <em>Name</em> and <em>Path</em> for the ORACLE_HOME (actually the $ORA_CRS_HOME that I will   be using in this article) as follows:<br />
<strong>Name:</strong> OraCrs10g_home<br />
<strong>Path:</strong> /oracle/product/10.2.0/crs_1</td>
</tr>
<tr>
<td><strong>Product-Specific   Prerequisite Checks</strong></td>
<td>The installer   will run through a series of checks to determine if the node meets the   minimum requirements for installing and configuring the Oracle Clusterware   software. If any of the checks fail, you will need to manually verify the   check that failed by clicking on the checkbox. For my installation, all   checks passed with no problems.</p>
<p>Click   Next to continue.</td>
</tr>
<tr>
<td><strong>Specify Cluster   Configuration</strong></td>
<td><strong>Cluster Name:</strong> crs</p>
<table border="1" cellspacing="1" cellpadding="0" width="100%">
<tbody>
<tr>
<td><strong>Public     Node Name</strong></td>
<td><strong>Private     Node Name</strong></td>
<td><strong>Virtual     Node Name</strong></td>
</tr>
<tr>
<td>soladb1</td>
<td>soladb1-priv</td>
<td>soladb1-vip</td>
</tr>
<tr>
<td>soladb2</td>
<td>soladb2-priv</td>
<td>soladb2-vip</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td><strong>Specify Network   Interface Usage</strong></td>
<td>
<table border="1" cellspacing="1" cellpadding="0" width="100%">
<tbody>
<tr>
<td><strong>Interface     Name</strong></td>
<td><strong>Subnet</strong></td>
<td><strong>Interface     Type</strong></td>
</tr>
<tr>
<td>e1000g0</td>
<td>192.168.2.0</td>
<td>Public</td>
</tr>
<tr>
<td>e1000g1</td>
<td>10.0.0.0</td>
<td>Private</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td><strong>Specify OCR   Location</strong></td>
<td>Starting with   Oracle Database 10<em>g</em> Release 2 (10.2) with RAC, Oracle Clusterware   provides for the creation of a mirrored OCR file, enhancing cluster   reliability. For the purpose of this example, I did not choose to mirror the   OCR file by using the option of &#8220;External Redundancy&#8221;:</p>
<p><strong>Specify   OCR Location:</strong> /dev/rdsk/c2t3d0s2</td>
</tr>
<tr>
<td><strong>Specify Voting   Disk Location</strong></td>
<td>For the purpose   of this example, I did not choose to mirror the voting disk by using the   option of &#8220;External Redundancy&#8221;:</p>
<p><strong>Voting   Disk Location:</strong> /dev/rdsk/c2t4d0s2</td>
</tr>
<tr>
<td><strong>Summary</strong></td>
<td>Click   Install to start the installation!</td>
</tr>
<tr>
<td><strong>Execute   Configuration Scripts</strong></td>
<td>After the   installation has completed, you will be prompted to run the orainstRoot.sh   and root.sh script. Open a new console window on both Oracle RAC nodes in the   cluster, (starting with the node you are performing the install from), as the   &#8220;root&#8221; user account.</p>
<p>Navigate   to the / oracle/oraInventory directory and run orainstRoot.sh <strong>ON ALL NODES</strong> in the RAC cluster.</p>
<hr size="2" />Within   the same new console window on both Oracle RAC nodes in the cluster,   (starting with the node you are performing the install from), stay logged in   as the &#8220;root&#8221; user account.</p>
<p>Navigate   to the /oracle/product/10.2.0/crs_1 directory and locate the root.sh file for   each node in the cluster &#8211; (starting with the node you are performing the   install from). Run the root.sh file <strong>ON ALL NODES</strong> in the RAC cluster <strong>ONE   AT A TIME</strong>.</p>
<p>You   will receive several warnings while running the root.sh script on all nodes.   These warnings can be safely ignored.</p>
<p>The   root.sh may take awhile to run.</p>
<p>Go   back to the OUI and acknowledge the &#8220;Execute Configuration scripts&#8221;   dialog window after running the root.sh script on both nodes.</td>
</tr>
<tr>
<td><strong>End of   installation</strong></td>
<td>At the end of   the installation, exit from the OUI.</td>
</tr>
</tbody>
</table>
<p>After successfully install Oracle 10g Clusterware (10.2.0.1), start the OUI for patching the clusteware with the latest patch available (10.2.0.5). We can refer back above step for the patching activity.</p>
<h3>Verify Oracle Clusterware Installation</h3>
<p>After the installation of Oracle Clusterware, we can run through several tests to verify the install was successful. Run the following commands on both nodes in the RAC Cluster</p>
<p><code><em>$ ./oracle/product/10.2.0/crs_1/bin/olsnodes</em><br />
<em>soladb1</em><br />
<em>soladb2</em><br />
<em> </em></code></p>
<p><code><em>$ ./oracle/product/10.2.0/crs_1/bin/crs_stat –t<br />
Name           Type           Target    State     Host<br />
------------------------------------------------------------</em><br />
<em>ora....db1.gsd application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db1.ons application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db1.vip application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db2.gsd application    ONLINE    ONLINE    soladb2</em><br />
<em>ora....db2.ons application    ONLINE    ONLINE    soladb2</em><br />
<em>ora....db2.vip application    ONLINE    ONLINE    soladb2</em></code></p>
<p><strong>9.  Installing Oracle Database 10g Software<br />
</strong><em>Perform the following installation procedures from only one of the Oracle RAC nodes in the cluster (</em>soladb1<em>). The Oracle Database software will be installed to both of the Oracle RAC nodes in the cluster by the OUI.</em><strong> </strong></p>
<p>Using xstart or any xterm client, login as Oracle user and start the installation.</p>
<p>$ ./runInstaller.sh</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><strong>Screen Name</strong></td>
<td><strong>Response</strong></td>
</tr>
<tr>
<td><strong>Welcome Screen</strong></td>
<td>Click Next</td>
</tr>
<tr>
<td><strong>Select Installation Type</strong></td>
<td>Select the Enterprise Edition   option.</td>
</tr>
<tr>
<td><strong>Specify Home Details</strong></td>
<td>Set the <em>Name</em> and <em>Path</em> for the ORACLE_HOME as follows:<br />
<strong>Name:</strong> OraDb10g_home1<br />
<strong>Path:</strong> /oracle/product/10.2.0/db_1</td>
</tr>
<tr>
<td><strong>Specify Hardware Cluster   Installation Mode</strong></td>
<td>Select the Cluster Installation   option then select all nodes available. Click Select All to select all   servers: soladb1 and soladb2.</p>
<p>If the   installation stops here and the status of any of the RAC nodes is &#8220;Node   not reachable&#8221;, perform the following checks:</p>
<ul>
<li>Ensure Oracle Clusterware is        running on the node in question. (crs_stat –t)</li>
<li>Ensure you are table to reach        the node in question from the node you are performing the installation        from.</li>
</ul>
</td>
</tr>
<tr>
<td><strong>Product-Specific Prerequisite Checks</strong></td>
<td>The installer will run through a   series of checks to determine if the node meets the minimum requirements for   installing and configuring the Oracle database software. If any of the checks   fail, you will need to manually verify the check that failed by clicking on   the checkbox.</p>
<p>If you did not   run the OUI with the ignoreSysPrereqs option then the Kernel parameters   prerequisite check will fail. This is because the OUI is looking at the   /etc/system file to check the kernel parameters. As we discussed earlier,   this file is not used by default in Solaris 10. This is documented in   Metalink Note 363436.1.</p>
<p>Click Next to   continue.</td>
</tr>
<tr>
<td><strong>Select Database Configuration</strong></td>
<td>Select the option to &#8220;Install   database software only.&#8221;</p>
<p>Remember that   we will create the clustered database as a separate step using DBCA.</td>
</tr>
<tr>
<td><strong>Summary</strong></td>
<td>Click on   Install to start the installation!</td>
</tr>
<tr>
<td><strong>Root Script Window &#8211; Run root.sh</strong></td>
<td>After the installation has   completed, you will be prompted to run the root.sh script. It is important to   keep in mind that the root.sh script will need to be run <strong>on all nodes</strong> in the RAC cluster <strong>one at a time</strong> starting with the node you are   running the database installation from.</p>
<p>First, open a   new console window on the node you are installing the Oracle 10<em>g</em> database software from as the root user account. For me, this was solaris1.</p>
<p>Navigate to the   /oracle/product/10.2.0/db_1 directory and run root.sh.</p>
<p>After running   the root.sh script on all nodes in the cluster, go back to the OUI and   acknowledge the &#8220;Execute Configuration scripts&#8221; dialog window.</td>
</tr>
<tr>
<td><strong>End of installation</strong></td>
<td>At the end of the installation, exit   from the OUI.</td>
</tr>
</tbody>
</table>
<p>After successfully install Oracle Database 10g (10.2.0.1), start the OUI for patching the database with the latest patch available (10.2.0.5). We can refer back above step for the patching activity.</p>
<p><strong>Run the Network Configuration Assistant<br />
</strong>To start NETCA, run the following:<br />
<code><em>$ netca </em></code></p>
<p>The following table walks you through the process of creating a new Oracle listener for our RAC environment. <strong> </strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><strong>Screen Name</strong></td>
<td><strong>Response</strong></td>
</tr>
<tr>
<td><strong>Select the Type of Oracle<br />
Net Services Configuration</strong></td>
<td>Select Cluster Configuration</td>
</tr>
<tr>
<td><strong>Select the nodes to configure</strong></td>
<td>Select all of the nodes: soladb1 and   soladb2.</td>
</tr>
<tr>
<td><strong>Type of Configuration</strong></td>
<td>Select Listener configuration.</td>
</tr>
<tr>
<td><strong>Listener Configuration &#8211; Next 6   Screens</strong></td>
<td>The following screens are now like   any other normal listener configuration. You can simply accept the default   parameters for the next six screens:<br />
<strong>What do you want to do:</strong> Add<br />
<strong>Listener name:</strong> LISTENER<br />
<strong>Selected protocols:</strong> TCP<br />
<strong>Port number:</strong> 1521<br />
<strong>Configure another listener:</strong> No<br />
<strong>Listener configuration complete!</strong> [ Next ]<br />
You will be returned to this Welcome (Type of Configuration) Screen.</td>
</tr>
<tr>
<td><strong>Type of Configuration</strong></td>
<td>Select Naming Methods configuration.</td>
</tr>
<tr>
<td><strong>Naming Methods Configuration</strong></td>
<td>The following screens are:<br />
<strong>Selected Naming Methods:</strong> Local Naming<br />
<strong>Naming Methods configuration complete!</strong> [ Next ]<br />
You will be returned to this Welcome (Type of Configuration) Screen.</td>
</tr>
<tr>
<td><strong>Type of Configuration</strong></td>
<td>Click Finish to exit the NETCA.</td>
</tr>
</tbody>
</table>
<p>The Oracle TNS listener process should now be running on all nodes in the RAC cluster.</p>
<p><code><em>$ crs_stat –t<br />
Name           Type           Target    State     Host</em><br />
<em>------------------------------------------------------------</em><br />
<strong><em>ora....B1.lsnr application    ONLINE    ONLINE    soladb1</em></strong><br />
<em>ora....db1.gsd application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db1.ons application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db1.vip application    ONLINE    ONLINE    soladb1</em><br />
<strong><em>ora....B2.lsnr application    ONLINE    ONLINE    soladb2</em></strong><br />
<em>ora....db2.gsd application    ONLINE    ONLINE    soladb2</em><br />
<em>ora....db2.ons application    ONLINE    ONLINE    soladb2</em><br />
<em>ora....db2.vip application    ONLINE    ONLINE    soladb2</em></code></p>
<p><strong>10. Create ASM instance and ASM diskgroup<br />
</strong><br />
To start the ASM instance creation process, run the following command on any nodes of the Oracle 10g RAC cluster as oracle user.</p>
<p>$ dbca</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><strong>Screen Name</strong></td>
<td><strong>Response</strong></td>
</tr>
<tr>
<td><strong>Welcome Screen</strong></td>
<td>Select &#8220;Oracle Real Application   Clusters database.&#8221;</td>
</tr>
<tr>
<td><strong>Operations</strong></td>
<td>Select <strong>Configure Automatic   Storage Management</strong></td>
</tr>
<tr>
<td><strong>Node Selection</strong></td>
<td>Click on the <strong>Select All</strong> button to select all servers: soladb1 and soladb2.</td>
</tr>
<tr>
<td><strong>Create ASM Instance</strong></td>
<td>Supply the SYS password to use for   the new ASM instance.</p>
<p>Also, starting   with Oracle 10<em>g</em> Release 2, the ASM instance server parameter file   (SPFILE) needs to be on a shared disk. You will need to modify the default   entry for &#8220;Create server parameter file (SPFILE)&#8221; to reside on the   RAW partition as follows: /dev/rdsk/c2t7d0s2. All other options can stay at   their defaults.</p>
<p>You will then   be prompted with a dialog box asking if you want to create and start the ASM   instance. Select the <strong>OK</strong> button to acknowledge this dialog.</p>
<p>The OUI will   now create and start the ASM instance on all nodes in the RAC cluster.</td>
</tr>
<tr>
<td><strong>ASM Disk Groups</strong></td>
<td>To start, click   the <strong>Create New</strong> button. This will bring up the &#8220;Create Disk   Group&#8221; window with the three of the partitions we created earlier. If   you didn’t see any disk, click the <strong>Change   Disk Discovery Path</strong> button and enter <strong>/dev/rdsk/*</strong></p>
<p>For the first   &#8220;Disk Group Name&#8221;, I used the string &#8220;DATA&#8221;. Select the   first RAW partitions (in my case /dev/rdsk/c2t5d0s2) in the &#8220;Select   Member Disks&#8221; window. Keep the &#8220;Redundancy&#8221; setting to &#8220;External&#8221;.</p>
<p>After verifying   all values in this window are correct, click the <strong>[OK]</strong> button. This   will present the &#8220;ASM Disk Group Creation&#8221; dialog. When the ASM   Disk Group Creation process is finished, you will be returned to the   &#8220;ASM Disk Groups&#8221; windows.</p>
<p>Click the <strong>Create   New</strong> button again. For the second &#8220;Disk Group Name&#8221;, I used the   string &#8220;ARCH&#8221;. Select the last RAW partition (/dev/rdsk/c2t6d0s2)   in the &#8220;Select Member Disks&#8221; window. Keep the &#8220;Redundancy&#8221;   setting to &#8220;External&#8221;.</p>
<p>After verifying   all values in this window are correct, click the <strong>[OK]</strong> button. This   will present the &#8220;ASM Disk Group Creation&#8221; dialog.</p>
<p>When the ASM   Disk Group Creation process is finished, you will be returned to the   &#8220;ASM Disk Groups&#8221; window with two disk groups created and selected.</td>
</tr>
<tr>
<td><strong>End of ASM Instance creation</strong></td>
<td>Click the Finish button to complete   the ASM instance creation.</td>
</tr>
</tbody>
</table>
<p>The Oracle ASM instance process should now be running on all nodes in the RAC cluster.</p>
<p><code><em>$ crs_stat –t</em><br />
<em>Name           Type           Target    State     Host</em><br />
<em>------------------------------------------------------------</em><br />
<strong><em>ora....SM1.asm application    ONLINE    ONLINE    soladb1</em></strong><br />
<em>ora....B1.lsnr application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db1.gsd application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db1.ons application    ONLINE    ONLINE    soladb1</em><br />
<em>ora....db1.vip application    ONLINE    ONLINE    soladb1</em><br />
<strong><em>ora....SM2.asm application    ONLINE    ONLINE    soladb2</em></strong><br />
<em>ora....B2.lsnr application    ONLINE    ONLINE    soladb2</em><br />
<em>ora....db2.gsd application    ONLINE    ONLINE    soladb2</em><br />
<em>ora....db2.ons application    ONLINE    ONLINE    soladb2</em><br />
<em>ora....db2.vip application    ONLINE    ONLINE    soladb2</em></code></p>
<p>The last step is to create Oracle 10g Database using dbca.<br />
Good luck.</p>
<p>By Hafiz Abdullah @ arPz</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=67&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2010/07/26/simple-guide-on-installing-2-nodes-oracle-10g-rac-on-solaris-10-64bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9f6e5eefd69f67e7b33cec9fbfdd2100?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mhafiz12</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle Streams</title>
		<link>http://oracleinnotiive.wordpress.com/2010/07/25/oracle-streams/</link>
		<comments>http://oracleinnotiive.wordpress.com/2010/07/25/oracle-streams/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 17:05:07 +0000</pubDate>
		<dc:creator>ilanggoh</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[streams]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=62</guid>
		<description><![CDATA[Whats is Oracle Streams? It enables data movement : Within an Oracle database Between 2 Oracle databases Among multiple Oracle &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2010/07/25/oracle-streams/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=62&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Whats is Oracle Streams?</p>
<p>It enables data movement :</p>
<ul>
<li>Within an Oracle database</li>
<li>Between 2 Oracle databases</li>
<li>Among multiple Oracle databases</li>
<li>Between an Oracle database and non-Oracle database</li>
</ul>
<p>How it works?</p>
<p>It begins by capturing the changes (database changes or schema changes or table changes). The changes which will be available in redo log files captured by stream process and formatted as Logical Change Record (LCR). The LCR will be staged and propagated to destination where it will be applied eventually.</p>
<p>Here I’ve shown a simple unidirectional schema level streams between 2 Oracle databases (source and destination database):</p>
<ol>
<li>Create Streamsadmin user at both source and destination DB :</li>
</ol>
<p>CREATE USER streamsadmin;</p>
<p>GRANT DBA TO streamsadmin;</p>
<p>BEGIN</p>
<p>DBMS_STREAMS_AUTH.GRANT_ADMIN_PRIVILEGE(grantee =&gt; &#8216;streamsadmin&#8217;,grant_privileges =&gt; true);END;</p>
<ol>
<li>Create database link at source destination  as streamsadmin user:</li>
</ol>
<p>CREATE DATABASE LINK  connect to streamsadmin identified by streamsadmin using &#8221;;</p>
<ol>
<li>Add supplemental logging :</li>
</ol>
<p>BEGIN DBMS_CAPTURE_ADM.PREPARE_SCHEMA_INSTANTIATION(schema_name =&gt;&lt;shema_name&gt;,</p>
<p>supplemental_logging =&gt; &#8216;all&#8217;);END;</p>
<ol>
<li>Create 2 queue’s with name like capture queue ( to capture changes at source database) and apply queue (to apply the changes at destination database) with below syntax :</li>
</ol>
<p>BEGIN DBMS_CAPTURE_ADM.SET_UP_QUEUE(  queue_table =&gt; queue_table_name, queue_name  =&gt; &#8216;Capture or Apply Queue&#8217;,  queue_user  =&gt; &#8216;streamsadmin&#8217;);end;</p>
<ol>
<li>Create 2 rules with name like capture rules ( to configure capture processes for changes made to source database) and apply rules ( to configure apply process to apply changes from destination database) :</li>
</ol>
<p>BEGIN  DBMS_STREAMS_ADM.ADD_GLOBAL_RULES( streams_type =&gt; &#8216;apply OR capture&#8217;,streams_name=&gt; &#8216;&lt;stream_name&gt;&#8217;,  queue_name=&gt;&#8217;&lt;queue_name&gt;&#8217;include_dml =&gt; true, include_ddl =&gt; true, source_database=&gt; &#8216;&lt;db_name&gt;&#8217;,inclusion_rule     =&gt; true);END;</p>
<ol>
<li>Create propagation process at source database :</li>
</ol>
<p>BEGIN DBMS_STREAMS_ADM.ADD_GLOBAL_PROPAGATION_RULES(</p>
<p>streams_name           =&gt; &lt;stream_name, source_queue_name      =&gt; &#8216;&lt;capture_queue_name&gt;&#8217;,</p>
<p>destination_queue_name =&gt; &#8216;&lt;apply_queue_name@db_link&gt;&#8217;, include_dml =&gt; true, include_ddl =&gt; true,</p>
<p>source_database        =&gt; &#8216;&lt;source_db_name&gt;&#8217;, inclusion_rule =&gt; true,queue_to_queue =&gt; true );END;</p>
<ol>
<li>Schema instantiation at source database :</li>
</ol>
<p>BEGIN DBMS_CAPTURE_ADM.SET_GLOBAL_INSTANTIATION_SCN(source_database_name =&gt;&#8217;&lt;source_db_name&gt;&#8217;,instantiation_scn =&gt;SCN_NO,recursive =&gt; true);end;</p>
<ol>
<li>Starting the capture (at source database )and apply (at destination database) process:</li>
</ol>
<p>BEGIN DBMS_CAPTURE_ADM.START_CAPTURE (capture_name =&gt; ‘&lt;capture_queue_name&gt;’);end;</p>
<p>BEGIN DBMS_CAPTURE_ADM.SET_PARAMETER (apply_name =&gt; &#8216;&lt;apply_queue_name&gt;&#8217;, parameter =&gt; &#8216;disable_on_error&#8217;,value =&gt; &#8216;N&#8217;);end;</p>
<p>You can test the streams by insert,update and delete data from any of the table belong’s to the schema where streams configured. When you query from the destination database, you should be able to see the same data as it is in source database.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=62&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2010/07/25/oracle-streams/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff9b4a989dbaeac652e1f6f3bb6558df?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ilanggoh</media:title>
		</media:content>
	</item>
		<item>
		<title>Undo error</title>
		<link>http://oracleinnotiive.wordpress.com/2010/07/13/undo-error/</link>
		<comments>http://oracleinnotiive.wordpress.com/2010/07/13/undo-error/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 08:13:59 +0000</pubDate>
		<dc:creator>niradj</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[undo]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=58</guid>
		<description><![CDATA[How do I offline my current undo tablespace? Wait, why can I even do this?! Even in previous versions of &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2010/07/13/undo-error/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=58&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How do I offline my current undo tablespace? Wait, why can I even do this?!</p>
<p>Even in previous versions of the Oracle database, it has always been impossible to offline the <strong>current</strong> undo tablespace (doing so will result in the ORA-30042 error as shown in the listing below), which makes a lot of sense, for many reasons. The undo tablespace in Oracle is vital to enable rollback operations in the database, which anyone with experience of human errors will tell you is inevitable, no matter how well-designed an application will be. Without an undo tablespace that is usable and valid, even if you were able to use the database normally, all DML or DDL operations (changes to the database) would not be reversible. In the interests of data integrity, this is not allowed to happen.</p>
<p>Listing 1: Offline current undo tablespace</p>
<p><strong>SQL&gt; alter tablespace undotest offline;<br />
alter tablespace undotest offline<br />
ERROR at line 1:<br />
ORA-30042: Cannot offline the undo tablespace</strong></p>
<p><strong> </strong></p>
<p>So what&#8217;s the problem here, since Oracle clearly doesn&#8217;t allow us to offline current undo tablespaces, everything&#8217;s fine, yes? The answer is well, not exactly. You see, despite not being to offline the tablespace itself, if someone was (for whatever reason) determined enough, they could first find the datafile belonging to the UNDO tablespace, and then offline the <strong>datafile</strong> itself (Listing 2).</p>
<p>Listing 2: Offline current undo tablespace&#8217;s datafile</p>
<p><strong>SQL&gt; select file_name from dba_data_files where tablespace_name=&#8217;UNDOTEST&#8217;;<br />
FILE_NAME<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;+SYSTEM/testrac/datafile/undotest.268.724126811</p>
<p>SQL&gt; alter database datafile &#8216;+SYSTEM/testrac/datafile/undotest.268.724126811&#8242; offline;</p>
<p>alter database datafile &#8216;+SYSTEM/testrac/datafile/undotest.268.724126811&#8242; offline*<br />
ERROR at line 1:<br />
ORA-00603: ORACLE server session terminated by fatal error</strong></p>
<p>All of which looks rather serious, and if you were to login to the database again, and query the database, you would see something as below. To complete the test, we could also attempt both a simple DDL by creating a table, and a simple select statement (Listing 3)</p>
<p>Listing 3: DDL with offline undo tablespace datafile</p>
<p><strong>SQL&gt; select file_name, status, online_status from dba_data_files where tablespace_name=&#8217;UNDOTEST&#8217;;</strong></p>
<p><strong> </strong></p>
<p><strong>FILE_NAME                                                                            STATUS                 ONLINE_STATUS<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;-+SYSTEM/testrac/datafile/undotest.268.724126811                AVAILABLE            RECOVER</strong></p>
<p><strong> </strong></p>
<p><strong>SQL&gt; create table t1 as select * from dba_users;<br />
create table t1 as select * from dba_users<br />
* ERROR at line 1:<br />
ORA-00604: error occurred at recursive SQL level 1<br />
ORA-00376: file 6 cannot be read at this time<br />
ORA-01110: data file 6: &#8216;+SYSTEM/testrac/datafile/undotest.268.724126811&#8242;</strong></p>
<p><strong> </strong></p>
<p><strong>SQL&gt; select tname from tab where rownum  &lt; 2;<br />
TNAME<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
ACCESS$</strong></p>
<p><strong><br />
</strong>So clearly, the undo tablespace isn&#8217;t usable, and this will need to be resolved first before we can carry out normal database DDL or DML operations. A quick datafile recovery (Listing 5, which involves downtime, using a forced instance shutdown), and everything&#8217;s back to normal.</p>
<p>Now, while there is probably no reason anyone would intentionally want to offline their current undo tablespace in a normal read-write Oracle database, as mentioned before, it is always wise never to underestimate the scope of potential human error. As of Oracle 11g Release 2, you will now be greeted with additional error messages clearly stating the cause of the database failure. (Listing 4). There is now no longer any doubt if you have indeed offlined the current undo tablespace&#8217;s datafile (a possible scenario especially with the OMF functionality), and you can immediately start recovery procedures.</p>
<p>Listing 4 (Oracle 11g additional error messages)</p>
<p><strong>ERROR at line 1:<br />
ORA-00603: ORACLE server session terminated by fatal error<br />
ORA-00376: file 3 cannot be read at this time<br />
ORA-01110: data file 3: &#8216;/u02/app/oracle/oradata/grid11g/undotbs01.dbf&#8217;<br />
ORA-00376: file 3 cannot be read at this time<br />
ORA-01110: data file 3: &#8216;/u02/app/oracle/oradata/grid11g/undotbs01.dbf&#8217;<br />
ORA-00376: file 3 cannot be read at this time<br />
ORA-01110: data file 3: &#8216;/u02/app/oracle/oradata/grid11g/undotbs01.dbf&#8217;<br />
ORA-00376: file 3 cannot be read at this time<br />
ORA-01110: data file 3: &#8216;/u02/app/oracle/oradata/grid11g/undotbs01.dbf&#8217;<br />
Process ID: 5604<br />
Session ID: 1 Serial number: 3</strong></p>
<p><strong> </strong></p>
<p>Listing 5 (Performing a recovery after previous errors)</p>
<p><strong>SQL&gt; startup mount<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;        output deleted for brevity</p>
<p>SQL&gt; recover datafile &#8216;/u02/app/oracle/oradata/grid11g/undotbs01.dbf&#8217;;<br />
Media recovery complete.</strong></p>
<p><strong>SQL&gt;  alter database datafile &#8216;/u02/app/oracle/oradata/grid11g/undotbs01.dbf&#8217; online;<br />
Database altered.</p>
<p>SQL&gt;  alter database open;<br />
Database altered.</strong></p>
<p>As of the current release (11.2.0.1), it is still possible to intentionally do this, though you would think Oracle would be smart enough to stop you. Well, there&#8217;s always the next release, I suppose.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=58&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2010/07/13/undo-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/feab28045f7340df821f3da534760a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">niradj</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle 10g &#8211; Fine Grained Auditing</title>
		<link>http://oracleinnotiive.wordpress.com/2010/03/04/oracle-10g-fine-grained-auditing/</link>
		<comments>http://oracleinnotiive.wordpress.com/2010/03/04/oracle-10g-fine-grained-auditing/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 16:05:30 +0000</pubDate>
		<dc:creator>oracleinnotiive</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[fga]]></category>
		<category><![CDATA[oracle 10g]]></category>

		<guid isPermaLink="false">http://oracleinnotiive.wordpress.com/?p=54</guid>
		<description><![CDATA[Introduction Auditing has always been the most talked about topic amongst users of Oracle database. It is a method to &#8230;<p><a href="http://oracleinnotiive.wordpress.com/2010/03/04/oracle-10g-fine-grained-auditing/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=54&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>Auditing has always been the most talked about topic amongst users of Oracle database. It is a method to safeguard the database systems against fraudulent or unauthorized usage. One way is to restrict user privileges ,but Auditing implements strong system security by maintaining records of system activities and holding users accountable for their action.<br />
Auditing may find its application in investigating suspicious activities or monitoring of database activities to identify peak usage, frequent database activities and unusual behavior of database objects like packages/procedures. Let’s say you want to monitor users who frequently log into the database or you want to monitor and control the DML, DDL activities done on any or all schema tables, then you are actually in need of an audit trail on specific users or objects.<br />
Consider the example of an OLTP system, where few customers are getting huge invoice generated against their monthly mobile usage. And you find that someone is tampering with the values in Acc_Bill_details table that records customer billing information. In this case, audit can be placed on all the DML (Insert, Update, Delete, and Select) activities done on table Acc_Bill_details.</p>
<p><strong>Types of Auditing</strong></p>
<p>Administrators can configure systems to audit any object, privilege, or type of statement. Infact the database can audit individual SQL statements. Audit records show details like the username, session and terminal id, timestamp, the object accessed, and system privileges used. Oracle10G  auditing is efficient because audit records are parsed once for both audit and execution, and the database engine itself does the job, not an extraneous add-on server.</p>
<p>Auditing types can be divided into following categories:</p>
<p><strong>Statement Auditing:</strong><br />
Auditing on selective SQL statements irrespective of the schema object on which it is fired is Statement auditing. For example, auditing on the DDL statement fired by a user.</p>
<p><strong>Privilege Auditing:</strong><br />
Privilege auditing is nothing but the auditing on usage of selective privileges like usage of Create table privilege by a user. Privilege auditing can be done on any user or all the users.</p>
<p><strong>Schema Object Auditing</strong><br />
Auditing on specific schema object is met by schema object auditing. All the DML activities, Grant and Revoke performed on a specific table or all the schema tables can be captured.</p>
<p><strong>Fine Grained Auditing</strong><br />
Fine grained auditing provides auditing on data access based on content.</p>
<p><strong>Fine Grained Auditing (FGA)</strong></p>
<p>FGA provides better control and is a more granular method of auditing.</p>
<p>This method creates audit records based on the exact query, condition, and data retrieved or manipulated by the statement. It provides a facility to audit only those statements (including actual values of possible bind-variables) that reference a particular column. The FGA method was introduced in Oracle9i.But Oracle Database 10g enhances the FGA capability by extending SQL Support to support the granular auditing of queries, as well as UPDATE, INSERT, and DELETE operations. Let’s say, you want to capture any select, update, delete activity performed only on column invoice_amt of table Acc_Bill_details then it is achievable only using FGA. Or you want that access to SSN number of an account holder should be restricted, then that is also doable using FGA.<br />
Introduced in Oracle 9i, fine-grained auditing (FGA) performs auditing capabilities through a new package named DBMS_FGA. This package allows implementing auditing at an extremely low level of granularity against any table in the database through a special database object called an FGA policy. There are various sub programs of DBMS_FGA package. Package DBMS_FGA let’s you set audit conditions and specify the audit column to designate which column within a table or view requires monitoring. When the condition is met on the particular column, fine-grained auditing writes an audit record that shows the SQL text of the query.</p>
<p>The subprograms are explained in table below: ADD_POLICY Procedure 	Creates an audit policy using the supplied predicate as the audit condition<br />
DISABLE_POLICY Procedure 	Disables an audit policy<br />
DROP_POLICY Procedure 	Drops an audit policy<br />
ENABLE_POLICY Procedure	Enables an audit policy</p>
<p>The standard auditing records details like owner, timestamp, type of statement etc., but it does not give information about the change that happened in data. This information can be very useful for the DBA or user who wants to analyze the activities happening on the table. This is the reason why developer takes help of trigger and captures the table values before and after in user-defined tables. But triggers can only be written on DML statements Insert, Update and Delete and not on Select. So if you want to capture even the Select statements fired on a table or specific columns of a table, FGA comes to your rescue. Till Oracle 9i, FGA only supported Select, but in Oracle 10g FGA supports all DML statements. So, all the inserts, update, delete and select statements can be captured using only FGA and can be viewed through the data dictionary DBA_FGA_AUDIT_TRAIL.</p>
<p>Description of DBMS_FGA.ADD_POLICY Attributes: Parameter 	Description<br />
object_schema 	The schema of the object to be audited. Default value: NULL. (If NULL, the current effective user schema is assumed.)<br />
object_name 	The name of the object to be audited.<br />
policy_name 	The unique name of the policy.<br />
audit_condition 	A condition in a row that indicates a monitoring condition. NULL is allowed and acts as TRUE. Default value: NULL<br />
audit_column 	The columns to be checked for access. These can include hidden columns. The default, NULL, causes audit if any column is accessed or affected. Default value: NULL<br />
handler_schema 	The schema that contains the event handler. The default, NULL, causes the current schema to be used. Default value: NULL<br />
handler_module 	The function name of the event handler; includes the package name if necessary. This function is invoked only after the first row that matches the audit condition is processed in the query. If the procedure fails with exception, the user SQL statement will fail as well. Default value: NULL<br />
Enable 	Enables the policy if TRUE, which is the default. Default value: TRUE<br />
statement_types 	The SQL statement types to which this policy is applicable: insert, update, delete, or select only. Default value: SELECT<br />
audit_trail 	Whether to populate LSQLTEXT and LSQLBIND in fga_log$. Default value: DB_EXTENDED</p>
<p><strong>Syntax:</strong><br />
<code>DBMS_FGA.ADD_POLICY<br />
(<br />
object_schema VARCHAR2,<br />
object_name VARCHAR2,<br />
policy_name VARCHAR2,<br />
audit_condition VARCHAR2,<br />
audit_column VARCHAR2,<br />
handler_schema VARCHAR2,<br />
handler_module VARCHAR2,<br />
enable BOOLEAN,<br />
statement_types VARCHAR2,<br />
audit_trail BINARY_INTEGER IN DEFAULT,<br />
audit_column_opts BINARY_INTEGER IN DEFAULT<br />
);</code></p>
<p><strong>Usage:</strong><br />
Let’s put an audit on invoice_amt column Acc_bill_details table, such that if a user tries to query account information of a customer having invoice_amt more than 11000, user details would get captured in view DBA_FGA_AUDIT_TRAIL.<br />
<code>begin<br />
dbms_fga.add_policy<br />
(<br />
object_schema =&gt; 'TEST',<br />
object_name =&gt; 'ACC_BILL_DETAILS,<br />
policy_name =&gt; 'INVOICE_ACCESS',<br />
audit_column =&gt; 'INVOICE_AMT',<br />
audit_condition =&gt; 'INVOICE_AMT &gt; 11000'<br />
);<br />
end;</code></p>
<p>Now what if the DBA wants to get notified whenever such users are logged in? Not just that, he also wants to make call to a stored procedure ACC_BILL_AUDIT , that would send email to all concerned users and perform some specific activities in database.<br />
But the limitation of FGA is that already existing policy INVOICE_ACCESS can not be modified. So, the DBA drops the policy using procedure DROP_POLICY. This is how he could do it:</p>
<p><code>Begin<br />
Dbms_fga.drop_policy<br />
(<br />
object_schema =&gt; 'TEST',<br />
object_name =&gt; 'ACC_BILL_DETAILS,<br />
policy_name =&gt; 'INVOICE_ACCESS'<br />
);<br />
END;</code></p>
<p>Now the DBA created an audit table named ACC_BILL_AUDIT in Test schema. Then, created INVOICE_ACCESS policy with added functionality. This is how the policy is defined:<br />
<code>BEGIN<br />
DBMS_FGA.add_policy<br />
(<br />
object_schema =&gt; 'TEST',<br />
object_name =&gt; 'ACC_BILL_DETAILS',<br />
policy_name =&gt; ‘INVOICE_ACCESS',<br />
handler_schema =&gt; 'TEST',<br />
handler_module =&gt; 'TEST.ACC_BILL_AUDIT',<br />
audit_column =&gt; 'INVOICE_AMT',<br />
audit_condition =&gt; 'INVOICE_AMT &gt; 11000'<br />
statement_types =&gt; 'INSERT, UPDATE,DELETE, SELECT',<br />
audit_trail =&gt; DBMS_FGA.DB+DBMS_FGA.EXTENDED<br />
);<br />
END;</code></p>
<p>But after analyzing the system for a week or so, the DBA decides to disable the Invoice_access policy;</p>
<p><code>Begin<br />
Dbms_fga.disable_policy<br />
(<br />
object_schema =&gt; 'TEST',<br />
object_name =&gt; 'ACC_BILL_DETAILS,<br />
policy_name =&gt; 'INVOICE_ACCESS'<br />
);<br />
END;</code></p>
<p>Also, if the auditing is done on a large table and records are stored in a user defined audit table like ACC_BILL_AUD$, then overall performance can be hit big time as soon as the audit table size increases. Make sure you device a method to counter such situation. Probably you can implement a schedule job to purge audit records after regular interval or device conditional auditing to avoid storing each and every activity on table.</p>
<p>By, </p>
<p>Aswady<br />
Oracle 10g OCP</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/oracleinnotiive.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/oracleinnotiive.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/oracleinnotiive.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/oracleinnotiive.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/oracleinnotiive.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/oracleinnotiive.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/oracleinnotiive.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/oracleinnotiive.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/oracleinnotiive.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/oracleinnotiive.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/oracleinnotiive.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/oracleinnotiive.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/oracleinnotiive.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/oracleinnotiive.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=oracleinnotiive.wordpress.com&amp;blog=9699232&amp;post=54&amp;subd=oracleinnotiive&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://oracleinnotiive.wordpress.com/2010/03/04/oracle-10g-fine-grained-auditing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8c00e81ceae6be8d9be49cb966b58ec?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">oracleinnotiive</media:title>
		</media:content>
	</item>
	</channel>
</rss>
