<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oracle DBA - Tips and Techniques</title>
	<atom:link href="http://gavinsoorma.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://gavinsoorma.com</link>
	<description>Knowledge Is Power - Share IT ....</description>
	<lastBuildDate>Thu, 08 Dec 2011 03:07:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Building a test 11gR2 RAC environment in minutes using Oracle Virtual Machine templates</title>
		<link>http://gavinsoorma.com/2011/11/3366/</link>
		<comments>http://gavinsoorma.com/2011/11/3366/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 02:55:32 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Oracle 11g release 2]]></category>
		<category><![CDATA[Real Application Clusters]]></category>
		<category><![CDATA[11gR2 RAC OVm template]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3366</guid>
		<description><![CDATA[<p>This note illustrates how we can set up an Orace 11g Release 2 Real Application Clusters environment for test purposes using the Oracle VM templates which are currently available in under 30 minutes!</p>
<p>The templates are available from the Oracle E-Delivery web site and are available in both OEL 32bit Linux as well as 64bit Linux.</p>
<p>While we are demonstrating a test or development RAC setup where a single Oracle VM server is hosting both the guest nodes, a &#8216;Production&#8217; type envrionment is also supported using the Oracle VM Templates where we have multiple OVM Servers and the shared disks are configured as &#8216;phy&#8217; devices which are then passed on to the guest Oracle VM&#8217;s. So there are a number of Oracle VM Servers in this case.</p>
<p>In this test environment, however, the shared disk is configured as &#8216;file&#8217; devices and both guests can run on the same Oracle VM Server.</p>
<p>In other words <p>Continue reading <a href="http://gavinsoorma.com/2011/11/3366/">Building a test 11gR2 RAC environment in minutes using Oracle Virtual Machine templates</a></p>

]]></description>
			<content:encoded><![CDATA[<p>This note illustrates how we can set up an Orace 11g Release 2 Real Application Clusters environment for test purposes using the Oracle VM templates which are currently available in <b>under 30 minutes</b>!</p>
<p>The templates are available from the Oracle E-Delivery web site and are available in both OEL 32bit Linux as well as 64bit Linux.</p>
<p>While we are demonstrating a test or development RAC setup where a single Oracle VM server is hosting both the guest nodes, a &#8216;Production&#8217; type envrionment is also supported using the Oracle VM Templates where we have multiple OVM Servers and the shared disks are configured as &#8216;phy&#8217; devices which are then passed on to the guest Oracle VM&#8217;s. So there are a number of Oracle VM Servers in this case.</p>
<p>In this test environment, however, the shared disk is configured as &#8216;file&#8217; devices and both guests can run on the same Oracle VM Server.</p>
<p>In other words we have one single DOM-0 and we use files located in the DOM-0 to emulate the shared disks for the Oracle RAC &#8216;cluster&#8217; nodes running in DOM-U.</p>
<p>The template requires about 40 Gb of disk space and assumes that we have at least 4 Gb of RAM available. In our test case, we have allocated 4 Gb of RAM to each Virtual Machine.</p>
<p>The template assumes the following are already in place.</p>
<p>a) We have already installed Oracle VM Server (we have used OVM 2.2)<br />
b) We have already installed and configured Oracle VM Manager (OVM 2.2)<br />
c) allocated 7 unused IP addresses and registered in our DNS</p>
<p>Assuming a two node RAC cluster, that is </p>
<p>2 IP&#8217;s for the public host names<br />
2 IP&#8217;s for the VIP<br />
3 IP&#8217;s for the SCAN </p>
<p>The high level steps involved would be:<br />
<UL><br />
<LI>Download the zip files from Oracle E-Delivery site<br />
<LI>Import the Virtual Machine template into OVM<br />
<LI>Create the ASM shared storage</p>
<li>Create the VM&#8217;s from the 11gR2 RAC template
<li>Add the shared disks to the VM&#8217;s
<li>Complete the first boot interview
<li>run the script buildcluster.sh which will install the 11g R2 Grid Infrastructure and database software and also create the ORCL RAC database
<li>Customize as required<br />
</UL></p>
<h5>Some resources</h5>
<p><UL><br />
<LI> <a href="http://gavinsoorma.com/wp-content/uploads/2011/12/Installation-of-VM-Manager-2.doc"> Installing OVM Manager 2.2 </a></p>
<p><LI><a href="http://gavinsoorma.com/wp-content/uploads/2011/12/OVM-2.2-Server-Installation.doc"> Installing OVM Server 2.2 </a></p>
<p><LI><a href="http://gavinsoorma.com/wp-content/uploads/2011/12/RAC_OVM_Templates_Overview1.pdf"> RAC OVM Templates Overview </a></p>
<p><LI><a href="http://gavinsoorma.com/wp-content/uploads/2011/12/rac11202-ovm-tmplt-test-config-170450.pdf">RAC 11g Release 2 (11.2.0.2.0) Oracle VM templates Test and Development Configuration&#8221;</a><br />
</UL></p>
<p>We need to unzip the 3 files we have downloaded fron the E-Delivery web site and then also extract the 11gR2 RAC template.</p>
<p>This is all done in the /OVS/seed_pool/ directory on the OVM Server </p>
<pre>
[root@kens-ovm-002 OVS]# mv p10113572*.zip ./tmp

[root@kens-ovm-002 OVS]# cd tmp

[root@kens-ovm-002 tmp]# ls
p10113572_10_Linux-x86-64_1of3.zip  p10113572_10_Linux-x86-64_2of3.zip  p10113572_10_Linux-x86-64_3of3.zip

[root@kens-ovm-002 tmp]# unzip -q p10113572_10_Linux-x86-64_1of3.zip
[root@kens-ovm-002 tmp]# unzip -q p10113572_10_Linux-x86-64_2of3.zip
[root@kens-ovm-002 tmp]# unzip -q p10113572_10_Linux-x86-64_3of3.zip

[root@kens-ovm-002 tmp]# cd /OVS/seed_pool/

[root@kens-ovm-002 seed_pool]# tar xzf /OVS/tmp/OVM_EL5U4_X86_64_11202RAC_PVM-1of2.tgz

