<?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>My confrontations with oracle</title>
	<atom:link href="http://boomslaang.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://boomslaang.wordpress.com</link>
	<description>Might come in handy... plz do comment, for they inspires me!!</description>
	<lastBuildDate>Wed, 20 Jul 2011 14:43:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='boomslaang.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>My confrontations with oracle</title>
		<link>http://boomslaang.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://boomslaang.wordpress.com/osd.xml" title="My confrontations with oracle" />
	<atom:link rel='hub' href='http://boomslaang.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Seminar on TDE 11gR2</title>
		<link>http://boomslaang.wordpress.com/2010/11/09/seminar-on-tde-11gr2/</link>
		<comments>http://boomslaang.wordpress.com/2010/11/09/seminar-on-tde-11gr2/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 15:13:02 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=248</guid>
		<description><![CDATA[Last week i took a seminar to my colleagues/(client) on What/Why/How on TDE 11gR2. Download the presentation<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=248&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Last week i took a seminar to my colleagues/(client) on What/Why/How on TDE 11gR2.</p>
<p><a title="TDE on 11gR2" href="http://boomslaang.files.wordpress.com/2010/11/oracle-tde.ppt" target="_blank">Download the presentation</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/248/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/248/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=248&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2010/11/09/seminar-on-tde-11gr2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Tracing Oracle Client 11g</title>
		<link>http://boomslaang.wordpress.com/2010/08/10/tracing-oracle-client-11g/</link>
		<comments>http://boomslaang.wordpress.com/2010/08/10/tracing-oracle-client-11g/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 09:59:24 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[DIAG_ADR_ENABLED]]></category>
		<category><![CDATA[oracle client 11g trace]]></category>
		<category><![CDATA[TRACE_DIRECTORY_CLIENT]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=243</guid>
		<description><![CDATA[The other day i spent hours trying to trace my 11g client connection with the sqlnet.ora parmeters that i used in 10g. TRACE_LEVEL_CLIENT= 16 TRACE_DIRECTORY_CLIENT = /u00/app/oracle/product/11.2.0/client_1/network/trace TRACE_FILE_CLIENT= client.trc TRACE_TIMESTAMP_CLIENT = ON TRACE_UNIQUE_CLIENT = ON I was aware of the ADR stuff of the server installations, but my client installation seemed to not have those [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=243&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The other day i spent hours trying to trace my <strong>11g</strong> client connection with the sqlnet.ora parmeters that i used in <strong>10g</strong>.<br />
TRACE_LEVEL_CLIENT= 16<br />
TRACE_DIRECTORY_CLIENT = /u00/app/oracle/product/11.2.0/client_1/network/trace<br />
TRACE_FILE_CLIENT= client.trc<br />
TRACE_TIMESTAMP_CLIENT = ON<br />
TRACE_UNIQUE_CLIENT = ON</p>
<p>I was aware of the ADR stuff of the server installations, but my client installation seemed to not have those directories in place</p>
<p>CLIENT-&gt; adrci</p>
<p>ADRCI: Release 11.2.0.1.0 &#8211; Production on Fri Jun 18 11:49:08 2010</p>
<p>Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.</p>
<p>No ADR base is set<br />
adrci&gt; show homes<br />
No ADR homes are set<br />
adrci&gt; exit<br />
CLIENT-&gt;</p>
<p>I googled again and again until i hit with this blog, where he says that we need to mention</p>
<p><strong>DIAG_ADR_ENABLED=off</strong></p>
<p>in the<strong> sqlnet.ora</strong> to have the traces files written to &#8220;TRACE_DIRECTORY_CLIENT&#8221;.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/243/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=243&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2010/08/10/tracing-oracle-client-11g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Compression with 11g expdp</title>
		<link>http://boomslaang.wordpress.com/2010/05/26/compression-with-11g-expdp/</link>
		<comments>http://boomslaang.wordpress.com/2010/05/26/compression-with-11g-expdp/#comments</comments>
		<pubDate>Wed, 26 May 2010 11:35:51 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=240</guid>
		<description><![CDATA[In 9i, I used to export and then gzip the dump file, but with 10g, oracle expdp could compress the METADATA, but with 11g, I can compress everything. Yes, expdp of 11g has more compression options than erstwhile 10g $ expdp help=y : COMPRESSION Reduce the size of a dump file. Valid keyword values are: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=240&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In 9i, I used to export and then gzip the dump file, but with 10g, oracle expdp could compress the METADATA, but with 11g, I can compress everything. Yes, expdp of 11g has more compression options than erstwhile 10g</p>
<pre>
<span style="color:#003366;">$ expdp help=y</span>

<span style="color:#003366;">:</span>

<span style="color:#003366;">COMPRESSION</span>

<span style="color:#003366;">Reduce the size of a dump file.</span>

<span style="color:#003366;">Valid keyword values are: ALL, DATA_ONLY, [METADATA_ONLY] and NONE.</span>

<span style="color:#003366;">:</span>
</pre>
<p> I did a comparison between  11G’s expdp, 11G’s expdp + compression=ALL, 11G’s expdp + GZIP and exp + pipe node + GZIP on a database of size 2GB(approx) and below table describes the size of the dump file.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="43" valign="top">Sno</td>
<td width="228" valign="top">Scenario</td>
<td width="96" valign="top">Size in MB</td>
</tr>
<tr>
<td width="43" valign="top"> </td>
<td width="228" valign="top"> </td>
<td width="96" valign="top"> </td>
</tr>
<tr>
<td width="43" valign="top">1</td>
<td width="228" valign="top">Expdp</td>
<td width="96" valign="top">2226</td>
</tr>
<tr>
<td width="43" valign="top">2</td>
<td width="228" valign="top">expdp + compression=ALL</td>
<td width="96" valign="top">522</td>
</tr>
<tr>
<td width="43" valign="top">3</td>
<td width="228" valign="top">expdp + gzip</td>
<td width="96" valign="top">425</td>
</tr>
<tr>
<td width="43" valign="top">4</td>
<td width="228" valign="top">exp + pipe node + gzip</td>
<td width="96" valign="top">424</td>
</tr>
<tr>
<td width="43" valign="top"> </td>
<td width="228" valign="top"> </td>
<td width="96" valign="top"> </td>
</tr>
</tbody>
</table>
<p> There wasn’t much notable difference in the time taken. Whatever, I would  go for the 11g expdp with compression=all than erstwhile exp.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/240/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=240&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2010/05/26/compression-with-11g-expdp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Actual space consumed by an Oracle Object</title>
		<link>http://boomslaang.wordpress.com/2010/01/14/actual-space-consumed-by-an-oracle-object/</link>
		<comments>http://boomslaang.wordpress.com/2010/01/14/actual-space-consumed-by-an-oracle-object/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 06:40:27 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[actual used space in oracle]]></category>
		<category><![CDATA[dbms_space]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=236</guid>
		<description><![CDATA[When asked &#8220;What is the size of the table &#8216;A&#8217; ?&#8221;, we often check only that segments size. select sum(bytes)/1024/1024 from dba_segments where segment_name='A' and segment_type='TABLE'; This gives the total segment size. It could be that the table is either full, sparsely populated or even empty, still there would not be any change for the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=236&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When asked &#8220;What is the size of the table &#8216;A&#8217; ?&#8221;, we often check only that segments size.<br />
<span style="color:#003366;"><br />
</span></p>
<pre><span style="color:#003366;">select sum(bytes)/1024/1024 from dba_segments where segment_name='A' and segment_type='TABLE';</span></pre>
<p>This gives the total segment size. It could be that the table is either full, sparsely populated or even empty, still there would not be any change for the segment size. We could assign 1GB for a table which would actually need only 10MB, but who lose? Assigning more(very much extra) space than necessary has negative impact not only on space, but also on the performance. Each time a full table scan is performed, oracle retrieves all the blocks until the High Water Mark of the table. It could be that most of these blocks are empty. The same for indexes also.  The segment advisor suggests the candidate tables for shrink operation or you could manually select your known tables and check its actual consumed space using dbms_space.unused_space() package.</p>
<pre><span style="color:#003366;">spool d:\oracle\table.log</span>
<span style="color:#003366;">
DECLARE</span>
<span style="color:#003366;"> alc_bks     NUMBER;</span>
<span style="color:#003366;"> alc_bts     NUMBER;</span>
<span style="color:#003366;"> unsd_bks    NUMBER;</span>
<span style="color:#003366;"> unsd_bts    NUMBER;</span>
<span style="color:#003366;"> luefi       NUMBER;</span>
<span style="color:#003366;"> luebi       NUMBER;</span>
<span style="color:#003366;"> lub         NUMBER;</span>
<span style="color:#003366;">BEGIN</span>
<span style="color:#003366;"> FOR c1_row IN (SELECT table_name</span>
<span style="color:#003366;"> FROM   dba_tables where owner='JJ') LOOP</span>
<span style="color:#003366;"> DBMS_SPACE.UNUSED_SPACE (</span>
<span style="color:#003366;"> segment_owner               =&gt; 'JJ'</span>
<span style="color:#003366;"> ,   segment_name                =&gt; c1_row.table_name</span>
<span style="color:#003366;"> ,   segment_type                =&gt; 'TABLE'</span>
<span style="color:#003366;"> ,   total_blocks                =&gt; alc_bks</span>
<span style="color:#003366;"> ,   total_bytes                 =&gt; alc_bts</span>
<span style="color:#003366;"> ,   unused_blocks               =&gt; unsd_bks</span>
<span style="color:#003366;"> ,   unused_bytes                =&gt; unsd_bts</span>
<span style="color:#003366;"> ,   last_used_extent_file_id    =&gt; luefi</span>
<span style="color:#003366;"> ,   last_used_extent_block_id   =&gt; luebi</span>
<span style="color:#003366;"> ,   last_used_block             =&gt; lub</span>
<span style="color:#003366;"> );</span>
<span style="color:#003366;">DBMS_OUTPUT.PUT_LINE( c1_row.table_name || ',' || alc_bts ||','|| unsd_bts );</span>
<span style="color:#003366;"> END LOOP;</span>
<span style="color:#003366;">EXCEPTION</span>
<span style="color:#003366;"> WHEN OTHERS THEN</span>
<span style="color:#003366;"> DBMS_OUTPUT.PUT_LINE(SUBSTR(SQLERRM,1,250));</span>
<span style="color:#003366;">END;</span>
<span style="color:#003366;">/

</span><em>PS:i didn't write the below script, but modified to separate output by a delimit.</em></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/236/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=236&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2010/01/14/actual-space-consumed-by-an-oracle-object/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Space required by oracle to store a character/string</title>
		<link>http://boomslaang.wordpress.com/2009/11/16/space-required-by-oracle/</link>
		<comments>http://boomslaang.wordpress.com/2009/11/16/space-required-by-oracle/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 05:57:03 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[oracle dump function]]></category>
		<category><![CDATA[oracle japanese AL32UTF8]]></category>
		<category><![CDATA[oracle vsize function]]></category>
		<category><![CDATA[size of japanese character in oracle]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=224</guid>
		<description><![CDATA[One of the challenges in working with Oracle and Globalization is in identifying how much space oracle requires to store a particular alphabet,especially when the database uses a Unicode Character Set. The Unicode DB Characterset AL32UTF8 is a multi byte characterset. For an ASCII character, oracle(with AL32UTF8) need only 1 byte, where as for a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=224&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the challenges in working with Oracle and Globalization is in identifying how much space oracle requires to store a particular alphabet,especially when the database uses a Unicode Character Set. The Unicode DB Characterset AL32UTF8 is a multi byte characterset. For an ASCII character, oracle(with AL32UTF8) need only 1 byte, where as for a Japanese character (hiragana,katakana or kanji), it would require either 3 or 4 bytes. Most of the Japanese characters are 3 bytes, but as more number of kanaji&#8217;s are accepeted for daily use, it becomes evident that oracle would require more bytes to store them.</p>
<p>To see how much space a character occupies, one can use the oracle <strong>vsize(&#8216;&lt;string&gt;&#8217;) </strong>or <strong>dump(&#8216;string&#8217;) </strong>functions. Both these functions gives the size in bytes.</p>
<p>Let&#8217;s see how much space(in bytes) Oracle Db with  <strong>AL32UTF8</strong> characterset requires tp store the word &#8216;tokyo&#8217; in English and Japanese (Hiragana, Full Width Katakana, Half Width Katakana and Kanji).</p>
<p><span style="color:#003366;"><span style="color:#000000;"><strong>English</strong></span><br />
select vsize(‘tokyo’) from dual;<br />
<em>5</em><br />
select dump(‘tokyo’) from dual;<br />
Typ=96 Len=<em>5</em>: 116,111,107,121,111</span></p>
<p><strong><span style="color:#000000;">Japanese-Hiragana</span></strong><br />
<span style="color:#003366;">select vsize(&#8216;とうきょう&#8217;) from dual;<br />
<em>15</em><br />
select dump(&#8216;とうきょう&#8217;) from dual;<br />
Typ=96 Len=<em>15</em>: 227,129,168,227,129,134,227,129,141,227,130,135,227,129,134</span></p>
<p><strong><span style="color:#000000;">Japanese-Full Width Katakana</span></strong><br />
<span style="color:#003366;">select vsize(&#8216;トウキョウ&#8217;) from dual;<br />
<em>15</em><br />
select dump(&#8216;トウキョウ&#8217;) from dual;<br />
Typ=96 Len=<em>15</em>: 227,131,136,227,130,166,227,130,173,227,131,167,227,130,166</span><br />
<span style="color:#000000;"><br />
<strong>Japanese-Half Width Katakana</strong></span><br />
<span style="color:#003366;">select vsize(&#8216;ﾄｳｷｮｳ&#8217;) from dual;<br />
<em>15</em><br />
select dump(&#8216;ﾄｳｷｮｳ&#8217;) from dual;<br />
Typ=96 Len=<em>15</em>: 239,190,132,239,189,179,239,189,183,239,189,174,239,189,179</span></p>
<p><strong><span style="color:#000000;">Japanese-Kanji</span></strong><br />
<span style="color:#003366;">select vsize(‘東京’) from dual;<br />
<em>6</em><br />
select dump(‘東京’) from dual;<br />
Typ=96 Len=<em>6</em>: 230,157,177,228,186,172</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=224&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2009/11/16/space-required-by-oracle/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>CRS-0223: Resource has placement error while using SRVCTL</title>
		<link>http://boomslaang.wordpress.com/2009/11/06/crs-0223-resource-has-placement-error-while-using-srvctl/</link>
		<comments>http://boomslaang.wordpress.com/2009/11/06/crs-0223-resource-has-placement-error-while-using-srvctl/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 06:31:15 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[rac]]></category>
		<category><![CDATA[CRS-0223]]></category>
		<category><![CDATA[CRS-0223: Resource has placement error.]]></category>
		<category><![CDATA[CRS-1028]]></category>
		<category><![CDATA[PRKP-1001]]></category>
		<category><![CDATA[srvctl cannot start db instance]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=217</guid>
		<description><![CDATA[Few days back in the early wee hours, one of my RAC node db instance crashed. Env: 10.2.0.4 RAC on Solaris 5.10 SPARC alert.log said: : Errors in file /u01/app/oracle/admin/SHCL1/bdump/shcl1n02_j004_27414.trc: ORA-07445: exception encountered: core dump [kglobcl()+412] [SIGSEGV] [Address not mapped to object] [0x49415C002] [] [] Tue Nov  3 00:00:27 2009 Trace dumping is performing id=[cdmp_20091103000027] [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=217&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Few days back in the early wee hours, one of my RAC node db instance crashed.<br />
Env: 10.2.0.4 RAC on Solaris 5.10 SPARC<br />
alert.log said:</p>
<pre><span style="color:#003366;">:
Errors in file /u01/app/oracle/admin/SHCL1/bdump/shcl1n02_j004_27414.trc:
ORA-07445: exception encountered: core dump [kglobcl()+412] [SIGSEGV] [Address not mapped to object] [0x49415C002] [] []
Tue Nov  3 00:00:27 2009
Trace dumping is performing id=[cdmp_20091103000027]
Tue Nov  3 00:00:37 2009
Errors in file /u01/app/oracle/admin/SHCL1/bdump/shcl1n02_pmon_3278.trc:
ORA-07445: [kglobcl()+412] [SIGSEGV] [Address not mapped to object] [0x49415C002] [] []
Tue Nov  3 00:00:51 2009
:
:
Tue Nov  3 00:00:54 2009
MMAN: terminating instance due to error 472
Instance terminated by MMAN, pid = 3368
Wed Nov  4 10:44:47 2009
:</span></pre>
<p>I checked</p>
<p><strong>$ crsctl check crs</strong><br />
<span style="color:#003366;">OK (running successfully)</span><br />
<strong>$ srvctl status nodeapps -n myjpsuolicdbd02</strong><br />
<span style="color:#003366;">OK (all resources running successfully)</span><br />
<strong>$ srvctl status database -d SHCL1_PRMY</strong><br />
<span style="color:#ff0000;">Instance SHCL1N01 is running on node myjpsuolicdbd01<br />
PRKO-2015 : Error in checking condition of instance on node: myjpsuolicdbd02</span><br />
$</p>
<p>Since only instance 2 was down, i tried to start it and i got the below error.</p>
<p>$<strong> srvctl start instance -d SHCL1_PRMY -i SHCL1N02</strong><br />
<span style="color:#ff0000;">PRKP-1001 : Error starting instance SHCL1N02 on node myjpsuolicdbd02<br />
CRS-1028: Dependency analysis failed because of:<br />
CRS-0223: Resource &#8216;ora.SHCL1_prmy.SHCL1N02.inst&#8217; has placement error.</span><br />
$</p>
<p>The crsd.log file too didn&#8217;t have much(to the point) information.</p>
<pre><span style="color:#003366;">2009-11-04 10:18:30.627: [  CRSRES][2970821] CRS-1028: Dependency analysis failed because of:'Resource in UNKNOWN state: ora.SHCL1_prmy.SHCL1N02.inst'

2009-11-04 10:21:23.269: [  CRSRES][2970843] StopResource: setting CLI values
2009-11-04 10:21:23.340: [  CRSRES][2970843] Attempting to stop `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02`
2009-11-04 10:21:30.478: [  CRSAPP][2970843] StopResource error for ora.SHCL1_prmy.SHCL1N02.inst error code = 1
2009-11-04 10:21:30.502: [  CRSRES][2970843] Stop of `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02` succeeded.
2009-11-04 10:21:49.867: [  CRSRES][2970861] startRunnable: setting CLI values
2009-11-04 10:21:49.895: [  CRSRES][2970861] Attempting to start `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02`
2009-11-04 10:21:55.019: [  CRSAPP][2970861] StartResource error for ora.SHCL1_prmy.SHCL1N02.inst error code = 1
2009-11-04 10:22:00.583: [  CRSAPP][2970861] StopResource error for ora.SHCL1_prmy.SHCL1N02.inst error code = 1
2009-11-04 10:22:00.592: [  CRSRES][2970861] X_OP_StopResourceFailed : Stop Resource failed
(File: rti.cpp, line: 1803

2009-11-04 10:22:00.593: [  CRSRES][2970861][ALERT] `ora.SHCL1_prmy.SHCL1N02.inst` on member `myjpsuolicdbd02` has experienced an unrecoverable failure.
2009-11-04 10:22:00.593: [  CRSRES][2970861] Human intervention required to resume its availability.</span></pre>
<p>Clusterware and nodeapps were up and running but db instance on node 2.</p>
<p>I could startup the instance from sqlplus, but this would not start the db services etc ora.SHCL1_prmy.SHCL1N02.inst was not ONLINE and would be of no use in a RAC.<br />
Didn&#8217;t have any clue, until I came across the logs under <strong><span style="color:#003366;">/u01/app/oracle/product/10.2.0/db_1/log/&lt;hostname&gt;/racg/imonSHCL1_prmy.log </span></strong>and <span style="color:#003366;"><strong>imon_SHCL1_prmy.log</strong></span>.</p>
<p>The files imonSHCL1_prmy.log and imon_SHCL1_prmy.log contains details of the starting up of the DB using SRVCTL command.</p>
<pre><span style="color:#003366;">SQL*Plus: Release 10.2.0.4.0 - Production on Wed Nov 4 18:59:48 2009
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Enter user-name: ERROR:
ORA-01031: insufficient privileges

Enter user-name: SP2-0306: Invalid option.

2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: Usage: CONN[ECT] [logon] [AS {SYSDBA|SYSOPER}]
where &lt;logon&gt;  ::= &lt;username&gt;[/&lt;password&gt;][@&lt;connect_identifier&gt;] | /
Enter user-name: Enter password:
ERROR:
ORA-01005: null password given; logon denied

2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: clsrcexecut: env _USR_ORA_PFILE=
2009-11-04 18:59:48.968: [    RACG][176] [28813][176][ora.SHCL1_prmy.SHCL1N02.inst]: clsrcexecut: cmd = /u01/app/oracle/product/10.2.0/db_1/bin/racgeut -e _USR_ORA_DEBUG=0 -e ORACLE_SID=SHCL1N02 520 /u01/app/oracle/product/10.2.0/db_1/bin/racgmdb -d abort</span></pre>
<p>&nbsp;</p>
<p><span style="text-decoration:underline;"><strong>CAUSE:</strong></span></p>
<p>Due to security concern, recently i added &#8220;<strong><span style="color:#003366;"> SQLNET.AUTHENTICATION_SERVICES=(NONE) </span></strong>&#8221; to <span style="color:#003366;"><strong>sqlnet.ora</strong> </span>and this line would insist on providing the password explicitly. It doesn&#8217;t allow to login using &#8220;sqlplus / as sysdba&#8221;. Hence the SRVCTL failed.</p>
<p>So,</p>
<p>After removing this line from sqlnet.ora, i could start the instance.</p>
<p>&nbsp;</p>
<p><strong><span style="text-decoration:underline;">SOLUTION:</span></strong></p>
<p>1)Commented the entry in sqlnet.ora<br />
2)crs_stat -u =&gt; check for  &#8220;ora.SHCL1_prmy.SHCL1N02.inst&#8221;, the STATE should be OFFLINE before we &#8216;start&#8217; again.</p>
<p style="padding-left:30px;"><em>NAME=ora.SHCL1_prmy.SHCL1N02.inst<br />
TYPE=application<br />
TARGET=ONLINE<br />
<span style="color:#ff0000;">STATE=UNKNOWN on myjpsuolicdbd02</span></em></p>
<p>If the STATE is UNKNOWN, &#8216;start&#8217;ing the instance would error out. So stop it by force.</p>
<p>2)crs_stop -f ora.SHCL1_prmy.SHCL1N02.inst<br />
3)crs_stat -u =&gt; to confirm that the TARGET is ONLINE and STATE is OFFLINE for ora.SHCL1_prmy.SHCL1N02.inst<br />
4)srvctl start instance -d SHCL1_PRMY -i SHCL1N02<br />
Raised an SR for the ORA 7445 error and let me see what they have in stock for me</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/217/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/217/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/217/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=217&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2009/11/06/crs-0223-resource-has-placement-error-while-using-srvctl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Configure heterogeneous connection from Oracle DB to PostgreSQL DB</title>
		<link>http://boomslaang.wordpress.com/2009/10/06/configure_heterogeneous_connection_from_oracle_db_to_postgresql_db/</link>
		<comments>http://boomslaang.wordpress.com/2009/10/06/configure_heterogeneous_connection_from_oracle_db_to_postgresql_db/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 10:51:25 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[HSODBC]]></category>
		<category><![CDATA[Oracle heterogeneous connection]]></category>
		<category><![CDATA[Oracle to PostgreSQL]]></category>
		<category><![CDATA[psqlODBC]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=210</guid>
		<description><![CDATA[An organisation have lot of choices to choose from the RDBMS world.Oracle Database, Microsoft SQL Server, IBM DB2,PostgreSQL, MySQL are few of them. Most of the organisations out there do have a mix of all these which are used to store their data and in course of time it is inevitable that they would want [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=210&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>An organisation have lot of choices to choose from the RDBMS world.Oracle Database, Microsoft SQL Server, IBM DB2,PostgreSQL, MySQL are few of them. Most of the organisations out there do have a mix of all these which are used to store their data and in course of time it is inevitable that they would want to transfer data from &#8216;this database&#8217; to &#8216;that database&#8217;. Oracle, the uncrowned king of this RDBMS world call this &#8220;Heterogeneous Connectivity&#8221; and have incorporated this facility into their database and this is installed by default.</p>
<p>Oracle documentation says:</p>
<p>http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/tgvsgc.htm#sthref36</p>
<p>The Heterogeneous Services component in the Oracle database server talks to a Heterogeneous Services agent process which, in turn, talks to the non-Oracle system. We can conceptually divide the code into three parts:</p>
<p>1)The Heterogeneous Services component in the Oracle database server.<br />
<em> Most of the processing related to heterogeneous connectivity is done in this module.</em><br />
2)Agent generic code.<br />
<em> This is code in the agent that is generic to all Heterogeneous Services products. This consists, for the most part, of code to communicate with the database and multithreading support.<br />
</em>3)The driver.<br />
<em>This is the module that communicates with the non-Oracle system. It is used to map calls from the Heterogeneous Services onto the native API of the non-Oracle system and it is non-Oracle system specific.</em></p>
<p><span style="text-decoration:underline;"><strong>Connecting to PostgreSQL from Oracle using an ODBC data source</strong></span></p>
<p>To connect to a PostgreSQL from Oracle, we will have to use the Oracle Generic Connectivity Agent(hsodbc).<br />
A simple call would be like: <em>Oracle DB<span style="color:#800000;"> -&gt;</span> Oracle Heterogeneous Service <span style="color:#800000;">-&gt;</span> Oracle Generic Connectivity Agent <span style="color:#800000;">-&gt;</span> ODBC Driver for PostgreSQL <span style="color:#800000;">-&gt;</span> PostgreSQL DB</em></p>
<p>http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/gencon.htm#i1005976</p>
<p>Oracle does not provide the ODBC driver for PostgreSQL, it should be acquired from third party. I downloaded the psqlOBDC driver from http://www.postgresql.org/download/products/2 .</p>
<p><span style="text-decoration:underline;">1.PostgreSQL Server [PostgreSQL 8.3.5 on Windows]</span><br />
1.1)Create the DB and user, which would be used by oracle to make connection.</p>
<p><span style="text-decoration:underline;">2.Oracle Server [Oracle 10.2.0.1 on Windows]</span><br />
2.1)Install Oracle(standard edition also will do)<br />
2.2)Create a database<br />
2.3)Go to $ORACLE_HOME/hs/admin/ and confirm the files<br />
2.4)Download and install the psqlOBDC driver from postgresql.org<br />
2.5)Create the ODBC data source<br />
2.6)Configure initHSODBC.ora ($ORACLE_HOME/hs/admin/) and listener.ora and tnsnames.ora ($ORACLE_HOME/network/admin/)<br />
2.7)Create the database link</p>
<p><em>This post will cover only the details to be done at the Oracle side.</em></p>
<p><span style="text-decoration:underline;"><strong>2.1 &#8211; 2.3:</strong></span><br />
I installed oracle 10.2.0.1 standard edition and created a generic database.<br />
The $ORACLE_HOME/hs/admin/ would contain the files inithsodbc.ora,inithsoledb.ora,listener.ora.sample and tnsnames.ora.sample.<br />
The inithsodbc.ora is the one of our interest. We will configure it later.</p>
<p><strong><span style="text-decoration:underline;">2.4:</span></strong><br />
I downloaded the &#8220;psqlodbc_08_04_0100.zip&#8221;(the latest when i installed) from http://www.postgresql.org/ftp/odbc/versions/msi/ .<br />
(I could not access this site using IE and hence used Firefox.)<br />
The installation is nothing big the typical &#8220;click next button&#8221;</p>
<p>Click Next -&gt; Accept the terms -&gt; Next -&gt; Install -&gt; Finish</p>
<p><strong><span style="text-decoration:underline;">2.5:</span></strong><br />
Go to Control Panel -&gt; Administrative Tools -&gt; Data Sources -&gt; System DSN -&gt; Add</p>
<p>Select the &#8220;PostgreSQL ANSI&#8221; driver -&gt; Finish.</p>
<p>Enter the <em>ODBC Datasource name</em> ( i gave PG), <em>Server Name</em> (put the IP address of PostgreSQL DB server), <em>Database Name</em> (PostgreSQL DB name) and <em>User Name</em> (PostgreSQL userid) and <em>password</em>.<br />
Click &#8220;<strong>Test</strong>&#8221; to test the connection to PostgreSQL DB and it would show &#8220;<span style="color:#800000;">Connection Succesful</span>&#8221; and <em>Save</em>. Now we have an ODBC Data Source called &#8220;PG&#8221;.</p>
<p><strong><span style="text-decoration:underline;">2.6:</span></strong><br />
Now we have the datasource PG which would use the ODBC driver psqlODBC.<br />
We need to configure 3 files to complete the connectivity<br />
<span style="color:#800000;"> a)initHSODBC.ora<br />
b)listener.ora<br />
c)tnsnames.ora<br />
</span></p>
<p style="padding-left:30px;"><span style="text-decoration:underline;"><strong>a.1)</strong></span><br />
Go to $ORACLE_HOME/hs/admin/ and make a copy of the initHSODBC.ora and name it init&lt;SID&gt;.ora, where sid is the system identifier you want to use for the instance of the non-Oracle system to which the agent connects and i renamed the file to &#8220;<strong>initPG.ora</strong>&#8220;. Edit the file and provide the ODBC Data Source Name which we created in <em>step 2.5.</em></p>
<pre style="padding-left:30px;"><span style="color:#000080;"># This is a sample agent init file that contains the HS parameters that are
# needed for an ODBC Agent.
#
# HS init parameters
#
HS_FDS_CONNECT_INFO = PG                        <span style="color:#ff0000;">&lt;&lt;- ODBC Data Source Name</span>
HS_FDS_TRACE_LEVEL = ON
#
# Environment variables required for the non-Oracle system
#
#set &lt;envvar&gt;=&lt;value&gt;

</span></pre>
<p style="padding-left:30px;"><span style="text-decoration:underline;"><strong>b.1)</strong></span></p>
<p style="padding-left:30px;">Listener.ora ($ORACLE_HOME/network/admin/)</p>
<pre style="padding-left:30px;"><span style="color:#000080;"> SID_LIST_LISTENER =
 (SID_LIST =
 (SID_DESC =
 (SID_NAME = PG)          <span style="color:#ff0000;">&lt;&lt;- Should be same as the SID in $ORACLE_HOME/hs/admin/initSID.ora </span>
 (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
 (PROGRAM = hsodbc)       <span style="color:#ff0000;">&lt;&lt;- Set the program as "hsodbc"</span>
 )
 (SID_DESC =
 (SID_NAME = PLSExtProc)
 (ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
 (PROGRAM = extproc)
 )
 )

LISTENER =
 (DESCRIPTION_LIST =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = IPC)(KEY = PNPKEY))        <span style="color:#ff0000;">&lt;&lt;- Set key as PNPKEY</span>
 (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.20)(PORT = 1521))
 )
)</span></pre>
<p style="padding-left:30px;"><em><strong> Restart the listener.</strong></em></p>
<p style="padding-left:30px;">The sid that you add to the listener.ora file must match the sid in an initsid.ora file, because the agent spawned by the listener searches for a matching initsid.ora file. When you copy and rename the initsid.ora file, ensure that it remains in the $ORACLE_HOME/hs/admin directory</p>
<p style="padding-left:30px;"><strong><span style="text-decoration:underline;"> c.1)</span></strong></p>
<p style="padding-left:30px;">Add an entry for the PostgreSQL DB into the tnsnames.ora for the DB link to work.</p>
<pre style="padding-left:30px;"> <span style="color:#000080;">PG =
 (DESCRIPTION=
 (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.20.20)(PORT=1521))
 (CONNECT_DATA=(SID=PG))
 (HS=OK)
 )</span></pre>
<p style="padding-left:30px;">Confirm the &#8220;tnsping PG&#8221; works.</p>
<p><span style="text-decoration:underline;"><strong>2.7:</strong></span><br />
Create the database link in oracle</p>
<pre><span style="color:#000080;"> create public database link topg connect to "postgreuser" identified by "password" using 'PG';</span></pre>
<p>Confirm the DBlink to PostgreSQL using this query.</p>
<pre> <span style="color:#000080;">select * from all_tables@topg</span></pre>
<p>Unlike Oracle, PostgreSQL <strong><em>is case sensitive</em></strong>. So for user tables(other than all_tables) <strong><em>use the double quotes</em></strong> like</p>
<pre> <span style="color:#000080;">select * from "tbl_user_data"@topg;</span></pre>
<pre style="padding-left:30px;"><span style="color:#000080;"> </span></pre>
<p><span style="color:#000080;"> References:</span></p>
<p>http://www.databasejournal.com/features/oracle/article.php/10893_3442661_2/Making-a-Connection-from-Oracle-to-SQL-Server.htm</p>
<p>http://birijan.com.np/?q=Oracle+Heterogeneous+Services+(Accessing+ODBC+datasource)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/210/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/210/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/210/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=210&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2009/10/06/configure_heterogeneous_connection_from_oracle_db_to_postgresql_db/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Make &#8220;n&#8221; number of connections to your DB using script in windows/unix</title>
		<link>http://boomslaang.wordpress.com/2009/08/20/make-n-number-of-connections-to-your-db/</link>
		<comments>http://boomslaang.wordpress.com/2009/08/20/make-n-number-of-connections-to-your-db/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 06:09:27 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[Shell Scripts]]></category>
		<category><![CDATA[FOR loop in windows or dos]]></category>
		<category><![CDATA[shell script for oracle]]></category>
		<category><![CDATA[Shell Script for sqlplus]]></category>
		<category><![CDATA[sqlplus -s]]></category>
		<category><![CDATA[windows script for oracle]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=205</guid>
		<description><![CDATA[Recently i had to set up a db for an App and wanted to test the how better the server scaled when there are &#8220;n&#8221; number of connections at a time. I did it on a Windows 2003 server. Below is the script which i wrote for this. On Windows make_conn.bat &#8212;&#8212;&#8212;&#8212;&#8212;&#8212; FOR %%A in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=205&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently i had to set up a db for an App and wanted to test the how better the server scaled when there are &#8220;n&#8221; number of connections at a time. I did it on a Windows 2003 server. Below is the script which i wrote for this.</p>
<p><strong><span style="color:#003300;">On Windows</span><br />
</strong></p>
<p>make_conn.bat<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<pre><span style="color:#000080;">FOR %%A in (1 2 3) DO start sqlplus userid/passwd@tns_entry @conn.sql</span></pre>
<p>conn.sql<br />
&#8212;&#8212;&#8212;&#8211;</p>
<pre><span style="color:#000080;">select sysdate from dual;</span><span style="color:#000080;">
exec dbms_lock.sleep(10);
exit;

</span></pre>
<p><span style="color:#000080;"> </span>Save both the files in the same folder with respective names.<br />
Now double click the make_conn.bat and this would create 3 connections to the db and will exceute the conn.sql in each. The contents of the conn.sql are self explanatory. To make more connections all you need to do is to add more numerics to the FOR statement. Changing the make_conn.bat to (1 2 3 1 2 3 1 2 3 4 5 6) would create 12 connections and the more numbers you add, more threads(connections) are created.</p>
<p>If you want to trigger the connections from cmd.exe then you will need to modify the FOR statement like :</p>
<pre><span style="color:#000080;">FOR <span style="color:#800000;">%</span>A in (1 2 3) DO start sqlplus userid/passwd@burp @conn.sql</span></pre>
<p>Note that there is only one<span style="color:#800000;"> % symbol.</span></p>
<p><span style="color:#000080;"> </span></p>
<p><span style="color:#003300;"><strong>On Unix/Linux</strong></span></p>
<p>make_conn.sh<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<pre><span style="color:#000080;">#!/bin/ksh
#
#Make n number of connections to db
#
#
echo "Enter the number of connections to make :\c"
read NOF;
i=0
while [[ $i -lt $NOF ]];
do
 sqlplus -s userid/passwd @conn.sql &gt;/dev/null &amp;
 i=$i+1
done
exit;
</span></pre>
<p>conn.sql<br />
&#8212;&#8212;&#8211;</p>
<pre><span style="color:#000080;">select sysdate from dual;
exec dbms_lock.sleep(10);
exit;</span>

$<span style="color:#000080;">chmod 755 make_conn.sh</span>
$<span style="color:#000080;">make_conn.sh

</span></pre>
<p>The &#8220;&amp;&#8221; in the while loop will run the process in background and will direct the o/p to /dev/null, so you will not see any message in your terminal unless there is an error.</p>
<p>In both cases, you can test your number of connections by</p>
<p>select count(8) from v$session where username=&#8217;USERID&#8217;;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/205/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=205&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2009/08/20/make-n-number-of-connections-to-your-db/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Restore the RMAN backup of a RAC to a Single Instance</title>
		<link>http://boomslaang.wordpress.com/2009/07/28/restore-the-rman-backup-of-a-rac-to-a-single-instance/</link>
		<comments>http://boomslaang.wordpress.com/2009/07/28/restore-the-rman-backup-of-a-rac-to-a-single-instance/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 06:29:08 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[Oracle Backup and Recovery]]></category>
		<category><![CDATA[rac]]></category>
		<category><![CDATA[Oracle RAC Recovery]]></category>
		<category><![CDATA[RAC RMAN Recovery]]></category>
		<category><![CDATA[RMAN recovery]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=187</guid>
		<description><![CDATA[The source database is a 2 Node RAC Database(10.2.0.4) Source : Unique Name    : SHCL1DR Db_Name           : SHCL1 SID                        : SHCL1DR2 The destination will be a single instnace. Destination : Unique Name    : SHCL1REC Db_Name           : SHCL1 SID               [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=187&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The source database is a 2 Node RAC Database(10.2.0.4)<br />
Source :<br />
Unique Name    : SHCL1DR<br />
Db_Name           : SHCL1<br />
SID                        : SHCL1DR2</p>
<p>The destination will be a single instnace.<br />
Destination :<br />
Unique Name    : SHCL1REC<br />
Db_Name           : SHCL1<br />
SID                        : SHCL1REC</p>
<p>1] Prepare SHCL1DR for taking RMAN backup</p>
<ul>
<li> 1.a] Create directories to store the RMAN backup</li>
</ul>
<pre style="padding-left:60px;"> <span style="color:#333399;">mkdir /u04/RMAN_BACKUPS</span></pre>
<ul>
<li> 1.b] Configure the RMAN persistant parameters to point to the backup directory and enable controlfile autobackup.</li>
</ul>
<pre style="padding-left:60px;"><span style="color:#333399;">export ORACLE_SID=SHCL1DR2</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;"> rman target /</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;"> CONFIGURE CONTROLFILE AUTOBACKUP ON;
 CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 5 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';
 CONFIGURE CHANNEL 6 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1';</span></pre>
<p style="padding-left:60px;">The backupsets will be created under /u04/RMAN_BACKUPS/ and the controlfile would be backed up at the default location.</p>
<pre style="padding-left:60px;"> <span style="color:#333399;">RMAN&gt; show all;</span><span style="color:#333399;">
 using target database control file instead of recovery catalog
 RMAN configuration parameters are:</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;"> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 90 DAYS;
 CONFIGURE BACKUP OPTIMIZATION ON;
 CONFIGURE DEFAULT DEVICE TYPE TO DISK;
 CONFIGURE CONTROLFILE AUTOBACKUP ON;
 CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
 CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 6;
 CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
 CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
 CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 5 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE CHANNEL 6 DEVICE TYPE DISK FORMAT   '/u04/RMAN_BACKUPS/%d_%I_%U' CONNECT '*';
 CONFIGURE MAXSETSIZE TO UNLIMITED;
 CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
 CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
 CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
 CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_SHCL1DR2.f'; # default
RMAN&gt;</span></pre>
<ul>
<li> 1.c] Take the backup from on of the node</li>
</ul>
<pre style="padding-left:60px;"><span style="color:#333399;">rman target /
 crosscheck archivelog all;
 backup database plus archivelog;</span></pre>
<p style="padding-left:60px;">I used the below script to run RMAN in background mode.</p>
<pre style="padding-left:60px;"> <span style="color:#333399;">T02[SHCL1DR2]$ cat /export/home/oraprd/bkp.sh
 #!/bin/sh
 rman target / &lt;&lt;EOF
 backup database plus archivelog;
 exit;
 EOF
 exit
 T02[SHCL1DR2]$</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;"> T02[SHCL1DR2]$ nohup /export/home/orapd/bkp.sh &gt; /export/home/orapd/bkp. 2&gt;&amp;1 &amp;    </span></pre>
<p>2] Prepare environmet for SHCL1REC</p>
<ul>
<li> 2.a] Create the directories to hold the controlfile,redo logs,datafiles and archivelogs</li>
</ul>
<p style="padding-left:60px;">(I used the same machine, hence restored to a different location)<br />
<span style="color:#333399;">mkdir /u02/oracle/shcl1rec/ </span></p>
<p style="padding-left:60px;">This directory would hold all files pertaining to this new instance.<br />
(If you are going to use this restored instance for Prod or Dev activities, use separate directories.<br />
All i wanted was to test the backups, hence restoring them to same dir for simplicity)</p>
<pre style="padding-left:60px;"> <span style="color:#333399;">mkdir /u01/app/oracle/admin/SHCL1REC/adump        
 mkdir /u01/app/oracle/admin/SHCL1REC/bdump
 mkdir /u01/app/oracle/admin/SHCL1REC/cdump
 mkdir /u01/app/oracle/admin/SHCL1REC/udump
 mkdir /u02/oracle/shcl1rec/archivelogs</span></pre>
<p style="padding-left:60px;">
<ul>
<li> 2.b] Restore the spfile from the controlfile backup</li>
</ul>
<pre style="padding-left:60px;"><span style="color:#333399;"> export ORACLE_SID=SHCL1REC
 rman target /
 startup nomount
 restore spfile from '/u02/oracle/shcl1/flashbacklog/SHCL1DR/autobackup/2009_07_23/o1_mf_s_692991347_56j874gd_.bkp';</span></pre>
<p style="padding-left:60px;">[Make sure that you have enough memory for the SGA as that of the Source DB, else you cannot mount using this<br />
spfile as its a clone of the source spfile. If not enough memory, then copy the initSHCL1DR2.ora to initSHCL1REC.ora]</p>
<ul>
<li> 2.c] Modify the initSHCL1REC.ora file</li>
</ul>
<p style="padding-left:60px;">Change the path for controlfiles,*dumps,archive_logs.<br />
Comment the cluster parameters<br />
Change the db_unique_name,service_names and domain<br />
Change the SGA and PGA<br />
Comment/change those parameters that refer the RAC instances.</p>
<ul>
<li> 2.d] Using this new init.ora file, start the instance in nomount mode.</li>
</ul>
<ul>
<li> 2.e] Restore the controlfile from the backup</li>
</ul>
<p style="padding-left:60px;">
<pre style="padding-left:60px;"><span style="color:#333399;">export ORACLE_SID=SHCL1REC</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;"> rman target /    
 restore controlfile from '/u02/oracle/shcl1/flashbacklog/SHCL1DR/autobackup/2009_07_23/o1_mf_s_692991347_56j874gd_.bkp';
 alter database mount;</span></pre>
<pre style="padding-left:60px;"><span style="color:#008000;">RMAN&gt; restore controlfile from '/u02/oracle/shcl1/flashbacklog/SHCL1DR/autobackup/2009_07_22/o1_mf_s_692897986_56ff1mk7_.bkp';
Starting restore at 22-JUL-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=647 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:04
output filename=/u02/oracle/shcl1rec/control1
output filename=/u02/oracle/shcl1rec/control2
output filename=/u02/oracle/shcl1rec/control3
Finished restore at 22-JUL-09
RMAN&gt;
RMAN&gt; alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN&gt;</span>
<span style="color:#333399;"> </span></pre>
<p style="padding-left:60px;">Confirm that the control files are created under /u02/oracle/shcl1rec/.</p>
<ul>
<li> 2.f] Create the password file for the new instance.</li>
</ul>
<p style="padding-left:60px;">RMAN need to connect to the new instance as sysdba, so create the password file.<br />
For simplicity copy the password file of the source.</p>
<pre style="padding-left:60px;"> <span style="color:#333399;">cp $ORACLE_HOME/dbs/orapwSHCL1DR2 $ORACLE_HOME/dbs/orapwSHCL1REC</span></pre>
<ul>
<li> 2.g] Create the tns entry</li>
</ul>
<p style="padding-left:60px;">RMAN would need dedicated connection, so if dispatchers are configured, then make sure you have SERVER=DEDICATED<br />
embedded in the tnsenrty.</p>
<pre style="padding-left:60px;"><span style="color:#333399;">SHCL1REC =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST=10.28.19.6)(PORT= 1521))
 (CONNECT_DATA = (SERVICE_NAME = SHCLREC.s.com) (SERVER = DEDICATED))
)   </span></pre>
<ul>
<li> 2.h] Configure the persistant parameters for the new instance</li>
</ul>
<p style="padding-left:60px;">Configure the rman persistant parameter (to change the connection string)</p>
<pre style="padding-left:60px;"><span style="color:#333399;"> CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 4 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 5 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';
 CONFIGURE CHANNEL 6 DEVICE TYPE DISK FORMAT '/u04/RMAN_BACKUPS/%d_%I_%U' connect 'sys/pasd@SHCL1REC';    </span></pre>