[root@kens-ovm-002 seed_pool]# cat /OVS/tmp/OVM_EL5U4_X86_64_11202RAC_PVM-2of2-parta.tgz /OVS/tmp/OVM_EL5U4_X86_64_11202RAC_PVM-2of2-partb.tgz | tar xzf -
</pre>
<h4>Importing the Virtual Machine Template</h4>
<p>We will now import this template using OVM Manager.</p>
<p><b>Resources</b> >> <b>Virtual Machine Templates</b> and click on <b>Import</b> button</p>
<p><img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac6.png"></img></p>
<p>Our template is stored in the /OVS/seed_pool on our OVM Server machine. So we select the option &#8220;Select from Server Pool (Discover and Register)&#8221;</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac7.png"></img></p>
<p>From the <b>Virtual Machine Template Name</b> drop down list select the 11gR2 RAC PVM.</p>
<p>In the <b>Virtual Machine System Password</b> field, we need to enter the root password. <i>The template assumes the root password to be &#8216;ovsroot&#8217; and if we set it to anything else as in our case, we got an error</i>.</p>
<p>But there is a configuration file we can edit to change the default root password to whatever we desire and I will show you how that&#8217;s done in a bit.</p>
<p><img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac8.png"></img></p>
<p>Click on the <b>Confirm</b> button</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac9.png"></img></p>
<p>We will see that the status of the Virtual Machine Template is now changed to &#8220;Importing&#8221;</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac10.png"></img></p>
<p>
We will see that the status of the Virtual Machine Template is now changed to &#8220;Pending&#8221;</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac11.png"></img></p>
<p>We need to click on the <b>Approve</b> button</p>
<p><img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac12.png"></img></p>
<p>
We see that the template status has now changed to &#8220;Active&#8221; and we can now use this template to set up our 11g R2 RAC environment.</p>
<p><img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac13.png"></img></p>
<h4>Create the shared ASM disks </h4>
<p><b>Resources</b> >> <b>Shared Virtual Disks</b> >> <b>Create</b></p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac14.png"></img></p>
<p>Select the appropriate Server Pool Name and Group Name. </p>
<p>We will be creating 5 shared virtual disks &#8211; ASM1,ASM2,ASM3, ASM4 and ASM5 each of size 2048 Mb or 2 Gb</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac22.png"></img></p>
<p>Click on <b> Confirm</b></p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac32.png"></img></p>
<p>After the first disk ASM1 has been created, click on the <b>Create</b> button and similarly create the other ASM disks in the same manner</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac41.png"></img></p>
<p>We should now see all the five Shared Virtual Disks with status Active</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/rac51.png"></img></p>
<p><h4>Create the Virtual Machines from the imported 11gR2 RAC template </h4>
<p>Click on the <b>Create Virtual Machine</b> button</p>
<p><img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm1.png"></img></p>
<p>Select the option <b> Create virtual machine based on virtual machine template</b></p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm2.png"></img></p>
<p><p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm3.png"></img></p>
<p>Select the template <b>OVM_EL5U4_X86_64_11202RAC_PVM</b></p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm4.png"></img></p>
<p><b>Important</b></p>
<p>Do not forget to add a SECOND Virtual Network Interface &#8211; in this case the name is VIF1 and Bridge name is xenbr1</p>
<p>Keep a note of the console password as we will need to enter this at a later stage </p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm5.png"></img></p>
<p><p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm6.png"></img></p>
<p>Note the status of the Virtual Machine is now &#8216;Creating&#8217;</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm7.png"></img></p>
<p>After the Virtual Machine is created, it is in a Powered Off state</p>
<p>Click on the <b>Configure</b> tab as we would like to change the Memory Size of this VM from 2 Gb to 4 Gb</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm8.png"></img></p>
<p>Change the <b>Maximum Memory Size</b> and <b> Memory Size </b> to 4096</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm9.png"></img></p>
<p>Change the Memory Size of the second VM as well to 4096 MB and now we will see that both the VM&#8217;s have been created and are in the Powered Off state</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm10.png"></img></p>
<p><h4>Attach the Shared Disks to both the VM&#8217;s </h4>
<p>Select one of the Virtual Machines and click on the <b>Configure</b> tab</p>
<p>Select the <b>Storage</b> tab and then the <b>Attach/Detach Shared Virtual Disk</b></p>
<p><img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm11.png"></img></p>
<p>We see the 5 Shared Virtual Disks which we had earlier created &#8211; Click on <b>Move All</b></p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm12.png"></img></p>
<p><p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/racvm13.png"></img></p>
<p>We can now see that the 5 ASM Shared Disks have been attached to the VM and the disk status is Active</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/racvm141.png"></img></p>
<p><b>Repeat the same process for the second VM and attach the same 5 ASM disks to that Virtual Machine as well</b></p>
<h4> Complete the First Boot Interview </h4>
<p>Power On both the VM&#8217;s </p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac1.png"></img></p>
<p>Once the machines are powered on, click on the <b>Console</b> tab and launch both the consoles</p>
<p>This is called the First Boot Interview stage.</p>
<p>On the first screen we enter <b> YES</b> and on the second screen we enter <b>NO</b>. </p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac2.png"></img></p>
<p>Only after we have entered NO on the second console does the install continue.</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac3.png"></img></p>
<p>We need to now provide the IP&#8217;s for the Public, Private and Virtual hostnames</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac4.png"></img></p>
<p><p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac5.png"></img></p>
<p>We need to enter the SCAN name for this cluster. <b>Note &#8211; we should have registered the SCAN in our DNS already and have assigned 3 unused IP addresses to the SCAN</b></p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac6.png"></img></p>
<p><p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac7.png"></img></p>
<p><h4> Install Grid Infrastructure and Oracle 11g R2 RAC </h4>
<p>We now need to run the <b>buildcluster.sh </b> script. This needs to be on only ONE of the VM&#8217;s &#8211; the one we have designated to be the first node of the cluster.</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac8.png"></img></p>
<p>Note &#8211; because we had not used the standad root password <b>ovsroot</b>, we find that the script has failed becuase it tries to establish a passwordless ssh session which fails.</p>
<p>We needed to edit the /u01/racovm/<b>params.ini</b> file and change the entry for ROOTUSERPASSWORD to the one we want.</p>
<p>Have a read through of the params.ini file as it is through this file that we can add a lot of customisation to the RAC cluster build.</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac9.png"></img></p>
<p>While the RAC installation is in progress, we can monitor the same by doing a tail -f of the <b>progress-racovm.out </b> file located on /tmp</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/12/11grac10.png"></img></p>
<p>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/11/3366/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle 11g Fusion Middleware Installation on Linux</title>
		<link>http://gavinsoorma.com/2011/11/oracle-11g-fusion-middleware-installation-on-linux/</link>
		<comments>http://gavinsoorma.com/2011/11/oracle-11g-fusion-middleware-installation-on-linux/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 00:31:59 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[10g Application Server]]></category>
		<category><![CDATA[11g Fusion Middleware]]></category>
		<category><![CDATA[Identity Management]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Oracle 11g Fusion Middleware]]></category>
		<category><![CDATA[SSO]]></category>
		<category><![CDATA[Weblogic]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3310</guid>
		<description><![CDATA[<p>This note describes the (long) process of installing an 11g Fusion Middleware environment with Forms, Reports, Discoverer and Portal on an Oracle Enterprise Linux 5.6 64 Bit platform.</p>
<p>If you are not using Oracle Portal , then you do not need to configure Identity Management and Single Sign On which is a real big pain as there is no 11g SSO as yet and we have to install, upgrade and configure 10g SSO/DAS as well with a number of patches.</p>
<p>These are the top level steps:</p>
Install Java SE Development Kit 6u25
<p></p>
Install Oracle Weblogic Server 11g Release 1 ( 10.3.2)
<p></p>
Install Oracle 11g R2 Database software (can be on same machine as Middleware  or different server)
<p></p>
Create the 11g R2 repository database
<p></p>
Download the Repository creation for Windows available in 32 bit for Linux and Windows ( ofm_rcu_win32_11.1.1.3.3_disk1_1of1.zip) – change compatibility for Windows 7 to run it
<p></p>
Make changes to the database required for running  <p>Continue reading <a href="http://gavinsoorma.com/2011/11/oracle-11g-fusion-middleware-installation-on-linux/">Oracle 11g Fusion Middleware Installation on Linux</a></p>

]]></description>
			<content:encoded><![CDATA[<p>This note describes the (long) process of installing an <strong>11g Fusion Middleware</strong> environment with <strong>Forms, Reports, Discoverer and Portal </strong>on an <strong>Oracle Enterprise Linux </strong>5.6 64 Bit platform.</p>
<p><em>If you are not using Oracle Portal , then you do not need to configure Identity Management and Single Sign On</em> which is a real big pain as there is no 11g SSO as yet and we have to install, upgrade and configure 10g SSO/DAS as well with a number of patches.</p>
<p>These are the top level steps:</p>
<li>Install Java SE Development Kit 6u25</li>
<p><BR></p>
<li>Install Oracle Weblogic Server 11g Release 1 ( 10.3.2)</li>
<p><BR></p>
<li>Install Oracle 11g R2 Database software (can be on same machine as Middleware  or different server)</li>
<p><BR></p>
<li>Create the 11g R2 repository database</li>
<p><BR></p>
<li>Download the Repository creation for Windows available in 32 bit for Linux and Windows ( ofm_rcu_win32_11.1.1.3.3_disk1_1of1.zip) – change compatibility for Windows 7 to run it</li>
<p><BR></p>
<li>Make changes to the database required for running  the RCU</li>
<p><BR></p>
<li>Run the RCU and create all the required schemas in the repository database like DEV_PORTAL, DEV_DISCOVERER etc</li>
<p><BR></p>
<li>Install 11g Identity management </li>
<p><BR></p>
<li><strong>Install 10g SSO </strong></li>
<ul>
<li>
<li>Run inspre11.pls (with -op1)
<li>Install SSO MRCA 10.1.4.3.1 on Windows  &#8211; not available for 64 bit Linux  &#8211; change compatibility to Windows XP since we have installed on Windows 7 client PC  (ofm_sso_rcu_win_10.1.4.3.1_disk1_1of1.zip)
<li>Reset the ODS Password
<li> Run inspre11.pls (with -op2)
<li>Install SSO/DAS 10.1.4.0.1 (into a NEW Oracle Home &#8211; this must be a different Oracle Home from OID/DIP 11gR1)
<li>Apply patch 688088 (p6880880_101000_Linux-x86-64.zip)
<li> Apply Patch 5649850 for release 10.1.0.5 (p5649850_10105_GENERIC.zip)
<li>Apply patch  6265268 (p6265268_101430_GENERIC.zip)
<li> Upgrade SSO/DAS to 10.1.4.3 (p7215628_101430_LINUX.zip)
<li> Run inspre11.pls (with -op3)
<p></LI>
</ul>
<p><BR></p>
<li>Install Oracle 11g Portal, Forms, Reports and Discoverer</li>
<p><strong>Read the note:</strong></p>
<p><a href="http://gavinsoorma.com/wp-content/uploads/2011/11/11g-Fusion-Middleware-Installation-Part-1.doc">11g-Fusion-Middleware-Installation-Part-1.doc</a></p>
<p><a href="http://gavinsoorma.com/wp-content/uploads/2011/11/11g-Fusion-Middleware-Installation-Part-2.doc">11g-Fusion-Middleware-Installation-Part-2.doc</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/11/oracle-11g-fusion-middleware-installation-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OEM Tablespace Space Used % Alerts and the AUTOEXTEND effect</title>
		<link>http://gavinsoorma.com/2011/11/oem-tablespace-space-used-alerts-and-the-autoextend-effect/</link>
		<comments>http://gavinsoorma.com/2011/11/oem-tablespace-space-used-alerts-and-the-autoextend-effect/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 02:59:50 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[EM Grid Control]]></category>
		<category><![CDATA[autoextend]]></category>
		<category><![CDATA[DBA_TABLESPACE_USAGE_METRICS]]></category>
		<category><![CDATA[Grid control]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[OEM]]></category>
		<category><![CDATA[tablespace space used]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3294</guid>
		<description><![CDATA[<p>I performed a simple test to try and help clarify a rather confusing topic about when OEM will send out alerts for tablespace usage and what happens when autoextend is turned on and what about the MAXSIZE and UNLIMITED parameters of the AUTOEXTEND ON clause.</p>
<p>A number of Metalink support notes discuss this topic like:</p>
<p>Database Tablespace Full Metric Alerts not Generated In Grid Control [ID 357049.1]
Troubleshooting a Database Tablespace Used(%) Alert problem [ID 403264.1]
Oracle Recommended Patches For Tablespace Monitoring using the Tablespace Space Used % metric [ID 849498.1]</p>
<p>What happens if autoextend is turned on but in some cases we have specified an upper limit for the MAXSIZE parameter or have just left it to UNLIMITED? How will OEM handle those cases?</p>
<p>To clarify things, OEM alert notification mechanism will query the DBA_TABLESPACE_USAGE_METRICS view to determine the Used % in a tablespace in relation to the Warning and Critical thresholds which have been <p>Continue reading <a href="http://gavinsoorma.com/2011/11/oem-tablespace-space-used-alerts-and-the-autoextend-effect/">OEM Tablespace Space Used % Alerts and the AUTOEXTEND effect</a></p>

]]></description>
			<content:encoded><![CDATA[<p>I performed a simple test to try and help clarify a rather confusing topic about when OEM will send out alerts for tablespace usage and what happens when autoextend is turned on and what about the MAXSIZE and UNLIMITED parameters of the AUTOEXTEND ON clause.</p>
<p>A number of Metalink support notes discuss this topic like:</p>
<p>Database Tablespace Full Metric Alerts not Generated In Grid Control [ID 357049.1]<br />
Troubleshooting a Database Tablespace Used(%) Alert problem [ID 403264.1]<br />
Oracle Recommended Patches For Tablespace Monitoring using the Tablespace Space Used % metric [ID 849498.1]</p>
<p>What happens if autoextend is turned on but in some cases we have specified an upper limit for the MAXSIZE parameter or have just left it to UNLIMITED? How will OEM handle those cases?</p>
<p>To clarify things, OEM alert notification mechanism will query the <strong>DBA_TABLESPACE_USAGE_METRICS</strong> view to determine the Used % in a tablespace in relation to the Warning and Critical thresholds which have been set.  This is true for Oracle 10g and above and if we are using Locally Managed tablespaces.</p>
<p>It does not look at DBA_FREE_SPACE or DBA_TABLESPACES for that matter to determine how much of free space is there in a tablespace. In fact many of us had these custom scripts which query these two views and in case of databases which had many tablespaces like an Oracle Applications environment, this query could take a long time to return the results and was quite a &#8216;costly&#8217; query.</p>
<p>It is important to note that <strong>this metric takes into consideration the available disk space into which the tablespace&#8217;s datafile can extend if autoextend is turned on</strong>.</p>
<p>With a 8k block size, on most Unix systems the maximum a datafile can extend upto with autoextend turned on is 32 Gb.  In that case the DBA_TABLESPACE_USAGE_METRICS view will use 32 Gb as the basis for calculating the available free space in the tablespace because if a tablespace consists of one datafile, that is the maximum size the tablespace can grow to.</p>
<p>In the figure below of the OEM Tablespaces screen (Database Instance Home Page &#8211;> Administration &#8211;> Tablespaces), we see some tablespaces which have used space greater 95%, but we have not received any alert from OEM even though the Critical threshold has been crossed.</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/autoext1.png"></img></p>
<p>Why is that the case?</p>
<p>This is because of the AUTOEXTEND setting.  In the figure above, some tablespaces have datafiles which have autoextend turned on and some do not have autoextend enabled.</p>
<p>In this case, the datafile of the SYSTEM tablespace does have autoextend turned on, and even though the SYSTEM tablespace is 99% full, OEM does not consider it a candidate for an alert notification because the DBA_TABLESPACE_USAGE_METRICS view shows it only as 15.71% used.</p>
<p><PRE>
SQL>  SELECT TABLESPACE_NAME TBSP_NAME
  2  , USED_SPACE
  3  , TABLESPACE_SIZE TBSP_SIZE
  4  , USED_PERCENT
  5  FROM SYS.DBA_TABLESPACE_USAGE_METRICS
  6  order by 4;

TBSP_NAME                      USED_SPACE  TBSP_SIZE USED_PERCENT
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;
&#8230;
&#8230;

SYSTEM                              91512     582427   15.7121837
</pre>
<p>So how did Oracle compute this 15.71% used figure? (91512/582427*100)</p>
<p>Note the USED_SPACE and TBSP_SIZE columns are in blocks - in this case the DB_BLOCK_SIZE of the database is 8k or 8192 bytes.</p>
<p>The maximum size which the file can extend upto via autoextend is 582427 blocks or 4450 Mb</p>
<p>582427 (blocks) *8192 (each block size)  / 1048576 (to convert to MB) = 4450 MB </p>
<p>The SYSTEM tablespace is made up of one datafile and that datafile is about 714 MB used.  (91512* 8192/1048576)</p>
<p>Let us create a tablespace TESTME of size 50 Mb.</p>
<pre>
SQL>  create tablespace testme
  2  datafile '/u01/oradata/HDESK11G/testme01.dbf' size 50m;
</pre>
<p>We now create a table and use the TESTME tablespace to store the table data</p>
<pre>
SQL> create table sh.test
  2   tablespace testme
  3   as select * from sh.sales;

Table created.
</pre>
<p>Since we have not specified any AUTOEXTEND for the datafile of the TESTME tablespace, the TBSP_SIZE column for this tablespace shows 6400 blocks which is equal to 50 MB and the tablespace is about 74% full after we have created and populated the TEST table.</p>
<pre>
TBSP_NAME                      USED_SPACE  TBSP_SIZE USED_PERCENT
------------------------------ ---------- ---------- ------------
...
...
SYSTEM                              91512     552558   16.5615193
TESTME                               4736       6400           74
</pre>
<p>Let us now force a space used alert to be fired from OEM </p>
<pre>
SQL> insert into  sh.test
  2  select * from sh.sales;
insert into  sh.test
                *
ERROR at line 1:
ORA-01653: unable to extend table SH.TEST by 128 in tablespace TESTME
</pre>
<p>We can see that the tablespace TESTME is now 100% full  and an alert has been raised as well.</p>
<pre>
TBSP_NAME                      USED_SPACE  TBSP_SIZE USED_PERCENT
------------------------------ ---------- ---------- ------------
...
...
TESTME                               6400       6400          100
</pre>
<pre>
SELECT REASON
, METRIC_VALUE
, MESSAGE_TYPE
, TO_CHAR(CREATION_TIME,'DD-MON-YYYY HH24:MI:SS')
, HOST_ID
FROM SYS.DBA_OUTSTANDING_ALERTS;

SQL> /

REASON
----------------------------------------------
METRIC_VALUE MESSAGE_TYPE TO_CHAR(CREATION_TIM
------------ ------------ --------------------
HOST_ID
----------------------------------------------
Tablespace [TESTME] is [100 percent] full
         100 Warning      15-NOV-2011 08:38:39
kens-orasql-001.corporateict.domain
</pre>
<p>Now we turn on AUTOEXTEND for the datafile of the TESTME tablespace - note in this case we specify the MAXIZE as UNLIMITED</p>
<pre>

SQL> alter database datafile '/u01/oradata/HDESK11G/testme01.dbf' autoextend on next 100M maxsize unlimited;

Database altered.
</pre>
<p>Now we see that the DBA_TABLESPACE_USAGE_METRICS view shows the tablespace as only 1.37% used. </p>
<p>Currently 50 MB is being used (the file size initially was 50 Mb and all the space in the datafile was used when we inserted rows into the table), but the TBSP_SIZE is showing 466770 (blocks) which is about 3646 Mb ( 466770*8192/1048576).</p>
<p>So why has Oracle chosen this figure?</p>
<p>If we run a df -k command, we see that the /u01 file system where this datafile of the TESTME tablespace is located has about 3.7 GB of free space and with AUTOEXTEND turned on, Oracle estimates that this is the maximum that the datafile can extend upto.</p>
<pre>

TBSP_NAME                      USED_SPACE  TBSP_SIZE USED_PERCENT
------------------------------ ---------- ---------- ------------
...
....
TESTME                               6400     466770   1.37112497

SQL> !df -k |grep u01

Filesystem           1K-blocks      Used Available Use% Mounted on

/dev/xvdb1            20635700  16007140   3780324  82% /u01
</pre>
<p>Now what happens if we instead specify an upper file size limit to which the datafile can extend upto with autoextend turned on.</p>
<pre>

SQL> alter database datafile '/u01/oradata/HDESK11G/testme01.dbf' autoextend on next 100M maxsize 500M;

Database altered.
</pre>
<p>We now see that the TESTME tablespace is 10% full because the maximum size that this tablespace can now grow to is 64000 blocks or 500 Mb and currently it has 50 Mb of used space.</p>
<p>The tablespaces screen from OEM however shows the tablepace as 33% full because it has grown the datafile to 150 MB from 50 Mb as we had specified the NEXT increment as 100 MB when we had enabled autoextend for the datafile of the TESTME tablesapace.</p>
<pre>
TBSP_NAME                      USED_SPACE  TBSP_SIZE USED_PERCENT
------------------------------ ---------- ---------- ------------
...
...
TESTME                               6400      64000           10
</pre>
<p>But what we see from OEM Tablespaces screen (Database Instance Home Page --> Administration --> Tablespaces), the tablespace is 33% full and not 10%.</p>
<p>Remember, this is not what OEM will use to determine the tablespace free space available and when it needs to raise an alert if the space usage threshold is crossed.</p>
<p>
<img src="http://gavinsoorma.com/wp-content/uploads/2011/11/autoext2.png"></img></p>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/11/oem-tablespace-space-used-alerts-and-the-autoextend-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle 11g Cross Platform Active Standby &#8211; Windows Primary database and Linux Active Standby</title>
		<link>http://gavinsoorma.com/2011/11/oracle-11g-cross-platform-active-standby-windows-primary-database-and-linux-active-standby/</link>
		<comments>http://gavinsoorma.com/2011/11/oracle-11g-cross-platform-active-standby-windows-primary-database-and-linux-active-standby/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 14:29:32 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[Backup and Recovery]]></category>
		<category><![CDATA[High Availability]]></category>
		<category><![CDATA[Oracle 11g release 2]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3279</guid>
		<description><![CDATA[<p>This note describes the procedure of configuring a cross platform  using the 11g RMAN Active Duplicate as well as an Active Standby Database setup over a Windows and Linux platform.</p>
<p>The Metalink note Data Guard Support for Heterogeneous Primary and Physical Standbys in Same Data Guard Configuration [ID 413484.1] describes the supported cross platform combinations between a primary and standby database.</p>
<p>In Oracle 10g, we could have a 32 bit and 64 bit Primary/Standby combination on some supported platforms and in 11g this has been extended to cover heterogenous platforms for the Primary and Standby database.</p>
<p>The environment used is as follows:</p>
<p>Primary </p>
<p>Windows 7 64 bit
11g Release 2
DB_UNIQUE_NAME=orcl</p>
<p>Active Standby </p>
<p>Oracle Enterprise Linux 5.7 64 bit
11g Release 2
DB_UNIUE_NAME=orcl_dr</p>
<p>Read the rest of the note Oracle 11g Cross platform Active Standby &#8211; Windows Primary database and Linux Active Standby </p>
]]></description>
			<content:encoded><![CDATA[<p>This note describes the procedure of configuring a cross platform  using the 11g RMAN Active Duplicate as well as an Active Standby Database setup over a Windows and Linux platform.</p>
<p>The Metalink note Data Guard Support for Heterogeneous Primary and Physical Standbys in Same Data Guard Configuration [ID 413484.1] describes the supported cross platform combinations between a primary and standby database.</p>
<p>In Oracle 10g, we could have a 32 bit and 64 bit Primary/Standby combination on some supported platforms and in 11g this has been extended to cover heterogenous platforms for the Primary and Standby database.</p>
<p>The environment used is as follows:</p>
<p><strong>Primary</strong> </p>
<p>Windows 7 64 bit<br />
11g Release 2<br />
DB_UNIQUE_NAME=orcl</p>
<p><strong>Active Standby </strong></p>
<p>Oracle Enterprise Linux 5.7 64 bit<br />
11g Release 2<br />
DB_UNIUE_NAME=orcl_dr</p>
<p>Read the rest of the note <a href="http://gavinsoorma.com/wp-content/uploads/2011/11/11g-cross-platform-active-standby.doc">Oracle 11g Cross platform Active Standby &#8211; Windows Primary database and Linux Active Standby </a></p>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/11/oracle-11g-cross-platform-active-standby-windows-primary-database-and-linux-active-standby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recovery through RESETLOGS and reset of the incarnation of the database</title>
		<link>http://gavinsoorma.com/2011/10/recovery-through-resetlogs-and-reset-of-the-incarnation-of-the-database/</link>
		<comments>http://gavinsoorma.com/2011/10/recovery-through-resetlogs-and-reset-of-the-incarnation-of-the-database/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 00:28:15 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[Backup and Recovery]]></category>
		<category><![CDATA[INCARNATION]]></category>
		<category><![CDATA[RESET INCARNATION]]></category>
		<category><![CDATA[resetlogs]]></category>
		<category><![CDATA[rman]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3262</guid>
		<description><![CDATA[

Prior to Oracle 10g, the redo log files generated after opening the database with RESETLOGS could not be used with the backups taken before the RESETLOGS was performed.

Therefore, whenever a resetlogs was done, it was important to take an immediate full database backup, since all previous backups became invalid.

Just to recap, a RESETLOGS needs to be performed when we 

1)	Do a point in time recovery
2)	Recover a database using a backup of the control file

What does a RESETLOGS do?

•	Archives the current online redo logs (if they are accessible) and then erases the contents of the online redo logs and resets the log sequence number to 1.
•	Creates the online redo log files if they do not currently exist.
•	Updates all current datafiles and online redo logs and all subsequent archived redo logs with a new RESETLOGS SCN and time stamp

The Recovery through Resetlogs feature provides the following benefits:

* There is no need to <p>Continue reading <a href="http://gavinsoorma.com/2011/10/recovery-through-resetlogs-and-reset-of-the-incarnation-of-the-database/">Recovery through RESETLOGS and reset of the incarnation of the database</a></p>

]]></description>
			<content:encoded><![CDATA[<pre>

<strong>Prior to Oracle 10g</strong>, the redo log files generated after opening the database with RESETLOGS could not be used with the backups taken before the RESETLOGS was performed.

Therefore, whenever a resetlogs was done, it was important to take an immediate full database backup, <strong>since all previous backups became invalid</strong>.

Just to recap, a RESETLOGS needs to be performed when we 

1)	Do a point in time recovery
2)	Recover a database using a backup of the control file

<strong>What does a RESETLOGS do?</strong>

•	Archives the current online redo logs (if they are accessible) and then erases the contents of the online redo logs and resets the log sequence number to 1.
•	Creates the online redo log files if they do not currently exist.
•	Updates all current datafiles and online redo logs and all subsequent archived redo logs with a new RESETLOGS SCN and time stamp

The <strong>Recovery through Resetlogs </strong>feature provides the following benefits:

* There is no need to perform a full backup after an incomplete recovery.
* There is no need to recreate a new standby database after a failover operation.
* You can take incremental backups based on full backups of a previous incarnation when you use RMAN.
* Block media recovery can restore backups from parent incarnation backups and recover the corrupted blocks through a RESETLOGS operation.
* You can use the newly generated logs with an earlier incarnation of the database.

Important:

<strong>To perform recovery through RESETLOGS you must have all archived logs generated after the most recent backup</strong>.

<strong>The new log_archive_format introduced in 10g</strong> 

Oracle 10g introduces a new format specification for archived log files. This new format avoids overwriting archived redo log files with the same sequence number across incarnations.

SQL> show parameter log_archive_format
NAME TYPE VALUE
----------------------- ----------- ----------------
log_archive_format string %t_%s_%r.dbf

The format specification of the log_archive_format string "%"r represents the resetlogs id. It will ensure that a unique name is constructed for the archived redo log file during RMAN restore and as well as restoring via SQL*plus auto recovery mode.

Note: The database would not start if you remove the %r from the log archive format specification.

<strong>What is an incarnation?</strong>

A database incarnation is created whenever you open the database with the RESETLOGS option.

The Current incarnation is the one in which the database is running at present

The incarnation from which the current incarnation branched after a ALTER DATABASE OPEN RESETLOGS  was performed is called the Parent incarnation.

If you want to go back to some SCN which is not part of the Current database incarnation, we need to use the RESET DATABASE TO INCARNATION
command as shown in the example below

<strong>The purpose of incarnations</strong>

An incarnation helps to identify redo streams which have the same SCN, but occurred at different points in time. This prevents the possibility of applying the wrong archive log file from a previous incarnation which could corrupt the database.

Suppose we are at incarnation 1 and are at SCN 100 in the database. I do a resetlogs and now the incarnation of the database becomes 2. Suppose we do another resetlogs and it so happens that the SCN at the time we did the resetlogs was also 100. Somewhere down the line later  we want to do a point in time recovery and want to recover the database until SCN 100. How does Oracle know which is the correct SCN and how far back in time should the database be rolled back to and which archive logs need to be applied?

This is where incarnations come in and we will see how we can set the database to a particular incarnation to enable RMAN to do a point in time recovery.

<strong>Example</strong>

Let us now run the LIST INCARNATION OF DATABASE command from RMAN and this is the output.

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       TEST11G  916751459        PARENT  1          15-AUG-09
2       2       TEST11G  916751459        CURRENT 945184     18-OCT-11

What is the current SCN of the database?

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
     991395

Now, let us make a change in the database which we will then try to undo by restoring  and recovering the database to a point in time before the media failure or as in this case, a wrong transaction has happened.

SQL> conn sh/sh
Connected.

SQL> select count(*) from sales;

  COUNT(*)
----------
    918843

SQL> delete from sales where rownum < 1001;

1000 rows deleted.

SQL> commit;

Commit complete.

SQL> select count(*) from sales;

  COUNT(*)
----------
    917843

We now will roll the database back to an SCN before the delete operation was performed.

SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;

[oracle@orasql-001 u01]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Oct 18 09:41:08 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TEST11G (DBID=916751459, not open)

RMAN> run {
2> set until scn 991395;
3> restore database;
4> recover database;
5> }

executing command: SET until clause

Starting restore at 18-OCT-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/oradata/TEST11G/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/oradata/TEST11G/sysaux01.dbf

….
….

channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 18-OCT-11

Starting recover at 18-OCT-11
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 18-OCT-11

RMAN> alter database open resetlogs;

database opened

We can now see that the deleted rows have been recovered and the number of rows in the table is now the same as before the delete operation was performed.

SQL> select count(*) from sh.sales;

  COUNT(*)
----------
    918843

Let us check what the incarnation of the database is.

RMAN> list incarnation of database;

using target database control file instead of recovery catalog

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       TEST11G  916751459        PARENT  1          15-AUG-09
2       2       TEST11G  916751459        PARENT  945184     18-OCT-11
3       3       TEST11G  916751459        CURRENT 991396     18-OCT-11

The current incarnation of the database is 3 and since we have recovered the database until SCN 991395, the RESET SCN has been set to the SCN 991396.

The alert log of the database will also log this resetlogs operation and we will see lines the ones shown below:

Incomplete Recovery applied until change 991395 time 10/18/2011 09:39:19
Media Recovery Complete (TEST11G)
Completed: alter database recover if needed
 start until change 991395
Tue Oct 18 09:42:14 2011
alter database open resetlogs
Archived Log entry 3 added for thread 1 sequence 5 ID 0x36a3e663 dest 1:
RESETLOGS after incomplete recovery UNTIL CHANGE 991395

Setting recovery target incarnation to 3
Tue Oct 18 09:42:15 2011
Assigning activation ID 916768223 (0x36a4c5df)

Now let us make another delete from the sales table. 

SQL> delete from sh.sales where rownum < 10001;

10000 rows deleted.

SQL> commit;

Commit complete.

SQL> select count(*) from sh.sales;

  COUNT(*)
----------
    908843

Now, let us shutdown the database, startup and mount it and try the same incomplete recovery which we tried earlier until the SCN 991395

oracle@orasql-001 u01]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Oct 18 09:46:29 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TEST11G (DBID=916751459, not open)

RMAN> run {
2>  set until scn 991395;
3> restore database;
4> recover database;
5> }

executing command: SET until clause

Starting restore at 18-OCT-11
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 10/18/2011 09:46:55
RMAN-20208: UNTIL CHANGE is before RESETLOGS change

We get the error RMAN-20208 because since the current incarnation of the database is 3 and we trying to go to an SCN before this incarnation.

So how do we go back to SCN 993195?

For this to happen, we need to change the current incarnation (3) of the database to an older incarnation (2). The SCN 993195 was present during the incarnation 2.

After resetting the incarnation to 2, we now see that the restore is proceeding fine.

RMAN> reset database to incarnation 2;

database reset to incarnation 2

RMAN>  run {
2>  set until scn 991395;
3>  restore database;
4> recover database;
5> }

executing command: SET until clause

Starting restore at 18-OCT-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=63 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/oradata/TEST11G/system01.dbf
…
…

channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 18-OCT-11

Starting recover at 18-OCT-11
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 4 is already on disk as file /u01/oradata/TEST11G/arch/1_4_764845989.arch
archived log for thread 1 with sequence 5 is already on disk as file /u01/oradata/TEST11G/arch/1_5_764845989.arch
archived log file name=/u01/oradata/TEST11G/arch/1_4_764845989.arch thread=1 sequence=4
archived log file name=/u01/oradata/TEST11G/arch/1_5_764845989.arch thread=1 sequence=5
media recovery complete, elapsed time: 00:00:00
Finished recover at 18-OCT-11

Now we open the database with the ALTER DATABASE OPEN RESETOGS command and see that a new incarnation key (4) has been allocated to the database as the CURRENT incarnation and the previous incarnation (3) has become an ORPHAN incarnation.

RMAN> list incarnation of database;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       TEST11G  916751459        PARENT  1          15-AUG-09
2       2       TEST11G  916751459        PARENT  945184     18-OCT-11
3       3       TEST11G  916751459        ORPHAN  991396     18-OCT-11
4       4       TEST11G  916751459        CURRENT 991396     18-OCT-11

Now let us do the same procedure once again:

Delete some rows
Set the database to incarnation 2
Recover the database until the same SCN as previous case – 991395
Open the database with resetlogs 

Now list the incarnation of the database

RMAN> list incarnation of database;

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1       1       TEST11G  916751459        PARENT  1          15-AUG-09
2       2       TEST11G  916751459        PARENT  945184     18-OCT-11
4       4       TEST11G  916751459        ORPHAN  991396     18-OCT-11
5       5       TEST11G  916751459        CURRENT 991396     18-OCT-11
3       3       TEST11G  916751459        ORPHAN  991396     18-OCT-11

The incarnation key 5 now is the CURRENT incarnation of the database, and incarnations 3 and 4 both have become ORPHAN.
The current SCN now is 991734

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
     991734

What happens if we change the structure of the database?  And we do not take any new backup after this change was made, but try and recover using a backup before we had changed the structure of the database. We add another datafile to the USERS tablespace. So the current control file has knowledge of the fact that the  USERS tablespace now has not one, but two datafiles.

We now try and do the same delete of rows and try and go back to our old SCN 991395. At this point in time, the control file had only knowledge of the fact that the USERS tablespace has one data file and not two and the restore and recovery process will not try to do anything with regards to the newly added datafile..

This is what we see in the alert log of the database. Note that datafile 6 which is the new datafile added is being taken offline and dropped because at SCN 991735, this datafile did not exist in the database.

Wed Oct 19 10:03:42 2011
alter database datafile 6 offline drop
Completed: alter database datafile 6 offline drop
alter database recover datafile list clear
Completed: alter database recover datafile list clear
alter database recover datafile list
 1 , 2 , 3 , 4 , 5
Completed: alter database recover datafile list
 1 , 2 , 3 , 4 , 5
alter database recover if needed
 start until change 991735

Dictionary check beginning
File #6 in the controlfile not found in data dictionary.
Removing file from controlfile.
data file 6: '/u01/oradata/TEST11G/users02.dbf'
Dictionary check complete
</pre>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/10/recovery-through-resetlogs-and-reset-of-the-incarnation-of-the-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the oracle-validated RPM to install Oracle 11g on Linux</title>
		<link>http://gavinsoorma.com/2011/10/using-the-oracle-validated-rpm-to-install-oracle-11g-on-linux/</link>
		<comments>http://gavinsoorma.com/2011/10/using-the-oracle-validated-rpm-to-install-oracle-11g-on-linux/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 01:42:53 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Oracle 11g]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[oracle 11g]]></category>
		<category><![CDATA[oracle-validated RPM]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3254</guid>
		<description><![CDATA[<p>I recently came across this OTN article  How I Simplified Oracle Database Installation on Oracle Linux.</p>
<p>I tried out the procedure listed by the author and thought I’d share this with those who may not be aware of this note and must say thanks to the author Ginny Henningsen.</p>
<p>When I have tried to install Oracle 11g on Linux, in most cases I have found that  the OUI either reports that some packages are missing (typically unixODBC or libaio) or some kernel parameters are not appropriately set. In this case however, we download and install an RPM package called oracle-validated and the oracle-validated RPM does a number of things for us.</p>
It creates the user oracle
It creates the groups oinstall and dba
It modifies the kernel parameters in /etc/sysctl.conf 
It sets the hard and soft shell resource limits in /etc/security/limits.conf
And most importantly, downloads and installs  number of packages which are required <p>Continue reading <a href="http://gavinsoorma.com/2011/10/using-the-oracle-validated-rpm-to-install-oracle-11g-on-linux/">Using the oracle-validated RPM to install Oracle 11g on Linux</a></p>

]]></description>
			<content:encoded><![CDATA[<p>I recently came across this OTN article  <a href="http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html">How I Simplified Oracle Database Installation on Oracle Linux</a>.</p>
<p>I tried out the procedure listed by the author and thought I’d share this with those who may not be aware of this note and must say thanks to the author <b>Ginny Henningsen</b>.</p>
<p>When I have tried to install Oracle 11g on Linux, in most cases I have found that  the OUI either reports that some packages are missing (typically unixODBC or libaio) or some kernel parameters are not appropriately set. In this case however, we download and install an RPM package called <b>oracle-validated</b> and the oracle-validated RPM does a number of things for us.</p>
<li>It creates the user oracle</li>
<li>It creates the groups oinstall and dba</li>
<li>It modifies the kernel parameters in /etc/sysctl.conf </li>
<li>It sets the hard and soft shell resource limits in /etc/security/limits.conf</li>
<li>And most importantly, downloads and installs  number of packages which are required for the Oracle 11g database software installation while resolving the dependencies between the packages as well</li>
<p>Note that the oracle-validated RPM package is accessible through the Oracle Unbreakable Linux Network (ULN) which requires a support contract or from the Oracle public yum repository.</p>
<p>First we needed to configure the Linux machine to be able to connect to the internet using the corporate proxy and we did this by editing the <b>/etc/profile.d/proxy.sh</b> file with some environment variables like FTP_PROXY and HTTP_PROXY</p>
<p>export http_proxy=http://test-apache-001-dev.corporateict.domain:8123/<br />
export ftp_proxy=http://test-apache-001-dev.corporateict.domain:8123/<br />
export no_proxy=.corporateict.domain<br />
export HTTP_PROXY=http://test-apache-001-dev.corporateict.domain:8123/<br />
export FTP_PROXY=http://test-apache-001-dev.corporateict.domain:8123/</p>
<p>Login once again as root to invoke the changes made  to the environment.</p>
<p>We then use <b>wget</b> to download the file which has the repository locations</p>
<p>[root@kens-orasql-001 yum.repos.d]# <b>wget http://public-yum.oracle.com/public-yum-el5.repo</b></p>
<p>We have to update this file and change the line enabled=0 to enabled=1 for the tag which is appropriate to our Linux version – in our case we were using OEL 5.7 so we have to update these lines:</p>
<p>Change </p>
<p>[ol5_u7_base]<br />
name=Oracle Linux $releasever &#8211; U7 &#8211; $basearch &#8211; base<br />
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/7/base/$basearch/<br />
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5<br />
gpgcheck=1<br />
<b>enabled=0</b></p>
<p>to</p>
<p>[ol5_u7_base]<br />
name=Oracle Linux $releasever &#8211; U7 &#8211; $basearch &#8211; base<br />
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/7/base/$basearch/<br />
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5<br />
gpgcheck=1<br />
<b>enabled=1</b></p>
<p>We then ran a yum update followed by the yum install oracle-validated</p>
<pre>
[root@kens-orasql-002 yum.repos.d]# <b>yum update</b>
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
ol5_u7_base                                                                                                                                    | 1.1 kB     00:00
ol5_u7_base/primary                                                                                                                            | 1.5 MB     00:07
ol5_u7_base                                                                                                                                                 4605/4605
Skipping security plugin, no data
Setting up Update Process
No Packages marked for Update
</pre>
<pre>
[root@kens-orasql-002 yum.repos.d]# <b>yum install oracle-validated</b>
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package oracle-validated.x86_64 0:1.1.0-14.el5 set to be updated
--> Processing Dependency: kernel-uek >= 2.6.32 for package: oracle-validated
--> Processing Dependency: libXp.so.6 for package: oracle-validated
--> Processing Dependency: /usr/lib/libodbccr.so for package: oracle-validated
--> Processing Dependency: /usr/lib64/libodbccr.so for package: oracle-validated
--> Processing Dependency: unixODBC-devel for package: oracle-validated
--> Processing Dependency: libaio-devel for package: oracle-validated
--> Processing Dependency: sysstat for package: oracle-validated
--> Processing Dependency: /usr/lib64/libaio.so for package: oracle-validated
--> Processing Dependency: /usr/lib/libodbc.so.1 for package: oracle-validated
--> Processing Dependency: /usr/lib/libaio.so for package: oracle-validated
--> Processing Dependency: compat-gcc-34-c++ for package: oracle-validated
--> Processing Dependency: compat-gcc-34 for package: oracle-validated
--> Processing Dependency: libdb-4.2.so()(64bit) for package: oracle-validated
--> Processing Dependency: libodbc.so.1()(64bit) for package: oracle-validated
--> Running transaction check
---> Package compat-db.x86_64 0:4.2.52-5.1 set to be updated
---> Package compat-gcc-34.x86_64 0:3.4.6-4.1 set to be updated
---> Package compat-gcc-34-c++.x86_64 0:3.4.6-4.1 set to be updated
---> Package kernel-uek.x86_64 0:2.6.32-200.13.1.el5uek set to be installed
--> Processing Dependency: kernel-firmware >= 2.6.32-200.13.1.el5uek for package: kernel-uek
---> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
---> Package libaio-devel.i386 0:0.3.106-5 set to be updated
---> Package libaio-devel.x86_64 0:0.3.106-5 set to be updated
---> Package sysstat.x86_64 0:7.0.2-11.el5 set to be updated
---> Package unixODBC.i386 0:2.2.11-7.1 set to be updated
---> Package unixODBC.x86_64 0:2.2.11-7.1 set to be updated
---> Package unixODBC-devel.i386 0:2.2.11-7.1 set to be updated
---> Package unixODBC-devel.x86_64 0:2.2.11-7.1 set to be updated
--> Running transaction check
---> Package kernel-uek-firmware.noarch 0:2.6.32-200.13.1.el5uek set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================================
Package                                     Arch                           Version                                         Repository                           Size
======================================================================================================================================================================
Installing:
oracle-validated                            x86_64                         1.1.0-14.el5                                    ol5_u7_base                          24 k
Installing for dependencies:
compat-db                                   x86_64                         4.2.52-5.1                                      ol5_u7_base                         1.6 M
compat-gcc-34                               x86_64                         3.4.6-4.1                                       ol5_u7_base                         4.3 M
compat-gcc-34-c++                           x86_64                         3.4.6-4.1                                       ol5_u7_base                          13 M
kernel-uek                                  x86_64                         2.6.32-200.13.1.el5uek                          ol5_u7_base                          25 M
kernel-uek-firmware                         noarch                         2.6.32-200.13.1.el5uek                          ol5_u7_base                         2.5 M
libXp                                       i386                           1.0.0-8.1.el5                                   ol5_u7_base                          22 k
libaio-devel                                i386                           0.3.106-5                                       ol5_u7_base                          12 k
libaio-devel                                x86_64                         0.3.106-5                                       ol5_u7_base                          11 k
sysstat                                     x86_64                         7.0.2-11.el5                                    ol5_u7_base                         187 k
unixODBC                                    i386                           2.2.11-7.1                                      ol5_u7_base                         830 k
unixODBC                                    x86_64                         2.2.11-7.1                                      ol5_u7_base                         835 k
unixODBC-devel                              i386                           2.2.11-7.1                                      ol5_u7_base                         743 k
unixODBC-devel                              x86_64                         2.2.11-7.1                                      ol5_u7_base                         799 k

Transaction Summary
======================================================================================================================================================================
Install      14 Package(s)
Upgrade       0 Package(s)

Total size: 50 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 1e5e0159
ol5_u7_base/gpgkey                                                                                                                             | 1.4 kB     00:00
Importing GPG key 0x1E5E0159 "Oracle OSS group (Open Source Software group) <build@oss.oracle.com>" from http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : unixODBC                                                                                                                                      1/14
  Installing     : compat-gcc-34                                                                                                                                 2/14
  Installing     : sysstat                                                                                                                                       3/14
  Installing     : compat-db                                                                                                                                     4/14
  Installing     : unixODBC                                                                                                                                      5/14
  Installing     : unixODBC-devel                                                                                                                                6/14
  Installing     : unixODBC-devel                                                                                                                                7/14
  Installing     : libaio-devel                                                                                                                                  8/14
  Installing     : libaio-devel                                                                                                                                  9/14
  Installing     : kernel-uek-firmware                                                                                                                          10/14
  Installing     : libXp                                                                                                                                        11/14
  Installing     : compat-gcc-34-c++                                                                                                                            12/14
Change references of /dev/hd in /etc/fstab to disk label
  Installing     : kernel-uek                                                                                                                                   13/14
WARNING: No module ehci-hcd found for kernel 2.6.32-200.13.1.el5uek, continuing anyway
WARNING: No module ohci-hcd found for kernel 2.6.32-200.13.1.el5uek, continuing anyway
WARNING: No module uhci-hcd found for kernel 2.6.32-200.13.1.el5uek, continuing anyway
  Installing     : oracle-validated                                                                                                                             14/14

Installed:
  oracle-validated.x86_64 0:1.1.0-14.el5

Dependency Installed:
  compat-db.x86_64 0:4.2.52-5.1                         compat-gcc-34.x86_64 0:3.4.6-4.1                               compat-gcc-34-c++.x86_64 0:3.4.6-4.1
  kernel-uek.x86_64 0:2.6.32-200.13.1.el5uek            kernel-uek-firmware.noarch 0:2.6.32-200.13.1.el5uek            libXp.i386 0:1.0.0-8.1.el5
  libaio-devel.i386 0:0.3.106-5                         libaio-devel.x86_64 0:0.3.106-5                                sysstat.x86_64 0:7.0.2-11.el5
  unixODBC.i386 0:2.2.11-7.1                            unixODBC.x86_64 0:2.2.11-7.1                                   unixODBC-devel.i386 0:2.2.11-7.1
  unixODBC-devel.x86_64 0:2.2.11-7.1

Complete!
[root@kens-orasql-002 yum.repos.d]#
</pre>
<p>We can see that the oracle-validated  RPM has been installed.</p>
<pre>
[root@kens-orasql-001 yum.repos.d]# <b>rpm -qa |grep oracle-valid</b>
oracle-validated-1.1.0-14.el5
</pre>
<p>We can also check and see that the user and groups have been created as well.</p>
<pre>
[root@kens-orasql-001 yum.repos.d]# <b>cat /etc/passwd |grep oracle</b>

oracle:x:54321:54321::/home/oracle:/bin/bash

[root@kens-orasql-001 yum.repos.d]# <b>cat /etc/group |grep dba </b>
dba:x:54322:oracle
</pre>
<p>It has also updated the /etc/security/limits.conf file</p>
<pre>
[root@kens-orasql-001 yum.repos.d]# cat /etc/security/limits.conf

# Oracle-Validated setting for nofile soft limit is 131072
oracle   soft   nofile    131072

# Oracle-Validated setting for nofile hard limit is 131072
oracle   hard   nofile    131072

# Oracle-Validated setting for nproc soft limit is 131072
oracle   soft   nproc    131072

# Oracle-Validated setting for nproc hard limit is 131072
oracle   hard   nproc    131072

# Oracle-Validated setting for core soft limit is unlimited
oracle   soft   core    unlimited

# Oracle-Validated setting for core hard limit is unlimited
oracle   hard   core    unlimited

# Oracle-Validated setting for memlock soft limit is 50000000
oracle   soft   memlock    50000000

# Oracle-Validated setting for memlock hard limit is 50000000
oracle   hard   memlock    50000000
</pre>
<p>Finally, we can see that the /etc/sysctl.conf has been updated as well with some &#8220;Oracle-Validated&#8221; settings.</p>
<pre>
# For 11g, Oracle-Validated setting for fs.file-max is 6815744
# For 10g, uncomment 'fs.file-max = 327679', and comment 'fs.file-max = 6553600' entry and re-run sysctl -p
# fs.file-max = 327679
fs.file-max = 6815744

# Oracle-Validated setting for kernel.msgmni is 2878
kernel.msgmni = 2878

# Oracle-Validated setting for kernel.msgmax is 8192
kernel.msgmax = 8192

# Oracle-Validated setting for kernel.msgmnb is 65536
kernel.msgmnb = 65536

# Oracle-Validated setting for kernel.sem is '250 32000 100 142'
kernel.sem = 250 32000 100 142

# Oracle-Validated setting for kernel.shmmni is 4096
kernel.shmmni = 4096

# Oracle-Validated setting for kernel.shmall is 1073741824
kernel.shmall = 1073741824

# Oracle-Validated setting for kernel.shmmax is 4398046511104 on x86_64 and 4294967295 on i386 architecture. Refer Note id 567506.1
kernel.shmmax = 4398046511104

# Oracle-Validated setting for kernel.sysrq is 1
kernel.sysrq = 1

# Oracle-Validated setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144

# For 11g, Oracle-Validated setting for net.core.rmem_max is 4194304
# For 10g, uncomment 'net.core.rmem_max = 2097152', comment 'net.core.rmem_max = 4194304' entry and re-run sysctl -p
# net.core.rmem_max = 2097152
net.core.rmem_max = 4194304

# Oracle-Validated setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144

# For 11g, Oracle-Validated setting for net.core.wmem_max is 1048576
# For 10g, uncomment 'net.core.wmem_max = 262144', comment 'net.core.wmem_max = 1048576' entry for this parameter and re-run sysctl -p
# net.core.wmem_max = 262144
net.core.wmem_max = 1048576

# Oracle-Validated setting for fs.aio-max-nr is 3145728
fs.aio-max-nr = 3145728

# For 11g, Oracle-Validated setting for net.ipv4.ip_local_port_range is 9000 65500
# For 10g, uncomment 'net.ipv4.ip_local_port_range = 1024 65000', comment 'net.ipv4.ip_local_port_range = 9000 65500' entry and re-run sysctl -p
# net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.ip_local_port_range = 9000 65500

# Oracle-Validated setting for vm.min_free_kbytes is 51200 to avoid OOM killer
vm.min_free_kbytes = 51200
</pre>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/10/using-the-oracle-validated-rpm-to-install-oracle-11g-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the GoldgenGate column conversion functions &#8211; STRCAT and STREXT</title>
		<link>http://gavinsoorma.com/2011/08/using-the-goldgengate-column-conversion-functions-strcat-and-strext/</link>
		<comments>http://gavinsoorma.com/2011/08/using-the-goldgengate-column-conversion-functions-strcat-and-strext/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 00:47:44 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3249</guid>
		<description><![CDATA[<p>In one of my earlier posts, I had showed some examples of using the CASE and EVAL column conversion functions available in GoldenGate.</p>
<p>Let us today take a look at two other functions STRCAT and STREXT.</p>
<p>STRCAT basically enables us to concatenate two strings or two character columns.</p>
<p>The STREXT function on the other hand is used to extract a portion of a string.</p>
<p>For example in our source database we have a table MYPHONE with the following structure:</p>

SQL> desc myphone
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 AREA_CODE                           <p>Continue reading <a href="http://gavinsoorma.com/2011/08/using-the-goldgengate-column-conversion-functions-strcat-and-strext/">Using the GoldgenGate column conversion functions &#8211; STRCAT and STREXT</a></p>

]]></description>
			<content:encoded><![CDATA[<p>In one of my <a href="http://gavinsoorma.com/2011/08/using-the-goldengate-column-conversion-functions-case-and-eval/">earlier</a> posts, I had showed some examples of using the CASE and EVAL column conversion functions available in GoldenGate.</p>
<p>Let us today take a look at two other functions <strong>STRCAT</strong> and <strong>STREXT</strong>.</p>
<p>STRCAT basically enables us to concatenate two strings or two character columns.</p>
<p>The STREXT function on the other hand is used to extract a portion of a string.</p>
<p>For example in our source database we have a table MYPHONE with the following structure:</p>
<pre>
SQL> desc myphone
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 AREA_CODE                                          NUMBER
 PHONE_NO                                           NUMBER
</pre>
<p>In the target we have the same table MYPHONE with a different structure:</p>
<pre>
SQL> desc myphone
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 PHONE_NO                                           VARCHAR2(30)
</pre>
<p>So in the target database, the PHONE_NO column includes both the area code as well as the phone number with a ‘-‘ character as well between both the values, while in the source database the table has two columns – one for the area code and one for the phone number.</p>
<p>We will use SRTCAT function in this case.</p>
<p>Remember that since the source and target tables differ in structure, we need to run the DEFGEN utility in the source GoldenGate environment to generate the definitions file and then copy this across to the target GoldenGate environment..</p>
<p>These are the contents of the extract parameter file:</p>
<pre>

extract ext
userid ggs_owner, password ggs_owner
rmthost venom , mgrport 7809
rmttrail ./dirdat/gg
table ggs_owner.myphone;
</pre>
<p>These are the contents of the replicat parameter file – note how the STRCAT function is being used here.</p>
<pre>
REPLICAT rep
sourcedefs /export/home/oracle/gg/dirsql/myphone.sql
USERID ggs_owner, PASSWORD ggs_owner
MAP ggs_owner.myphone, TARGET ggs_owner.myphone,
COLMAP (phone_no=@STRCAT("0",area_code,"-",phone_no));
</pre>
<p>We now start the extract and replicat processes and insert some records in the source table.</p>
<p>The source table now has the following rows:</p>
<pre>
SQL> select * from myphone;

 AREA_CODE   PHONE_NO
---------- ----------
         8   92471136
         4   17213124
         2     818188
</pre>
<p>Let us see how these rows have been transformed on the target database.</p>
<pre>
SQL> select * from myphone;

PHONE_NO
------------------------------
08-92471136
04-17213124
02-818188
</pre>
<p>We can extend this example and use both STRCAT and STREXT together to achieve the data transformation that we desire.</p>
<p>For example in our source MYSSID table, we have data like this:</p>
<pre>
SQL> select * from myssid;

      SSID
----------
 123456787
 123456788
 123456789
</pre>
<p>But on the target database, in the same table the data has been displayed like this:</p>
<pre>

SQL> select * from myssid;

SSID
--------------------
123-456-787
123-456-788
123-456-789
</pre>
<p>So how did we achieve this?</p>
<p>Have a look at the replicat parameter file and note how we have used first the STREXT function to extract 3 characters at a time – the first 3, then the next 3 and finally  the last 3 and then used STRCAT to concatenate the result of the STREXT functions together with a ‘-‘ character acting as the string separator.</p>
<pre>
REPLICAT rep
sourcedefs /export/home/oracle/gg/dirsql/myssid.sql
USERID ggs_owner, PASSWORD ggs_owner
MAP ggs_owner.myssid, TARGET ggs_owner.myssid,
COLMAP (ssid=@STRCAT(@STREXT(ssid,1,3),"-",@STREXT(ssid,4,6),"-",@STREXT(ssid,7,9) ));
</pre>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/08/using-the-goldgengate-column-conversion-functions-strcat-and-strext/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the GoldenGate column conversion functions &#8211; CASE and EVAL</title>
		<link>http://gavinsoorma.com/2011/08/using-the-goldengate-column-conversion-functions-case-and-eval/</link>
		<comments>http://gavinsoorma.com/2011/08/using-the-goldengate-column-conversion-functions-case-and-eval/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 01:22:59 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3243</guid>
		<description><![CDATA[<p>Let us have a look at some GoldenGate column conversion functions – CASE and EVAL </p>
<p>To illustrate this example, we have a source and target table called EMPSAL and the structure of the tables in both databases is slightly different. </p>
<p>In the source table we have the JOB column and in the target database we have a TAX_BRACKET column.</p>
<p>In the first example, we will use CASE function to populate the target database TAX_BRACKET column based on the value for the JOB column in the source database.</p>
<p>In the second example,  we will use the EVAL function to populate the target database TAX_BRACKET column based on a particular range of values for the SAL column in the source table.</p>
<p>Remember that since the table structure in source and target are different, we need to run the DEFGEN utility to generate a definitions file which we will then copy to the target GoldenGate <p>Continue reading <a href="http://gavinsoorma.com/2011/08/using-the-goldengate-column-conversion-functions-case-and-eval/">Using the GoldenGate column conversion functions &#8211; CASE and EVAL</a></p>

]]></description>
			<content:encoded><![CDATA[<p>Let us have a look at some GoldenGate column conversion functions – <b>CASE</b> and <b>EVAL </b></p>
<p>To illustrate this example, we have a source and target table called EMPSAL and the structure of the tables in both databases is slightly different. </p>
<p>In the source table we have the JOB column and in the target database we have a TAX_BRACKET column.</p>
<p>In the first example, we will use CASE function to populate the target database TAX_BRACKET column based on the value for the JOB column in the source database.</p>
<p>In the second example,  we will use the EVAL function to populate the target database TAX_BRACKET column based on a particular range of values for the SAL column in the source table.</p>
<p>Remember that since the table structure in source and target are different, we need to run the DEFGEN utility to generate a definitions file which we will then copy to the target GoldenGate environment and instead of using the ASSUMEDEFS parameter in the replicate parameter file, we use the SOURCEDEFS parameter instead to indicate the location of the definitions file which we have generated and copied over from the source GoldenGate environment.</p>
<p><strong>Source</strong></p>
<pre>

SQL> desc empsal
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ENAME                                              VARCHAR2(20)
 SAL                                                NUMBER
 JOB                                                VARCHAR2(12)
</pre>
<p><strong>Target </strong></p>
<pre>
SQL> desc empsal
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ENAME                                              VARCHAR2(20)
 SAL                                                NUMBER
 TAX_BRACKET                                        VARCHAR2(10)
</pre>
<p>We now create the definitions file for the EMPSAL table and copy the generated definitions file to the target GoldenGate environment.</p>
<pre>

GGSCI (sunos1) 4> edit params defgen

"/export/home/oracle/gg/dirprm/defgen.prm" 3 lines, 97 characters
defsfile ./dirsql/empsal.sql
userid ggs_owner password ggs_owner
table ggs_owner.empsal;

sunos1:/export/home/oracle/gg $ ./defgen paramfile /export/home/oracle/gg/dirprm/defgen.prm

sunos1:/export/home/oracle/gg/dirsql $ scp -rp empsal.sql oracle@sunos2:/export/home/oracle/gg/dirsql
</pre>
<p>Let us have a look at the Extract parameter file &#8211; quite normal and straight forward here.</p>
<pre>
extract ext
userid ggs_owner, password ggs_owner
rmthost sunos2 , mgrport 7809
rmttrail ./dirdat/gg
table ggs_owner.empsal;
</pre>
<p>On the target, these are the contents of the replicat parameter file. Note the COLPMAP clause. Since both the tables have common  columns ENAME and SAL, we do not have to explicitly map them and we can just specify USEDEFAULTS.</p>
<p>The TAX_BRACKET column on the target table is being populated using the CASE function which evaluates the values for the JOB column in the source table.</p>
<p>If the value for JOB is &#8216;OPERATOR&#8217;, then the TAX_BRACKET column is assigned the value &#8216;LOW&#8217;. If it is &#8216;DBA&#8217; then the TAX_BRACKET column is assigned the value &#8216;MID&#8217; and if the value is &#8216;MANAGER&#8217;, then the TAX_BRACKET column is assigned the value &#8216;HIGH&#8217;.  If the value for JOB is none of the values, then a default value of &#8216;UNKNOWN&#8217; is assigned.</p>
<pre>
REPLICAT rep
sourcedefs /export/home/oracle/gg/dirsql/empsal.sql
USERID ggs_owner, PASSWORD ggs_owner
MAP ggs_owner.empsal, TARGET ggs_owner.empsal,
COLMAP (
usedefaults, tax_bracket=@case(JOB, "OPERATOR","LOW","DBA", "MID","MANAGER","HIGH", "UNKNOWN"));
<pre>

Let us now insert some values into the source table.
<pre>

SQL> insert into empsal values
  2  ('JOHN',10000, 'DBA');

1 row created.

SQL> insert into empsal values
  2  ('JACK',5000, 'OPERATOR');

1 row created.

SQL> insert into empsal values
  2  ('TOM',20000, 'MANAGER');

1 row created.

SQL>  insert into empsal values
  2  ('MARY', 6000, 'ANALYST');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from empsal;

ENAME                       SAL JOB
-------------------- ---------- ------------
JOHN                      10000 DBA
JACK                       5000 OPERATOR
TOM                       20000 MANAGER
MARY                       6000 ANALYST
</pre>
<p>Let us now see how the data has been replicated and how the transformation has taken place on the target.</p>
<pre>

SQL> select * from empsal;

ENAME                       SAL TAX_BRACKE
-------------------- ---------- ----------
JOHN                      10000 MID
JACK                       5000 LOW
TOM                       20000 HIGH
MARY                       6000 UNKNOWN
</pre>
<p>Let us now truncate both the tables and see the next example using EVAL instead of CASE.</p>
<p>We stop both the extract and replicat processes and will now change the replicat parameter file on the target to include the EVAL function.</p>
<p>So this is how our replicat parameter file will look like.</p>
<pre>
REPLICAT rep
sourcedefs /export/home/oracle/gg/dirsql/empsal.sql
USERID ggs_owner, PASSWORD ggs_owner
MAP ggs_owner.empsal, TARGET ggs_owner.empsal,
COLMAP (
usedefaults, &#038;
tax_bracket=@eval(sal < 10000,"LOW", sal >= 20000 , "HIGH",sal >= 10000, "MID"));
</pre>
<p>Start the extract and replicat processes again and let us now insert the same set of values in the source table as we did before and see how they are now replicated and transformed on the target.</p>
<pre>
SQL> select * from empsal;

ENAME                       SAL TAX_BRACKE
-------------------- ---------- ----------
JOHN                      10000 MID
JACK                       5000 LOW
TOM                       20000 HIGH
MARY                       6000 LOW
</pre>
<p>For those rows where the SAL value was less than 10000, a value of 'LOW' was assigned to the TAX_BRACKET column and if the value was equal to or greater than 10000 (but less than 20000), a value of 'MID' is assigned and all SAL values above 20000 are assigned 'HIGH'.</p>
<p>Have a read of the all the diferent column conversion functions mentioned in the GoldenGate reference guide and there are quite a few. Let me know if you found any others which are useful and kindly share your experience with the community!</p>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/08/using-the-goldengate-column-conversion-functions-case-and-eval/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passed the 1Z0-539 Exam &#8211; am now an Oracle Certified GoldenGate Implementation Specialist</title>
		<link>http://gavinsoorma.com/2011/08/passed-the-1z0-539-exam-am-now-an-oracle-certified-goldengate-implementation-specialist/</link>
		<comments>http://gavinsoorma.com/2011/08/passed-the-1z0-539-exam-am-now-an-oracle-certified-goldengate-implementation-specialist/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 02:44:21 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3239</guid>
		<description><![CDATA[<p> I have recently passed the Oracle GoldenGate 10 Essentials exam which recognizes you as a Oracle GoldenGate 10 Certified Implementation Specialist.</p>
<p>Note that the exam is currently based on GoldenGate 10.4 and not the 11g version of GoldenGate which has been out now for quite some time.</p>
<p>I must point out that while there are a number of &#8216;brain dumps&#8217; like Pass4Sure and Test King to &#8216;help&#8217; you pass the exam, I have seen the questions and answers that are provided by them and in most cases I found the answers to be provided to be grossly incorrect and wrong. So beware!</p>
<p>The best preparation for the exam is to go through the following sets of documentation:</p>
<p>Oracle Installation and Setup Guide
Reference Guide
Administration Guide</p>
<p>These and other 10.4 GoldenGate documentation can be obtained online  here &#8230;</p>
<p>I am now available to provide my services in any GoldenGate implementation project around the world as well <p>Continue reading <a href="http://gavinsoorma.com/2011/08/passed-the-1z0-539-exam-am-now-an-oracle-certified-goldengate-implementation-specialist/">Passed the 1Z0-539 Exam &#8211; am now an Oracle Certified GoldenGate Implementation Specialist</a></p>

]]></description>
			<content:encoded><![CDATA[<p> I have recently passed the Oracle GoldenGate 10 Essentials exam which recognizes you as a Oracle GoldenGate 10 Certified Implementation Specialist.</p>
<p>Note that the exam is currently based on GoldenGate 10.4 and not the 11g version of GoldenGate which has been out now for quite some time.</p>
<p>I must point out that while there are a number of &#8216;brain dumps&#8217; like Pass4Sure and Test King to &#8216;help&#8217; you pass the exam, I have seen the questions and answers that are provided by them and in most cases I found the answers to be provided to be grossly incorrect and wrong. So beware!</p>
<p>The best preparation for the exam is to go through the following sets of documentation:</p>
<p>Oracle Installation and Setup Guide<br />
Reference Guide<br />
Administration Guide</p>
<p>These and other 10.4 GoldenGate documentation can be obtained online <a href="http://download.oracle.com/docs/cd/E15881_01/index.htm"> here &#8230;</a></p>
<p>I am now available to provide my services in any GoldenGate implementation project around the world as well as for consultancy on any GoldenGate related subjects.</p>
<p>You can contact me at +61417713124 or via email to gavin.soorma@oncalldba.com.au to discuss anything further.</p>
<p>Happy GoldenGating!</p>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/08/passed-the-1z0-539-exam-am-now-an-oracle-certified-goldengate-implementation-specialist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Does GoldenGate support Oracle Flashback?</title>
		<link>http://gavinsoorma.com/2011/08/does-goldengate-support-oracle-flashback/</link>
		<comments>http://gavinsoorma.com/2011/08/does-goldengate-support-oracle-flashback/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 03:16:21 +0000</pubDate>
		<dc:creator>Gavin Soorma</dc:creator>
				<category><![CDATA[GoldenGate]]></category>

		<guid isPermaLink="false">http://gavinsoorma.com/?p=3235</guid>
		<description><![CDATA[<p>There is an Oracle Metalink Note (Does Goldengate Support The New Oracle 10g Flashback Feature? [ID 966212.1]) which discusses this aspect, but I thought that I would like to see for myself how does the Extract and Replicat processes behave if we issue any FLASHBACK command on the source database.</p>
<p>The Metalink note states that GoldenGate supports the following Flashback operations:</p>
<p>Flashback Table to SCN
Flashback Table to timestamp
Flashback Table to restore point</p>
<p>and does not support operations like:</p>
<p>Flashback Table to before drop
Flashback database</p>
<p>I have tested both the Flashback Table To Timestamp as well as the Flashback Table To Before Drop operations and find that both seem to be supported by GoldenGate and replication continues inspite of these commands being issued on the source database.</p>
<p>Let us see the examples of the same.</p>
<p>I have an Oracle 11g Goldengate (11.1.1) environment configured with the source and target databases of version 11.2.0.2.</p>
<p>Extract and Replicat processes are running <p>Continue reading <a href="http://gavinsoorma.com/2011/08/does-goldengate-support-oracle-flashback/">Does GoldenGate support Oracle Flashback?</a></p>

]]></description>
			<content:encoded><![CDATA[<p>There is an Oracle Metalink Note (Does Goldengate Support The New Oracle 10g Flashback Feature? [ID 966212.1]) which discusses this aspect, but I thought that I would like to see for myself how does the Extract and Replicat processes behave if we issue any FLASHBACK command on the source database.</p>
<p>The Metalink note states that GoldenGate supports the following Flashback operations:</p>
<p>Flashback Table to SCN<br />
Flashback Table to timestamp<br />
Flashback Table to restore point</p>
<p>and does not support operations like:</p>
<p>Flashback Table to before drop<br />
Flashback database</p>
<p>I have tested both the Flashback Table To Timestamp as well as the Flashback Table To Before Drop operations and find that both seem to be supported by GoldenGate and replication continues inspite of these commands being issued on the source database.</p>
<p>Let us see the examples of the same.</p>
<p>I have an Oracle 11g Goldengate (11.1.1) environment configured with the source and target databases of version 11.2.0.2.</p>
<p>Extract and Replicat processes are running and I am not using Data Pump in this case. The table configured for replication is called MYOBJECTS.</p>
<p>To test the Flashback, I am deleting all the rows from the table and then check on the target database if this delete operation has been propagated. </p>
<p>We will then flashback to a point in time when all the rows were present in the table and then check both the source and target database to verify if the delete operation has been flashed back on both databases.</p>
<p><strong>Source</strong></p>
<p>SQL> select count(*) from myobjects;</p>
<p>  COUNT(*)<br />
&#8212;&#8212;&#8212;-<br />
     56687</p>
<p>SQL> select to_char(sysdate,&#8217;dd-mon-yyyy hh24:mi:ss&#8217;) from dual;</p>
<p>TO_CHAR(SYSDATE,&#8217;DD-<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
17-aug-2011 10:23:07</p>
<p>SQL> delete myobjects;</p>
<p>56687 rows deleted.</p>
<p>SQL> commit;</p>
<p>Commit complete.</p>
<p><strong>Target</strong> </p>
<p>SQL> select count(*) from myobjects;</p>
<p>  COUNT(*)<br />
&#8212;&#8212;&#8212;-<br />
         0</p>
<p><strong>Source</strong></p>
<p>SQL> conn / as sysdba<br />
Connected.<br />
SQL> alter table ggs_owner.myobjects enable row movement;</p>
<p>Table altered.</p>
<p>SQL>   flashback table ggs_owner.myobjects to timestamp to_timestamp (&#8217;17-aug-2011 10:23:07&#8242;,&#8217;dd-mon-yyyy hh24:mi:ss&#8217;);</p>
<p>Flashback complete.</p>
<p>SQL> select count(*) from ggs_owner.myobjects;</p>
<p>  COUNT(*)<br />
&#8212;&#8212;&#8212;-<br />
     56687</p>
<p><strong>Target </strong></p>
<p>SQL> select count(*) from myobjects;</p>
<p>  COUNT(*)<br />
&#8212;&#8212;&#8212;-<br />
     56687</p>
<p>If we check the Extract and Replicat process reports, we can see that around the time we have performed the database flashback operation, there has been both extract and replicat activity </p>
<p><strong>Source</strong></p>
<p>2011-08-17 10:23:58  INFO    OGG-01026  Rolling over remote file ./dirdat/yy000004.<br />
2011-08-17 10:25:53  INFO    OGG-01026  Rolling over remote file ./dirdat/yy000005.<br />
2011-08-17 10:25:58  INFO    OGG-01026  Rolling over remote file ./dirdat/yy000006.</p>
<p><strong>Target</strong></p>
<p>Switching to next trail file ./dirdat/yy000004 at 2011-08-17 10:23:59 due to EOF, with current RBA 9999940<br />
Opened trail file ./dirdat/yy000004 at 2011-08-17 10:23:59</p>
<p>Switching to next trail file ./dirdat/yy000005 at 2011-08-17 10:25:54 due to EOF, with current RBA 9999930<br />
Opened trail file ./dirdat/yy000005 at 2011-08-17 10:25:54</p>
<p>Switching to next trail file ./dirdat/yy000006 at 2011-08-17 10:25:58 due to EOF, with current RBA 9999882<br />
Opened trail file ./dirdat/yy000006 at 2011-08-17 10:25:58</p>
<p>Let us now look at the <strong>Flashback Table To Before Drop</strong> operation. </p>
<p>The Metalink note states that  this operation is NOT supported, but I found that in my case, GoldenGate was still peforming the online change synchronization even after we dropped the table and flashed it back.</p>
<p>Would like others in the community to try this out themselves and provide some feedback to me on how it went for them.</p>
<p>Here is the example.</p>
<p>We will use the same MYOBJECTS table and drop it and then flash it back from the recycle bin. Note &#8211; if you are using DDL replication as well, then recycle bin has to be turned off and in that case you will not be able to flashback the table from the recycle bin using the Flashback Table To Before Drop command.</p>
<p><strong>Source</strong></p>
<p>SQL> drop table myobjects;</p>
<p>Table dropped.</p>
<p>SQL> flashback table myobjects to before drop;</p>
<p>Flashback complete.</p>
<p>SQL> update myobjects set owner=&#8217;GAVIN&#8217;;</p>
<p>56687 rows updated.</p>
<p>SQL> commit;</p>
<p>Commit complete.</p>
<p>SQL> select distinct owner from myobjects;</p>
<p>OWNER<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
GAVIN</p>
<p><strong>Target</strong></p>
<p>SQL> select distinct owner from myobjects;</p>
<p>OWNER<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
GAVIN</p>
<p>Changes have been replicated!</p>
]]></content:encoded>
			<wfw:commentRss>http://gavinsoorma.com/2011/08/does-goldengate-support-oracle-flashback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