<ul>
<li> 2.i] Prepare the RMAN restore script and restore it.</li>
</ul>
<p style="padding-left:60px;">Since we are using a different path for datafiles, we need to specify it using the &#8216;SET NEWNAME&#8217; and rename the<br />
redo log files.</p>
<p style="padding-left:60px;">I used the below pl/sql to generate the script.</p>
<pre style="padding-left:60px;"><span style="color:#333399;">sqlplus / as sysdba
set head off
set feedback off
set pages 1000
set lines 160
set serveroutput on
--The below plsql is for creating script for renaming the datafile
declare
 dfile varchar2(100);
 fileno varchar2(100);
 begin
 for d_path in (select file#,name from v\$datafile)
 loop
 dfile :=SUBSTR(d_path.name, INSTR(d_path.name,'/', 1, 5)+1);
 fileno := d_path.file#;
 dbms_output.put_line('set newname for datafile '||fileno||' to ''/u02/oracle/shcl1rec/'||dfile||''';');
 end loop;
 end;
/
--The below plsql is for creating script for renaming the log files
declare
 rlog varchar2(100);
 begin
 for l_path in (select member from v\$logfile)
 loop
 rlog :=SUBSTR(l_path.member, INSTR(l_path.member,'/', 1, 5)+1);
 dbms_output.put_line('sql "alter database rename file '''''||l_path.member||''''' to ''''/u02/oracle/shcl1rec/'||rlog||''''' ";');
 --dbms_output.put_line(rlog);
 end loop;
 end;
/</span></pre>
<p style="padding-left:60px;">Below is the script that i used</p>
<pre style="padding-left:60px;"><span style="color:#333399;">T02[SHCL1DR2]$ cat /export/home/oraprd/restore.sh        </span>
<span style="color:#333399;">#!/bin/ksh</span>
<span style="color:#333399;">rman target / &lt;&lt;EOF    </span>
<span style="color:#333399;">set newname for datafile 1 to '/u02/oracle/shcl1rec/system01.dbf';</span>
<span style="color:#333399;">set newname for datafile 2 to '/u02/oracle/shcl1rec/undo01.dbf';</span>
<span style="color:#333399;">set newname for datafile 3 to '/u02/oracle/shcl1rec/sysaux01.dbf';</span>
<span style="color:#333399;">set newname for datafile 4 to '/u02/oracle/shcl1rec/undo02.dbf';</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo1_1.log'' to ''/u02/oracle/shcl1rec/redo1_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo1_2.log'' to ''/u02/oracle/shcl1rec/redo1_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo2_1.log'' to ''/u02/oracle/shcl1rec/redo2_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo2_2.log'' to ''/u02/oracle/shcl1rec/redo2_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo3_1.log'' to ''/u02/oracle/shcl1rec/redo3_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo3_2.log'' to ''/u02/oracle/shcl1rec/redo3_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo4_1.log'' to ''/u02/oracle/shcl1rec/redo4_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo4_2.log'' to ''/u02/oracle/shcl1rec/redo4_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo5_1.log'' to ''/u02/oracle/shcl1rec/redo5_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo5_2.log'' to ''/u02/oracle/shcl1rec/redo5_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo6_1.log'' to ''/u02/oracle/shcl1rec/redo6_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo6_2.log'' to ''/u02/oracle/shcl1rec/redo6_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo7_1.log'' to ''/u02/oracle/shcl1rec/redo7_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo7_2.log'' to ''/u02/oracle/shcl1rec/redo7_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/onlinelog/redo8_1.log'' to ''/u02/oracle/shcl1rec/redo8_1.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u03/oracle/shcl1/onlinelog/redo8_2.log'' to ''/u02/oracle/shcl1rec/redo8_2.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo01.log'' to ''/u02/oracle/shcl1rec/standby_redo01.log'' ";</span>
<span style="color:#333399;">sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo02.log'' to ''/u02/oracle/shcl1rec/standby_redo02.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo03.log'' to ''/u02/oracle/shcl1rec/standby_redo03.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo04.log'' to ''/u02/oracle/shcl1rec/standby_redo04.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo05.log'' to ''/u02/oracle/shcl1rec/standby_redo05.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo06.log'' to ''/u02/oracle/shcl1rec/standby_redo06.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo07.log'' to ''/u02/oracle/shcl1rec/standby_redo07.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo08.log'' to ''/u02/oracle/shcl1rec/standby_redo08.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo09.log'' to ''/u02/oracle/shcl1rec/standby_redo09.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/standby_redo10.log'' to ''/u02/oracle/shcl1rec/standby_redo10.log'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl0.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl0.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl1.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl1.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl2.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl2.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl3.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl3.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_2srl4.f'' to ''/u02/oracle/shcl1rec/SHCL1_2srl4.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_1srl0.f'' to ''/u02/oracle/shcl1rec/SHCL1_1srl0.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_1srl1.f'' to ''/u02/oracle/shcl1rec/SHCL1_1srl1.f'' ";
sql "alter database rename file ''/u04/oracle/shcl1/dataguard/SHCL1_1srl2.f'' to ''/u02/oracle/shcl1rec/SHCL1_1srl2.f'' ";
restore database;switch datafile all;
recover database;
exit;
EOF
exit    
T02[SHCL1DR2]$                
T02[SHCL1DR2]$ nohup /export/home/oraprd/restore.sh &gt; /export/home/oraprd/restore.log 2&gt;&amp;1 &amp;</span></pre>
<p style="padding-left:60px;">If you are applying the archive logs to recover to a point in time, you might want to disable &#8216;Block Change Tracking&#8217; before &#8216;recover&#8217; if it is enabled.</p>
<p style="padding-left:60px;">SQL&gt; ALTER DATABASE DISABLE BLOCK CHANGE TRACKING</p>
<ul>
<li> 2.j] Open the database using RESETLOGS</li>
</ul>
<pre style="padding-left:60px;"><span style="color:#333399;"> rman target /
 alter database open resetlogs;
 Opening the database would create the redologs, but not the standby logs.</span></pre>
<p style="padding-left:30px;">
<ul>
<li> 2.k] Remove the standby redologs</li>
</ul>
<p style="padding-left:30px;">Since the source db contained standby redo logs, either we should create it or should drop them, else we would<br />
get ORA-00313 errors as the files are not created along with the redologs.</p>
<pre style="padding-left:60px;"><span style="color:#333399;"> Errors in file /u01/app/oracle/admin/SHCL1REC/bdump/shcl1rec_arc2_12529.trc:
 ORA-00313:

 *** SERVICE NAME:(SYS$BACKGROUND) 2009-07-24 17:59:53.687
 *** SESSION ID:(631.5) 2009-07-24 17:59:53.687
 *** 2009-07-24 17:59:53.687 2561 kcrf.c
 tkcrf_clear_srl: Started clearing Standby Redo Logs   
 ORA-00312: /u02/oracle/shcl1rec/standby_redo01.log'
 SVR4 Error: 2: No such file or directory
 Additional information: 3                              
 ORA-00312: /u02/oracle/shcl1rec/standby_redo02.log'
 SVR4 Error: 2: No such file or directory</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;"> SQL&gt; select group#,status,type from v$logfile;

 GROUP# STATUS                TYPE
---------- --------------------- ---------------------
 1                       ONLINE
 1                       ONLINE
 2                       ONLINE
 2                       ONLINE
 3                       ONLINE
 3                       ONLINE
 4                       ONLINE
 4                       ONLINE
 5                       ONLINE
 5                       ONLINE
 6                       ONLINE
 6                       ONLINE
 7                       ONLINE
 7                       ONLINE
 8                       ONLINE
 8                       ONLINE
 9                       STANDBY
 10                       STANDBY
 11                       STANDBY
 12                       STANDBY
 13                       STANDBY
 14                       STANDBY
 15                       STANDBY
 16                       STANDBY
 17                       STANDBY
 18                       STANDBY
 19                       STANDBY
 20                       STANDBY
 21                       STANDBY
 22                       STANDBY
 23                       STANDBY
 24                       STANDBY
 25                       STANDBY
 26                       STANDBY

34 rows selected.

 alter database drop standby logfile group 9
 alter database drop standby logfile group 10
 alter database drop standby logfile group 11
 alter database drop standby logfile group 12
 alter database drop standby logfile group 13
 alter database drop standby logfile group 14;
 alter database drop standby logfile group 15;
 alter database drop standby logfile group 16;
 alter database drop standby logfile group 17;
 alter database drop standby logfile group 18;
 alter database drop standby logfile group 19;
 alter database drop standby logfile group 20;
 alter database drop standby logfile group 21;
 alter database drop standby logfile group 22;
 alter database drop standby logfile group 23;
 alter database drop standby logfile group 24;
 alter database drop standby logfile group 25;
 alter database drop standby logfile group 26;</span></pre>
<p style="padding-left:30px;">
<ul>
<li> 2.l] Disable the redo thread(unused)</li>
</ul>
<p style="padding-left:60px;">Typically, an oracle instance would have only 1 redo thread. An n node RAC would have n redo threads.<br />
Since we restored the backup of a 2 node RAC database to a single instance, whilst startup of the single instnace<br />
Oracle would consider one of the thread as Private to the instance and the other as Public.<br />
A peep into the alert.log says, this instance has mounted redo thread 1.</p>
<pre style="padding-left:60px;"><span style="color:#333399;"> :
 Mon Jul 27 13:45:56 2009
 Successful mount of redo thread 1, with mount id 1863696975
 Mon Jul 27 13:45:56 2009
 Database mounted in Exclusive Mode
 Completed: ALTER DATABASE   MOUNT
 :

 SQL&gt; select group#,thread#,sequence#,status from v$log;

 GROUP#    THREAD#  SEQUENCE# STATUS
 ---------- ---------- ---------- ------------------------------------------------
 1          1          5 INACTIVE
 2          1          6 ACTIVE
 3          1          7 CURRENT
 4          1          4 INACTIVE
 5          2          1 INACTIVE
 6          2          2 INACTIVE
 7          2          3 INACTIVE
 8          2          4 CURRENT

 8 rows selected.</span></pre>
<p style="padding-left:60px;">Groups 1-4 belong to the Thread 1, which is private to this instance and 5-8 belong to Thread 2, which is public.<br />
Means, this instance would write the commit/rollback changes only to thread 1, but in case of recovery it would use<br />
thread 2 also.</p>
<p>A look into the archivelog destination says,</p>
<pre style="padding-left:60px;"><span style="color:#333399;"> -rw-r-----   1 oraprd   oinstall    1024 Jul 27 14:03 SHCL1REC_2_2_693078959.arch
 -rw-r-----   1 oraprd   oinstall 4768768 Jul 27 14:03 SHCL1REC_1_5_693078959.arch
 -rw-r-----   1 oraprd   oinstall    1024 Jul 27  2009 SHCL1REC_2_3_693078959.arch
 -rw-r-----   1 oraprd   oinstall 1798144 Jul 27  2009 SHCL1REC_1_6_693078959.arch</span></pre>
<p style="padding-left:60px;">The size of the archive logs created by Thread 2 are much small when compared to those created by Thread 1.<br />
I used the logminer utility to confirm that the Thread 2 does not contain any Undo/Rollback data.</p>
<p>&#8211;Mining archvielog from Thread 1</p>
<pre style="padding-left:60px;"><span style="color:#333399;"> EXECUTE DBMS_LOGMNR.ADD_LOGFILE( LOGFILENAME =&gt; '/u02/oracle/shcl1rec/archivelogs/SHCL1REC_1_6_693078959.arch', OPTIONS =&gt; DBMS_LOGMNR.NEW);
 EXECUTE DBMS_LOGMNR.START_LOGMNR( OPTIONS =&gt; DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);
 SQL&gt; select count(8) from V$LOGMNR_CONTENTS;
 COUNT(8)
 ----------
 5449
 EXECUTE DBMS_LOGMNR.END_LOGMNR();</span></pre>
<p style="padding-left:60px;">&#8211;Mining archvielog from Thread 2</p>
<pre style="padding-left:60px;"> <span style="color:#333399;">EXECUTE DBMS_LOGMNR.ADD_LOGFILE( LOGFILENAME =&gt; '/u02/oracle/shcl1rec/archivelogs/SHCL1REC_2_3_693078959.arch', OPTIONS =&gt; DBMS_LOGMNR.NEW);
 EXECUTE DBMS_LOGMNR.START_LOGMNR( OPTIONS =&gt; DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG);
 SQL&gt;  select count(8) from V$LOGMNR_CONTENTS;
 COUNT(8)
 ----------
 0
 EXECUTE DBMS_LOGMNR.END_LOGMN</span>R();</pre>
<p style="padding-left:60px;">No data is being written to the thread 2 ( log groups# 5,6,7 and 8 ), so we can disable it using:</p>
<pre style="padding-left:60px;"> <span style="color:#333399;">ALTER DATABASE DISABLE THREAD 2;</span></pre>
<p style="padding-left:60px;">
<pre style="padding-left:60px;"><span style="color:#333399;"> SQL&gt;  select group#,thread#,sequence#,status from v$log;

 GROUP#    THREAD#  SEQUENCE# STATUS
 ---------- ---------- ---------- ------------------------------------------------
 1          1          5 INACTIVE
 2          1          6 INACTIVE
 3          1          7 CURRENT
 4          1          4 INACTIVE
 5          2          1 INACTIVE
 6          2          2 INACTIVE
 7          2          3 INACTIVE
 8          2          4 INACTIVE

 8 rows selected.</span></pre>
<p style="padding-left:60px;">Since Group# 8 was the CURRENT(of Thread 2) before disabling, archive it.</p>
<pre style="padding-left:60px;"> <span style="color:#333399;">SQL&gt; alter system archive log group 8;</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;"> System altered.</span></pre>
<p style="padding-left:60px;">Now we can drop the groups that belonged to Thread 2.</p>
<pre style="padding-left:60px;"><span style="color:#333399;"> ALTER DATABASE DROP LOGFILE GROUP 5;
 ALTER DATABASE DROP LOGFILE GROUP 6;
 ALTER DATABASE DROP LOGFILE GROUP 7;
 ALTER DATABASE DROP LOGFILE GROUP 8;</span></pre>
<pre style="padding-left:60px;"><span style="color:#333399;">SQL&gt;  select group#,thread#,sequence#,status from v$log;</span>
<span style="color:#333399;"> </span>
<span style="color:#333399;"> GROUP#    THREAD#  SEQUENCE# STATUS</span>
<span style="color:#333399;"> ---------- ---------- ---------- ------------------------------------------------</span>
<span style="color:#333399;"> 1          1          5 INACTIVE</span>
<span style="color:#333399;"> 2          1          6 INACTIVE</span>
<span style="color:#333399;"> 3          1          7 CURRENT</span>
<span style="color:#333399;"> 4          1          4 INACTIVE</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=187&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2009/07/28/restore-the-rman-backup-of-a-rac-to-a-single-instance/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
		<item>
		<title>Get Metadata of an Object in Oracle</title>
		<link>http://boomslaang.wordpress.com/2009/06/29/get-metadata-of-an-object-in-oracle/</link>
		<comments>http://boomslaang.wordpress.com/2009/06/29/get-metadata-of-an-object-in-oracle/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 02:58:18 +0000</pubDate>
		<dc:creator>John Jacob</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[metadata of an object]]></category>
		<category><![CDATA[oracle metadata]]></category>
		<category><![CDATA[table structure in oracle]]></category>

		<guid isPermaLink="false">http://boomslaang.wordpress.com/?p=183</guid>
		<description><![CDATA[There are different methods to get the metadata of an object in Oracle, below are the few which i use. 1)Using exp and imp utilities .Export the table/schema with rows=n (This will not export the data but only the table structure) .Import it with indexfile=table_metadata.log (indexfile will make imp to write the contens of .dmp [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=183&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are different methods to get the metadata of an object in Oracle, below are the few which i use.</p>
<p><span style="text-decoration:underline;"><strong>1)Using exp and imp utilities</strong></span><br />
.Export the table/schema with rows=n (This will not export the data but only the table structure)<br />
.Import it with indexfile=table_metadata.log (indexfile will make imp to write the contens of .dmp file to the mentioned log file. Nothing will be done inside the schema)</p>
<p>To get the metdata of the table emp in schema john:</p>
<pre><span style="color:#333399;"> $ exp tables=john.emp file=john_emp.dmp rows=n
 $ imp full=y file=john_emp.dmp indexfile=john_emp_metadata.log</span>
<span style="color:#333399;"> $ cat john_emp_metadata.log
REM  CREATE TABLE "JOHN"."EMP" ("EMPNO" NUMBER, "ENAME" VARCHAR2(20),
REM  "SAL" NUMBER, "DEPTNO" NUMBER) PCTFREE 10 PCTUSED 40 INITRANS 1
REM  MAXTRANS 255 STORAGE(INITIAL 131072 FREELISTS 1 FREELIST GROUPS 1
REM  BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS ;
</span></pre>
<p><span style="text-decoration:underline;"><strong>2)Using DBMS_METADATA.GET_DDL()</strong></span></p>
<p>To get the metadata of individual objects:</p>
<p>select dbms_metadata.get_ddl(&#8216;&lt;OBJ_TYPE&gt;&#8217;,'&lt;OBJ_NAME&gt;&#8217;,'&lt;SCHEMA&gt;&#8217;) from dual;</p>
<pre><span style="color:#333399;">SQL&gt; SET PAGES 1000
SQL&gt; SET LONG 1000
SQL&gt; select dbms_metadata.get_ddl('TABLE','EMP','JOHN') from dual;
DBMS_METADATA.GET_DDL('TABLE',
--------------------------------------------------------------------------------
 CREATE TABLE "JOHN"."EMP"
 ("EMPNO" NUMBER,
 "ENAME" VARCHAR2(20),
 "SAL" NUMBER,
 "DEPTNO" NUMBER )
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"

</span></pre>
<p><span style="color:#333399;"></span>To get the metadata of the tables or indexes or materialized views with a &#8221; ; &#8221; at the end of each script use</p>
<pre>
<pre><span style="color:#333399;">SET LINE 240
SET ECHO OFF
SET PAGES 0
SET LONG 90000
SET HEADING OFF
SET TRIMSPOOL OFF
SET FEEDBACK OFF
SET LONGCHUNKSIZE 600</span>
<span style="color:#333399;">SPOOL USER_METADATA.LOG</span>
<span style="color:#333399;">EXEC DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);  </span>
<span style="color:#333399;">SELECT DBMS_METADATA.GET_DDL('TABLE',UT.TABLE_NAME) FROM USER_TABLES UT;</span>
<span style="color:#333399;">SELECT DBMS_METADATA.GET_DDL('INDEX',IDX.INDEX_NAME) FROM USER_INDEXES IDX;</span>
<span style="color:#333399;">SELECT DBMS_METADATA.GET_DDL(REPLACE(OBJECT_TYPE,' ','_'),OBJECT_NAME)
FROM USER_OBJECTS
WHERE OBJECT_TYPE IN ('MATERIALIZED VIEW');

SPOOL OFF</span></pre>
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/boomslaang.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/boomslaang.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/boomslaang.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/boomslaang.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/boomslaang.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/boomslaang.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/boomslaang.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/boomslaang.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/boomslaang.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/boomslaang.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/boomslaang.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/boomslaang.wordpress.com/183/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/boomslaang.wordpress.com/183/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/boomslaang.wordpress.com/183/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=boomslaang.wordpress.com&amp;blog=2073764&amp;post=183&amp;subd=boomslaang&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://boomslaang.wordpress.com/2009/06/29/get-metadata-of-an-object-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/07bdd99e922bd683bf6508a0f9ad08dc?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">J..J</media:title>
		</media:content>
	</item>
	</channel>
</rss>
