<?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/"
	>

<channel>
	<title>Database Specialists</title>
	<atom:link href="http://www.dbspecialists.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dbspecialists.com/blog</link>
	<description>Remote Oracle Database Administration Specialists</description>
	<pubDate>Fri, 11 Nov 2011 00:50:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NOCOUG November, 2011 report</title>
		<link>http://www.dbspecialists.com/blog/database-maintenance/nocoug-november-2011-report/</link>
		<comments>http://www.dbspecialists.com/blog/database-maintenance/nocoug-november-2011-report/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 00:50:08 +0000</pubDate>
		<dc:creator>Jay Stanley Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Database Maintenance]]></category>

		<category><![CDATA[Database Tools]]></category>

		<category><![CDATA[NOCOUG]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=292</guid>
		<description><![CDATA[For those of you who did not attend yesterday&#8217;s (November 9th, 2011) NOCOUG (Northern California Oracle User Group - http://nocoug.org) meeting, you missed a good one!  Here&#8217;s a quick recap of what I saw interesting to me:
The keynote by Feurstein Coding Therapy for Database Professionals actually had some good food for thought.  Some of [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who did not attend yesterday&#8217;s (November 9th, 2011) NOCOUG (Northern California Oracle User Group - <a title="Nocoug website" href="http://nocoug.org">http://nocoug.org</a>) meeting, you missed a good one!  Here&#8217;s a quick recap of what I saw interesting to me:</p>
<p>The keynote by Feurstein <span style="text-decoration: underline;">Coding Therapy for Database Professionals</span> actually had some good food for thought.  Some of the more interesting points:</p>
<ul>
<li>As a developer, it can really help to understand modern ideas about how the mind works; the book <span style="text-decoration: underline;">On Intelligence</span> is highly recommended.  Our brains come with lots of issues, and tons of computational power that we aren&#8217;t aware of.</li>
<li>Don&#8217;t sprinkle SQL code throughout your regular PL/SQL code; try to encapsulate database calls in wrappers. This makes implementation far easier to change.  I can definitely attest to this idea, having created quite a few APIs in PL/SQL for Java applications, and it allowed a lot of flexibility in design changes over the course of time.</li>
<li>Use subtypes for varchar2(x) fields &#8212; this is actually a feature I wasn&#8217;t aware of (and I&#8217;ve been coding pl/sql since, hmm, 1995 or so).</li>
<li>If you get stuck, try sleeping.</li>
</ul>
<p>He had other points, e.g. the relationships between developers &amp; DBAs among<br />
others (recommending the book <span style="text-decoration: underline;">Peopleware</span>), but those are the ones I remember.</p>
<p>He&#8217;s a great speaker.</p>
<p>Next I saw Feuerstein&#8217;s <span style="text-decoration: underline;">Making the Most of PL/SQL Error Management Features</span>. Actually knew most of the tips, but there is a new package since v10 I wasn&#8217;t aware of; <strong>DBMS_ERRLOG</strong> (since v10 even); this allows you to first call it to create an exception table for a given real table, then do DML on the original table.  Rejects will (such as duplicate primary/unique key) will go into the error-table instead of the entire transaction rolling back.  He&#8217;s supplied some of his own code that adds extra features.  It should be noted that it is entirely up to the developer to handle rows in that resulting table. It would be probably really good for really big updates which take lots of time, and you don&#8217;t want the entire transaction to roll back if it finds 1 problem row.</p>
<p>Next I saw <span style="text-decoration: underline;">The Case for Manual SQL tuning</span> by Dan Tow of Singing SQL; he obviously had some good points, being that understanding the application itself can make decisions far better than any cost-based analyzer, and that there are still parts of the cost-based analyzer that will fail miserably (ie anti-correlation between values in different tables used in the same query).  The current cost-based analyzer will usually work 90-99% of the time, but there are always, and likely will always be exceptions.</p>
<p>I then saw the <span style="text-decoration: underline;">Resolving Buffer Busy Waits</span> by Craig Shallahamer of OraPub.  This was by far my favorite presentation, and I wasn&#8217;t expecting it to be so, having been acquainted several times with resolving buffer-busy wait problems.  The presentation was actually far deeper than that, and gave me quite a bit of insights into the buffer pool itself; LRU chains, dirty-block buffers, cache-buffer chains, how block headers work, how segment headers for data/index-blevel/index-leaf/undo work.  Fascinating stuff - in fact this was my favorite presentation at NOCOUG in at least 6 months.</p>
<p>I actually skipped the last sessions; my colleague Terry earlier had seen an Oracle Appliance session, Visual Tuning by Example was probably pretty much a sales presentation for Delphix, and I&#8217;ve done a fair amount of reading/playing on nosql (and from Oracle, was thinking it too would be mostly sales-oriented). So, I headed downstairs for the great computer history exhibit.  It was different, and bigger than it was when I saw it apx 3 years ago, and totally worth it.  If you haven&#8217;t seen it, I&#8217;d highly recommend it, esp if you&#8217;ve been in computers awhile.  Loved the robots and very early tablet computers most, though I found myself reminiscing quite a bit about the computers I started my career with.  They even had a special video on the history of Oracle Corp.</p>
<p>Even for an Oracle veteran like myself, I found some really useful information in this last conference.  Kudos to Iggy and the entire NOCOUG team for delivering a great conference once again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/database-maintenance/nocoug-november-2011-report/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgrading Grid Infrastructure and ASM from 11.2.0.1 to 11.2.0.2 (and a bit about Oracle Restart)</title>
		<link>http://www.dbspecialists.com/blog/database-tools/upgrading-grid-infrastructure-and-asm-from-11201-to-11202-and-a-bit-about-oracle-restart/</link>
		<comments>http://www.dbspecialists.com/blog/database-tools/upgrading-grid-infrastructure-and-asm-from-11201-to-11202-and-a-bit-about-oracle-restart/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 21:13:59 +0000</pubDate>
		<dc:creator>Mike Dean Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Database Tools]]></category>

		<category><![CDATA[High Availability]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Oracle 11g]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=282</guid>
		<description><![CDATA[My initial goal was simply to create a test ASM environment on my PC running Oracle Enterprise Linux 5 and Oracle Database 11.2.0.2.  The first step was easy…download and install Grid Infrastructure 11.2.0.1. This went without a problem until I ran the ASM Configuration Assistant (asmca) and realized that ASM couldn’t see any available [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">My initial goal was simply to create a test ASM environment on my PC running Oracle Enterprise Linux 5 and Oracle Database 11.2.0.2. <span> </span>The first step was easy…download and install Grid Infrastructure 11.2.0.1.<span> </span>This went without a problem until I ran the ASM Configuration Assistant (asmca) and realized that ASM couldn’t see any available disks/partitions/raw devices because my PC only had one physical disk drive in it.<span> </span>In order to get ASM to work, I used the &#8220;dd&#8221; command to create files that ASM can treat as raw devices.<span> </span>This is strictly for a test environment and should never be done like this in Production.</p>
<p class="MsoNormal">
<p class="MsoNormal">The commands that I used were:</p>
<p class="MsoNormal">
<p class="MsoNormal"><em>#&#8211; create four 10GB files to be used for +DATA and +FRA (run as oracle)</em></p>
<p class="MsoNormal"><em> mkdir /asmdisks</em></p>
<p class="MsoNormal"><em> dd if=/dev/zero of=/asmdisks/data_disk1 bs=1024k count=10000<br />
</em><em>dd if=/dev/zero of=/asmdisks/data_disk2 bs=1024k count=10000</em><br />
<em>dd if=/dev/zero of=/asmdisks/fra_disk1 bs=1024k count=10000<br />
dd if=/dev/zero of=/asmdisks/fra_disk2 bs=1024k count=10000</em></p>
<p class="MsoNormal"><em> </em></p>
<p class="MsoNormal"><em>#&#8211; create the loop and raw devices.(run as root)<span> </span>This allows ASM to discover them as 4 </em><em>raw devices</em><br />
#<em>&#8211; NOTE: You will also need to add the following <span> </span>commands to your server startup<br />
#&#8211; scripts so that ASM can still <span> </span>see them after you reboot the server</em></p>
<p class="MsoNormal"><em> </em></p>
<p class="MsoNormal"><em>losetup /dev/loop1 /asmdisks/data_disk1<br />
losetup /dev/loop2 /asmdisks/data_disk2<br />
losetup /dev/loop3 /asmdisks/fra_disk1<br />
</em><em>losetup /dev/loop4 /asmdisks/fra_disk2</em></p>
<p class="MsoNormal"><em> </em></p>
<p class="MsoNormal"><em>raw /dev/raw/raw1 /dev/loop1<br />
raw /dev/raw/raw2 /dev/loop2<br />
raw /dev/raw/raw3 /dev/loop3<br />
raw /dev/raw/raw4 /dev/loop4</em></p>
<p class="MsoNormal"><em> </em></p>
<p class="MsoNormal"><em>#&#8211; change the permission to oracle:dba</em></p>
<p class="MsoNormal"><em>chown oracle:dba /dev/raw/raw1<br />
chown oracle:dba /dev/raw/raw2<br />
chown oracle:dba /dev/raw/raw3<br />
chown oracle:dba /dev/raw/raw4</em></p>
<p class="MsoNormal"><em> </em></p>
<p class="MsoNormal"><em>chmod 660 /dev/raw/raw1<br />
chmod 660 /dev/raw/raw2<br />
chmod 660 /dev/raw/raw3<br />
chmod 660 /dev/raw/raw4</em></p>
<p class="MsoNormal"><em><span style="font-size: 10pt;"> </span></em></p>
<p class="MsoNormal">
<p class="MsoNormal">After doing this, I was able to run asmca and create a +DATA and a +FRA disk group, each 10 GB in size (the raw devices are each 10GB and ASM mirrors them, so you end up with 10GB per disk group). Everything was going fine so far and I was able to create a database using the ASM disk groups that I just created.<span> </span></p>
<p class="MsoNormal">
<p class="MsoNormal">Just when everything was working so perfectly, I decided to change things around a bit and upgrade from 11.2.0.1 Grid Infrastructure to 11.2.0.2.<span> </span>This release introduced Oracle Restart - billed as &#8216;High Availability for a non-RAC database&#8217; and I wanted to try it out.<span> </span>It was also at this point that I thought to myself &#8220;I should have installed 11.2.0.2 Grid Infrastructure to begin with, rather than upgrading from 11.2.0.1&#8243;.<span> </span>Oh well, too late. <span> </span>On the other hand, this does provide a chance to do an upgrade that quite a few of our clients may actually do.</p>
<p class="MsoNormal">
<p class="MsoNormal">I downloaded disk3 of Patch #10098816 and followed the typical Oracle installation steps.<span> </span>One new thing with this version is that Oracle no longer does &#8220;In-place&#8221; upgrades, meaning each new release will have its own $ORACLE_HOME.<span> </span>This could cause problems for folks who hard-code the $ORACLE_HOME in scripts. Everything seemed to go without any problem until I tried to start the database I had earlier created.<span> </span>Upon startup, Oracle complained that it couldn&#8217;t read the spfile.<span> </span>Using the ASM Command Line (amscmd), I<span> </span>created a copy of the spfile in /tmp and tried to start with that. The file was created and readable, but this time, Oracle couldn&#8217;t read the control files.<span> </span>The disk groups were mounted, everything seemed fine but ASM was in an inconsistent state, sort of &#8220;stuck&#8221; between 11.2.0.1 and 11.2.0.2. <span> </span>After working on this to no avail for a while, I decided to take the &#8220;easy&#8221; way out.<span> </span>I would uninstall 11.2.0.1 and 11.2.0.2, re-install 11.2.0.2 and completely rebuild my +ASM instance.<span> </span>This was a test environment after all… probably not the way I would approach it in a Production situation.</p>
<p class="MsoNormal">
<p class="MsoNormal">With previous versions of the Oracle Installer, you could easily uninstall an ORACLE_HOME from the OUI.<span> </span>Now, when you click Uninstall, it directs to you to run a deinstall script from $ORACLE_HOME/deinstall.<span> </span>This failed for both versions and eventually I decided to just delete the $ORACLE_HOMEs and edit the oraInventory/ContentsXML/inventory.xml to remove all references to both of them.<span> </span>This seemed to work until running root.sh at the end the 11.2.0.2<span> </span>install when I got the error and helpful suggestion:</p>
<p class="MsoNormal">&#8220;<em>Improper Clusterware configuration found on this host.<span> </span>Deconfigure the existing clusterware by running &#8220;$CRS_HOME/install/roothas.pl -deconfig</em> &#8220;</p>
<p class="MsoNormal">
<p class="MsoNormal">Of course, the roothas.pl also failed but I was able to use the –force option and it then succeeded.<span> </span>I re-ran root.sh and finally 11.2.0.2 Grid Infrastructure was installed.</p>
<p class="MsoNormal">
<p class="MsoNormal">I then ran asmca and was able to create an +ASM instance and two disk groups (+DATA and +FRA) with the files I had created earlier.<span> </span>The final test was whether I could use ASM to store datafiles for another instance.<span> </span>So I fired up the Database Configuration Assistanct (dbca) and created a database with all of its files located in the +DATA diskgroup.<span> </span>Success!</p>
<p class="MsoNormal">Now, back to Oracle Restart for a moment&#8230;like I said, Oracle Restart is new with 11.2.0.2 and is advertised as High Availability for a Non-RAC instance.<span> </span>It is essentially a daemon that runs (ohasd) and will restart the database/Listener/ASM if they crash unexpectedly.<span> </span>A shutdown abort or shutdown normal will not cause it to restart, as Oracle assumes you intend for it to be down.<span> </span>This could turn out to be a great thing for situations where it may take the DBA a while to login to restart a database.<span> </span>No need for extra downtime if the database restart can be automated!</p>
<p class="MsoNormal">
<p class="MsoNormal">Oracle Restart also takes care of stopping and starting the database(s) when the server reboots.<span> </span>This is a big change for those of us who have come to know and the love the dbora start/stop scripts.<span> </span>Once you start using Oracle Restart, the /etc/oratab (or /var/opt/oracle/oratab) file is no longer used by Oracle to start the database after the system reboots.<span> </span>After I registered my database with Oracle Restart with:<br />
s<em>rvctl add database -d DEVDB01 -o /opt/oracle/product/11.2.0/dbhome_1</em><br />
I noticed that Oracle had modified my /etc/oratab, changing the Y to an N. <span> </span></p>
<p class="MsoNormal">
<p class="MsoNormal">A quick list of useful Oracle Restart commands are below:</p>
<p class="MsoNormal">
<p class="MsoNormal"><em>srvctl stop|start|status database –d &lt;database name&gt;<br />
srvctl stop|start|status asm<br />
srvctl stop|start|status listener</em></p>
<p class="MsoNormal"><em> </em></p>
<p class="MsoNormal">In then end, I got my test environment configured exactly the way I wanted.<span> </span>If I could do things differently, I would have installed Grid Infrastructure 11.2.0.2 to begin with, rather than upgrading from 11.2.0.1.<span> </span>I also would have spent more time trying to figure out what went wrong with my initial upgrade from 11.2.0.1 to 11.2.0.2.<span> </span>Ideally, the upgrade would have worked and I wouldn’t have had to go through all the extra steps.<span> </span>This does raise a concern about doing this upgrade for our clients.<span> </span>I think my next step will be to setup a new environment specifically to perform the upgrade again and figure out what went wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/database-tools/upgrading-grid-infrastructure-and-asm-from-11201-to-11202-and-a-bit-about-oracle-restart/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The often-overlooked PCTFREE property for tables and indexes</title>
		<link>http://www.dbspecialists.com/blog/uncategorized/the-often-overlooked-pctfree-property-for-tables-and-indexes/</link>
		<comments>http://www.dbspecialists.com/blog/uncategorized/the-often-overlooked-pctfree-property-for-tables-and-indexes/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 22:32:27 +0000</pubDate>
		<dc:creator>Jay Stanley, Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[SQL Tuning]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=276</guid>
		<description><![CDATA[

Why databases aren&#8217;t really fast

When most Oracle databases are inspected to see exactly what they are doing, most often it is disk I/O access. Databases read and write a lot of data, and because magnetic drive technology is slow, often the database spends a majority of its time waiting for disk read/write requests to complete.


How [...]]]></description>
			<content:encoded><![CDATA[<div class="outline-2">
<div class="outline-3">
<h3>Why databases aren&#8217;t really fast</h3>
<div class="outline-text-3">
<p>When most Oracle databases are inspected to see exactly what they are doing, most often it is disk I/O access. Databases read and write a lot of data, and because magnetic drive technology is slow, often the database spends a majority of its time waiting for disk read/write requests to complete.</p></div>
</div>
<div class="outline-3">
<h3>How Oracle manages data</h3>
<div class="outline-text-3">
<p>The main way that Oracle manages data (in datafiles), is using blocks. Each block is read, and is written, as a single object; Oracle does not read or write partial blocks. This means that if a tablespace&#8217;s block size is set at 8k (8192 bytes), whenever information is required to be read or written, it will do it in a number of 8k chunks.</p></div>
</div>
<div class="outline-3">
<h3>The <code>PCTFREE</code> property of a segment</h3>
<div class="outline-text-3">
<p>There is a property of a table or index that can be set, that will force Oracle to pack more rows into each block. This can have a very dramatic affect on the throughput of read and write requests, because if more rows of data are packed into each block, the database requires fewer read requests to satisfy the requirements of a query.</p>
<p>Oracle has provided a way to control how full a block becomes before it starts to use a new block to store rows of data; this is called the <code>PCTFREE</code> parameter. You can see the current value for tables by inspecting <code>dba_tables.pct_free</code>, or <code>dba_indexes.pct_free</code>. The <code>PCTFREE</code> parameter is set at table creation time, which will affect all rows inserted or changed in that table. If a given table/index&#8217;s <code>PCTFREE</code> parameter is changed after it&#8217;s creation, no existing blocks are changed, so the existing data in the table is not packed tighter.</p>
<p>By default, Oracle uses a value of 10 for <code>PCTFREE</code>. This means that it will add data to a block until it is 90% full; after this it will create a new block to hold information. If you set <code>PCTFREE</code> to 1, then Oracle will fill up blocks to 99% full, before using another block; This allows you to store more data in fewer blocks. If you set <code>PCTFREE</code> to 99, then Oracle will fill up blocks to 1% full before using another block.   Usually this has the general effect of causing each row to go into a single block.</div>
</div>
<div class="outline-3">
<h3>Using a low <code>PCTFREE</code></h3>
<div class="outline-4">
<h4>Low <code>PCTFREE</code> effects for reads</h4>
<div class="outline-text-4">
<p>For reads, especially scans (including full table scans), it almost always will reduce the amount of physical reads required to satisfy a read-only query (ie a select SQL statement).</p></div>
</div>
<div class="outline-4">
<h4>Low <code>PCTFREE</code> for data changes</h4>
<div class="outline-text-4">
<p>However, for row updates, this can really hurt performance, because if a field is changed in a row (via an update statement), and this requires a larger row size than is free in an existing block, then the database needs to &#8217;split&#8217; the row among 2 or more blocks. This is called &#8216;row chaining&#8217;, and can definitely affect performance adversely when those rows are read, as &gt;1 block will need to be retrieved.</p>
<p>For inserts, having a low <code>PCTFREE</code> will cause them to go faster, as more rows will be inserted for each block written.</p>
<p>Note that if an index is built with a low pctfree, it may take longer for the index to be updated when corresponding rows are updated.</p></div>
</div>
</div>
<div class="outline-3">
<h3>Low <code>PCTFREE</code> applications</h3>
<div class="outline-text-3">
<p>The ideal place to use a very low value for <code>PCTFREE</code> include:</p>
<ul>
<li> Log tables that are never updated (only inserts, and deletes in rough order of inserts)</li>
<li> auditing tables which should never be updated,</li>
<li> Tables used to support Data warehouses, esp if rows are not updated,</li>
</ul>
<p>Table examples where you probably should not use a very low value for <code>PCTFREE</code> include:</p>
<ul>
<li> Tables where the rowsize expands over the life of a row via many updates,</li>
<li> Tables that have a lot of active transactions going against them,</li>
<li> Tables where inserts and deletes happen that are not in the order of inserts</li>
<li> Tables which have lots of updates in general.</li>
</ul>
</div>
</div>
<div class="outline-3">
<h3>Using a high <code>PCTFREE</code></h3>
<div class="outline-text-3">
<p>Above the discussion has been about having a particularly low value for <code>PCTFREE</code>.   There are cases where a higher than default value for <code>PCTFREE</code> is recommended. If it is known that a rowsize will be very small upon the 1st insert, and then updated a lot (say to swell from 20 bytes to 16k bytes), and especially if the table had a high transaction rate, then forcing Oracle to store fewer rows (upon insert) will really minimize row chaining. If a table will be updating an in-row (B/C)LOB (again increasing row-length) having a low value for <code>PCTFREE</code> again would increase performance.</div>
</div>
</div>
<div class="outline-2">
<h2>Conclusion</h2>
<div class="outline-text-2">
<p>If you&#8217;re interested in changing your <code>PCTFREE</code>, try to of course test it first in a development or QA environment. The default value (10) is for many cases quite satisfactory. Using the wrong one can really hurt performance, and sometimes this happens a long time after rows are inserted.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/uncategorized/the-often-overlooked-pctfree-property-for-tables-and-indexes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Sanity Check for External Redundancy</title>
		<link>http://www.dbspecialists.com/blog/database-backups/a-sanity-check-for-external-redundancy/</link>
		<comments>http://www.dbspecialists.com/blog/database-backups/a-sanity-check-for-external-redundancy/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 22:48:27 +0000</pubDate>
		<dc:creator>Eric Keen</dc:creator>
		
		<category><![CDATA[Database Backups]]></category>

		<category><![CDATA[High Availability]]></category>

		<category><![CDATA[Real Application Clusters]]></category>

		<category><![CDATA[ASM]]></category>

		<category><![CDATA[Availability]]></category>

		<category><![CDATA[RAC]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=232</guid>
		<description><![CDATA[As with any DBA my days are filled with what seem to be unrelated tasks to the profession - writing reports, attending meetings, installing releases, planning capacity, answering alerts, patching binaries and  running upgrades.  It is easy to forget three things I should be focusing on as a remote DBA:

 Security
 Availability
 Performance

Some aspects of these core [...]]]></description>
			<content:encoded><![CDATA[<p>As with any DBA my days are filled with what seem to be unrelated tasks to the profession - writing reports, attending meetings, installing releases, planning capacity, answering alerts, patching binaries and  running upgrades.  It is easy to forget three things I should be focusing on as a remote DBA:</p>
<ul>
<li> Security</li>
<li> Availability</li>
<li> Performance</li>
</ul>
<p>Some aspects of these core functions can be delegated to other groups. For example Network Engineering may manage LDAP to augment database authentication (security), or as in this case external redundancy handled disk failures in ASM (availability).</p>
<p><strong><em>Beware</em></strong>: YOU MAY DELEGATE AUTHORITY, HOWEVER RESPONSIBILITY CAN BE VERY STICKY.  Do not think that because you authorize someone or something to take over part of a task you escape responsibility when things go wrong.  In this recent example I noticed warning messages in the ASM alert log after engineers completed an FRU battery maintenance on a SAN.</p>
<div>ORA-19816: WARNING: Files may exist in db_recovery_file_dest that are not known to database.<br />
ORA-17502: ksfdcre:4 Failed to create file +FRA<br />
ORA-00600: internal error code, arguments: [kffbAddBlk04], [],</div>
<p><strong><em><strong>Note</strong></em></strong>:  A recoverable backup was taken prior to the storage maintenance per standard operating procedures.</p>
<p>At this point we took the database out of cluster and redirected the db_recovery_file_dest to local storage, investigating why the FRA disk group mounted and then crashed the instance with an ORA-600 shortly afterwards.</p>
<p>Suspecting metadata corruption we attempted a repair:</p>
<p>SQL&gt; alter diskgroup FRA check all repair<br />
NOTE: starting check of diskgroup FRA<br />
SUCCESS: check of diskgroup FRA  found no errors</p>
<p>A little more time goes by and then:</p>
<p>ORA-00600: internal error code, arguments: [kccpb_sanity_check_2]&#8230;<br />
Shutting down instance (abort)</p>
<p>After contacting Oracle support and exhausting our options to mount the FRA we ended up initializing the disks with dd and rebuilding the disk group.</p>
<p><strong><em>Summary</em>: </strong>Backups to a Flash Recovery Area may not be as reliable as you think - especially with external redundancy on a single physical or virtual disk.  In these situations it is a good practice to maintain additional redo log members on at least two disk groups, and utilize RMAN to regularly copy archivelogs and backups to a secondary location.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/database-backups/a-sanity-check-for-external-redundancy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Intelligent date handling</title>
		<link>http://www.dbspecialists.com/blog/database-theory/intelligent-date-handling/</link>
		<comments>http://www.dbspecialists.com/blog/database-theory/intelligent-date-handling/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 22:42:25 +0000</pubDate>
		<dc:creator>Jay Stanley, Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Database Theory]]></category>

		<category><![CDATA[Regulatory Compliance]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=225</guid>
		<description><![CDATA[
Preface

There is an often overlooked issue when people design new databases; how to accurately store dates and times.   Often, little or no thought is given to the best way to do this.
Date and time columns in a database are often used to answer key business questions, such as how long does it take [...]]]></description>
			<content:encoded><![CDATA[<div class="outline-2">
<h2>Preface</h2>
<div class="outline-text-2">
<p>There is an often overlooked issue when people design new databases; how to accurately store dates and times.   Often, little or no thought is given to the best way to do this.</p>
<p>Date and time columns in a database are often used to answer key business questions, such as <em>how long does it take us to fill an order?</em>. Date and time columns are also used often to aggregate data from several sources, for example to pinpoint exact timespans of production issues, and this can include servers that span timezones.</p>
<p>This paper gives some insight into the best way to approach this issue.</p></div>
</div>
<div class="outline-2">
<h2>Overview of available datatypes in Oracle</h2>
<div class="outline-text-2">
<p>The main datatypes for storing dates/times in Oracle are:</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups">
<caption></caption>
<p><col align="left"></col><col align="left"></col></p>
<thead>
<tr>
<th scope="col">Datatype</th>
<th scope="col">Description/limitations</th>
</tr>
</thead>
<tbody>
<tr>
<td>DATE</td>
<td>Stores date down to 1 second resolution; no timezone given</td>
</tr>
<tr>
<td>TIMESTAMP</td>
<td>Stores date with given resolution, down to 9 digits of a fractional second</td>
</tr>
<tr>
<td>TIMESTAMP WITH TIMEZONE</td>
<td>Same as TIMESTAMP, but in addition the TIMEZONE is stored.</td>
</tr>
<tr>
<td>TIMESTAMP WITH LOCAL TIMEZONE</td>
<td>Same as TIMESTAMP, but all dates normalized to a particular timezone, and no timezone information stored.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="outline-2">
<h2>Old-school; store dates as <code>DATE</code> datatypes in the local timezone</h2>
<div class="outline-text-2">
<p>There are many, many database that choose to simply store dates as of the date in the local timezone; in other words, if the database is physically housed in New York City, NY, the &#8216;EST5EDT&#8217; timezone is used.</p>
<p>This actually works fairly well for many applications, until data needs to be stored that originates somewhere else, or needs to be presented to a user in a different timezone. For data that would originated in London, UK, to store it accurately will require any loading process to calculate the time in EST5EDT given time in UTC.</p>
<p>The largest problem, however, has to do with daylight savings time; each year, for most timezones, an hour is lost (disappears), and is then added as daylight savings time comes into and out of force each year.</p>
<p>This can really cause havoc on all sorts of calculations; for example, if you are graphing orders by hour, you will have a time in the fall where there will be an hour that has NO orders, and another hour in the spring where there will be two hours of orders compressed into 1 hour of time. This can even affect monthly calculations, as the month when daylight savings time ends will be short an hour.</p>
<p>It can also cause havoc on scheduled jobs, say using &#8216;cron&#8217; on a Unix machine for hourly jobs. You wil have an hour in the spring where no jobs will be run, and another in the fall where jobs will run twice in an hour.</p>
<p>A further issue also arises; when a company expands into markets that are not in the original timezone, often this causes a lot of problems, because there can be only one &#8216;official&#8217; timezone for the company&#8217;s data. This makes it more difficult to aggregate data from sources in separate timezones.</p></div>
</div>
<div class="outline-2">
<h2>New-school; store timezone information</h2>
<div class="outline-text-2">
<p>The &#8216;new&#8217; way to handle this, is to store a timestamp along with a time-zone, using the <code>TIMESTAMP WITH TIMEZONE</code> or <code>TIMESTAMP WITH LOCAL TIMEZONE</code> datatype. Unfortunately, this also will show problems when you graph things during daylight-savings-time switches. Another disadvantage is that it takes a lot more storage to store a TIMESTAMP WITH TIMEZONE than it does a DATE.</p>
<p>The other issue with this, is that we&#8217;ve seen many, many changes in the past 3-4 years with regards to when each timezone is specified to gain or lose an hour each year. This means that if you use this method, you&#8217;re going to need to insure that all of your timezone patches, that typically include not only the Oracle database, but also the OS and any end-user language libraries (ie Java) are up to date.</p></div>
</div>
<div class="outline-2">
<h2>Post-modern school; just use UTC everywhere!</h2>
<div class="outline-text-2">
<p>There is one timezone that is guaranteed to never have any daylight-savings-time issues; that being UTC, otherwise known as GMT.</p>
<p>The great thing about UTC (Universal Coordinated Time), is that it is generally accepted as being the best timezone to use for all date calculations; it&#8217;s used often in science, for instance, for that very reason.</p>
<p>You will never lose or gain an hour each year using UTC.</p>
<p>And, UTC can be very reliably used to calculate the date in <em>any timezone in history</em>.</p>
<p>If you store your dates as a <code>DATE</code> datatype, and use UTC, it should be realatively easy for any client program to calculate the date/time to any timezone that your user wishes.</div>
</div>
<div class="outline-2">
<h2>The imporance of using ntp, the Network Time Protocol</h2>
<div class="outline-text-2">
<p>When you use the database to set times and dates in an application (ie using sysdate), you&#8217;re making the assumption that the time on the database server is correct.</p>
<p>There is really only one way that it can be correct with modern hardware, and that requires that the server is running the &#8216;ntp&#8217;, or Network Time Protocol daemon, and that it is slaved with known-good time servers. It is a good idea to have more than one time server that it syncs with.</p>
<p>All servers, no matter how expensive, cannot keep very accurate time; the time will &#8216;drift&#8217; after a period of days/months. WHen this happens, all of the timestamps recorded in a database can be off.</p>
<p>It is especially important to insure that ntp is running correctly and reliably when you use Oracle RAC; RAC really depends on extremely accurate date/time synchronization across all of the nodes in the RAC cluster to perform reliably.</p></div>
</div>
<div class="outline-2">
<h2>Conclusion; use UTC everywhere; let clients calculate time for end-users</h2>
<div class="outline-text-2">
<p>For the reasons above, I would suggest that:</p>
<ul>
<li> All servers/network equipment be based in UTC,</li>
<li> All dates are stored as a &#8216;date&#8217; datatype in UTC in the database,</li>
<li> Any user interface should calculate the dates to display based upon the user&#8217;s or application&#8217;s preferences</li>
<li> Definitely set up ntp to insure that the server&#8217;s time/date is correct at all times.</li>
</ul>
</div>
</div>
<div>
<p class="author">Author: Jay Stanley of Database Specialists <a href="mailto:jstanley@dbspecialists.com">&lt;jstanley@dbspecialists.com&gt;</a></p>
<p class="date">Date: February 16, 2011</p>
<p class="creator">HTML generated by org-mode 6.34c in emacs 22</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/database-theory/intelligent-date-handling/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Standby database creation of VLDBs</title>
		<link>http://www.dbspecialists.com/blog/database-backups/standby-database-creation-of-vldbs/</link>
		<comments>http://www.dbspecialists.com/blog/database-backups/standby-database-creation-of-vldbs/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 22:44:08 +0000</pubDate>
		<dc:creator>Jay Stanley, Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Database Backups]]></category>

		<category><![CDATA[Database Maintenance]]></category>

		<category><![CDATA[Add new tag]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=220</guid>
		<description><![CDATA[
Introduction

I have mentioned before that the best way to insure Oracle RDBMS uptime, is to create and maintain a physical standby database.  There simply is no more reliable way to insure uptime for the Oracle RDBMS.
Creating a standby database involves these steps:

 Creating a standby controlfile from the primary database &#38; transferring it to [...]]]></description>
			<content:encoded><![CDATA[<div class="outline-2">
<h2>Introduction</h2>
<div class="outline-text-2">
<p>I have mentioned before that the best way to insure Oracle RDBMS uptime, is to <a href="../database-backups/need-uptime-use-and-oracle-physical-standby-database">create and maintain a physical standby database</a>.  There simply is no more reliable way to insure uptime for the Oracle RDBMS.</p>
<p>Creating a standby database involves these steps:</p>
<ul>
<li> Creating a <em>standby controlfile</em> from the primary database &amp; transferring it to the standby,</li>
<li> Modifying parameters on the primary database to ship logs to the standby if using Enterprise Edition, or setting up shell scripts to the same,</li>
<li> Setting up a special parameter file for the standby database that will accept redo from the primary database,</li>
<li> Copying all datafiles from the primary database to the standby database,</li>
<li> Starting the standby database, and enabling log shipping from the primary database,</li>
<li> Optionally, if using dataguard, adding in dataguard configuration and enabling it,</li>
<li> Monitor the standby database to insure that it is applying logs from the primary,</li>
<li> Testing failover to the standby database to insure all parts are working.</li>
</ul>
<p>The steps above are well-documented in the <em>Oracle Dataguard Concepts and Administration</em> manual. For most setups, creating a standby database is not too difficult. However, for very large databases with high transaction/redo rates, a serious issue can become evident.</p>
<p>The problem is that for a standby database to stay in-sync with the primary database after creation, it needs to have access to all of the redo that has been generated from the time that the files were backed up on the primary. For very large databases (ie 10Tb+), it&#8217;s not uncommon for it to take a number of days to backup/transfer datafiles from the primary to the standby database. When those datafiles are finally restored on the standby database, the redo that was generated over these days needs to be applied to the standby, before the standby can accept new redo from the primary database, and this can be a very large quantity of redo!</p>
<p>For very large databases that generate lots of redo (say 1Tb/day), this may require that the newly created standby may need to apply several Tb of redo, and it needs to do this quickly. Unless you have a LOT of disk space to stage those redo logs, this is going to be very difficult to do.</p>
<p>This presentation describes one way to get around this issue.</p></div>
</div>
<div class="outline-2">
<h2>The secret</h2>
<div class="outline-text-2">
<p>So, what&#8217;s the secret? The main secret is to create the standby incrementally, datafile by datafile, over an extended period of time, and keeping the datafiles transferred all synced with the primary soon after they are transferred.</p>
<p>It turns out that Oracle physical standby databases manage controlfiles differently than primary databases. When you issue &#8216;alter database drop datafile mydatafile.dbf including contents and datafiles&#8217; on a primary database, the controlfile is updated, and the history of that datafile is wiped clean; there really is no way to restore a datafile after it has been dropped.</p>
<p>However, on a standby database, when you issue a &#8216;alter database drop datafile mydatafile.dbf&#8217; on a standby database, <em>the history of that datafile actually doesn&#8217;t go away</em>! It is simply marked with a &#8216;delete&#8217; flag in memory, which causes the Oracle recovery process on the standby database to skip that datafile.</p>
<p>Using this information, you can create a standby database datafile-by-datafile, over a period of days, weeks, or even months, by:</p>
<ol>
<li> Creating a <em>standby controlfile</em> from the primary and shipping it to the standby,</li>
<li> Modifying parameters on the primary database to ship logs to the standby if using Enterprise Edition,</li>
<li> Setting up a special parameter file for the standby database that will accept redo from the primary database,</li>
<li> Copy the first datafile from the primary to the standby (or restore it using RMAN),</li>
<li> Start the standby database in &#8216;mount&#8217; mode (<em>alter database mount standby database</em>).  You will notice that in <code>v$datafile_header</code>, the 1st datafile will have a status of <code>ONLINE</code>, and all other datafiles will have a status of <code>ERROR</code>.</li>
<li> For all datafiles that have a status of <code>ERROR</code>, issue a &#8216;alter database drop datafile <code>datafile_name</code>;&#8217; on the standby database.</li>
<li> Initiate standby recovery on the standby database, (<em>recover managed standby database..</em>)</li>
<li> Initiate redo transfer from the primary to the standby (ie set the <code>LOG_ARCHIVE_DEST_n_ENABLE</code> parameter in the primary)</li>
<li> Insure that the standby is applying redo from the primary database (ie <code>v$dataguard_status</code> in the standby).</li>
<li> This is now stable; the 1st datafile will be kept up-to-date.  You can&#8217;t really use (or open) the standby database yet.</li>
<li> When you are ready for the next datafile, transfer the datafile from the primary to the standby,</li>
<li> Shut down the standby (<em>shutdown immediate</em>).  Then, start it back up (<em>startup nomount; alter database mount standby database</em>).</li>
<li> Again, note which datafiles have a status of <code>OFFLINE</code> in <code>v$datafile_header</code>.  For each of those, re-issue the <em>alter database drop datafile</em> <code>datafile_name</code>.</li>
<li> Begin redo application from the standby (ie <em>alter database recover managed standby database…</em>).</li>
<li> The database is again &#8217;stable&#8217; – the 1st two datafiles will be kept in-sync from the primary.</li>
<li>Repeat the steps above (11-15) for each datafile in turn. If you like, you can copy a few files at a time; it depends on how big they are, and how much redo you can keep around.</li>
</ol>
<p>One note; when you&#8217;re using the process above, remember that the view <code>v$datafile_header</code> on the standby is very, very useful; it will not only show which datafiles have been scanned, but also the last system change number (SCN) of each datafile to see how they are syncing.</p>
<p>The steps above allow you to create a standby database incrementally, datafile-by-datafile, over an extended period of time.</p></div>
</div>
<div class="outline-2">
<h2>Conclusion</h2>
<div class="outline-text-2">
<p>It is not often that a standby database needs to be created in this way; it is warranted only for very large databases with high redo rates, or setups which have virtually no extra disk space on the standby to hold redo. It is obviously a lot more work to create one this way. However, if you run into a situation like this, knowing that there is a way around this issue can be very useful.</p></div>
</div>
<div>
<p class="author">Author: Jay Stanley of Database Specialists <a href="mailto:jstanley@dbspecialists.com">&lt;jstanley@dbspecialists.com&gt;</a></p>
<p class="date">Date: December 22, 2010</p>
<p class="creator">HTML generated by org-mode 6.34c in emacs 22</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/database-backups/standby-database-creation-of-vldbs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Transportable Tablespaces for Oracle Upgrades</title>
		<link>http://www.dbspecialists.com/blog/uncategorized/using-transportalble-tablespaces-for-oracle-upgrades/</link>
		<comments>http://www.dbspecialists.com/blog/uncategorized/using-transportalble-tablespaces-for-oracle-upgrades/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 20:35:02 +0000</pubDate>
		<dc:creator>Gary Sadler, Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=214</guid>
		<description><![CDATA[Many of us are familiar with the idea of using the Oracle 10g cross-platform transportable tablespaces (XTTS) feature to migrate a database to another operating system.  Our founder Roger Schrag wrote a fantastic whitepaper on the subject which can still be found at:
 
http://www.dbspecialists.com/files/presentations/changing_platforms.html
 
along with many other useful whitepapers about performance tuning, software installation, remote database [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Many of us are familiar with the idea of using the Oracle 10g cross-platform transportable tablespaces (XTTS) feature to migrate a database to another operating system.<span style="mso-spacerun: yes;">  </span>Our founder Roger Schrag wrote a fantastic whitepaper on the subject which can still be found at:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"><a href="http://www.dbspecialists.com/files/presentations/changing_platforms.html"><span style="color: #0000ff;">http://www.dbspecialists.com/files/presentations/changing_platforms.html</span></a></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">along with many other useful whitepapers about performance tuning, software installation, remote database administration, and a range of topics.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Not to downplay that capability, but given that the big wave of migrations to Linux has somewhat played out, I have found the Transportable Tablespace (TTS) feature also very useful for doing Oracle upgrades in less time than might be experienced with a traditional export/import approach, particularly in cases where the database is a <strong><span style="color: #000000;">fatty</span></strong>.<span style="mso-spacerun: yes;">  </span>It’s still hard to beat the in-place upgrade for limiting downtime during an upgrade, but what if you’re also moving to bigger and better hardware?<span style="mso-spacerun: yes;">  </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">For limiting downtime during the combination of upgrading Oracle and moving to a new piece of iron, I recommend transportable tablespaces.<span style="mso-spacerun: yes;">  </span>Trouble is there seems to be precious little information available from Oracle on how to do this.<span style="mso-spacerun: yes;">  </span>There is absolutely no mention of using transportable tablespaces in the Upgrade Guide.<span style="mso-spacerun: yes;">  </span>But it’s definitely doable. </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"><span style="mso-spacerun: yes;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">For starters, you must use Enterprise Edition on your source database to generate a set of transportable tablespaces.<span style="mso-spacerun: yes;">  </span>They can be imported into a Standard Edition database, which is also not a bad method of moving from EE to SE, by the way.<span style="mso-spacerun: yes;">  </span>There are other limitations, too, such as with XMLTypes and <em>opaque</em> types, such as RAW.<span style="mso-spacerun: yes;">  </span>BINARY_FLOAT and BINARY_DOUBLE types can only be transported using Data Pump.<span style="mso-spacerun: yes;">  </span>In any case check the manual before proceeding to be sure that your database is a good candidate for an upgrade via TTS.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">As an aside, beginning with 10gR2 there is a feature known as Transportable Database (TDB) which can be handy when the source platform is on a different OS as the target platform, but the endian format must be the same and TDB cannot be used for upgrades.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">While I haven’t tried every possible upgrade, Metalink claims that beginning with Oracle 8i there should be no problem with transporting a tablespace into a higher version.<span style="mso-spacerun: yes;">  </span>There are some differences in capability between some versions, however.<span style="mso-spacerun: yes;">  </span>For example, directly transporting materialized views and function-based indexes is not supported until 10g.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">The upgrade using TTS should proceed like this:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"><span style="text-decoration: underline;">Preparation</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<ol style="margin-top: 0in;" type="1">
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Create an empty database on the new host using the higher Oracle version.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Capture the DDL for objects stored in the SYSTEM and SYSAUX tablespaces, such as PL/SQL, users, system privileges, etc.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Perform a full backup on the source database.</span></li>
</ol>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"> </p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Step #2 above is one that will require testing to make sure you don’t leave anything behind.<span style="mso-spacerun: yes;">  </span>It’s not a huge task but one that shouldn’t be taken lightly, either.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"><span style="text-decoration: underline;">Upgrade</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span></p>
<ol style="margin-top: 0in;" type="1">
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">On the source database put the tablespaces to be transported into “read only” mode.<span style="mso-spacerun: yes;">  </span>Remember that the SYSTEM and SYSAUX tablespaces cannot be transported.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Run your Data Pump job to export the tablespace metadata.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Stop or quiesce the source database.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Copy or otherwise make available to the target database the data files from the transported tablespaces.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Run you Data Pump job to import the tablespace metadata.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Put the tablespaces into “read write” mode on the target database.</span></li>
<li class="MsoNormal"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">Perform a full backup on the target database.</span></li>
</ol>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;"> </span><span style="font-family: &quot;Trebuchet MS&quot;; font-size: 10pt;">That’s the long and short of it.<span style="mso-spacerun: yes;">  </span>Step #4 above is the one that will likely make or break this method.<span style="mso-spacerun: yes;">  </span>If you have to copy lots of big files across a slow connection, then you’re defeating the purpose of using this method, which is to limit downtime, although it may still be faster than export/import.<span style="mso-spacerun: yes;">  </span>If, on the other hand, you can just swing you storage device over to a new database host, then Step #4 will take no time at all.<span style="mso-spacerun: yes;">  </span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/uncategorized/using-transportalble-tablespaces-for-oracle-upgrades/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Understanding Oracle Redo</title>
		<link>http://www.dbspecialists.com/blog/database-backups/understanding-oracle-redo/</link>
		<comments>http://www.dbspecialists.com/blog/database-backups/understanding-oracle-redo/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 23:20:26 +0000</pubDate>
		<dc:creator>Jay Stanley, Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Database Backups]]></category>

		<category><![CDATA[Database Tuning]]></category>

		<category><![CDATA[High Availability]]></category>

		<category><![CDATA[concepts]]></category>

		<category><![CDATA[Oracle RDBMS]]></category>

		<category><![CDATA[redo]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=208</guid>
		<description><![CDATA[In the Oracle RDBMS, one of the most frequently misunderstood concepts I see in doing remote database administration, is the role and importance of redo.]]></description>
			<content:encoded><![CDATA[<p>In the Oracle RDBMS, one of the most frequently misunderstood concepts I see in doing remote database administration, is the role and importance of redo. From the Oracle 10G Concepts manual, the definition of redo is:</p>
<div class="outline-2">
<div class="outline-text-2">
<p><em>The primary function of the redo log is to record all changes made to data. If a failure prevents modified data from being permanently written to the datafiles, then the changes can be obtained from the redo log, so work is never lost.</em></p>
<p>To me, that&#8217;s not an entirely good explanation.</p>
<p>It&#8217;s easier to understand redo if we look at the history of a transaction. A transaction here refers to a session that issues a set of SQL statements that do SQL inserts, updates and/or deletes, and then issues a &#8216;commit&#8217; statement.</p>
<p>The first thing that happens while the inserts/updates/deletes are happening, is that there is a record of every datafile block change made, and these are inserted into a memory structure called the &#8216;redo log buffer&#8217;. When the session does a &#8216;commit&#8217;, a process (LGWR) flushes the redo log buffer information to the online redo log files. Every transaction that Oracle completes is written to these online redo log files; under normal circumstances, when a session commits changes to the database, the session does not regain control until information about those changes have been written to the online redo log file(s).</p>
<p>These online redo log files are of a fixed size; when they fill up, LGWR switches the online redo log file it is writing to, to the next redo log. What happens next depends on how the Oracle database is configured.</p>
<p>Oracle can be run in two different ways.  The first is called <em>archivelog</em> mode, in which online redo log files are copied to a new destination when LGWR is done writing to them; these are called <em>archived redo log files</em>.  Or, Oracle can run in <em>noarchivelog</em> mode, in which case these copies do not take place, and there is no ARCH process. As these file copies do take resources, running a database in <em>noarchivelog</em> mode can make it run faster; however, this also means that it will be impossible to recover a database in the future, so almost all databases run in <em>archivelog</em> mode. The copy of online redo log files to archived redo log files is done by a process called &#8216;ARCH&#8217;, the redo archiver. ARCH only copies files that LGWR has finished writing to.</p>
<p>The main advantage of running a database in <em>archivelog</em> mode, is that if you have a cold backup of the database (or a valid hot backup, available only in archivelog mode), you can <em>recover</em> the database, replaying the transactions in the archived (and online) redo logs, so that these transactions are not lost, and a full recovery is possible. Without them, you can only recover to the time that the backup took place, so transactions will very likely be lost.</p>
<p>Since ARCH only copies completed online redo logs if the database is in <em>archivelog</em> mode, the LGWR process will refuse to write to an online redo log file that has not yet completed archiving. If the LGWR process ends up waiting on the ARCH process, every session in the database that issues a &#8216;commit&#8217; statement will need to wait; control will not be returned to the client program; no new commits are accepted. Sessions just wait for Oracle to return control to them, and this basically means that transaction througput goes to 0. No session is able to continue (after their commit), until this is ARCH completes, which then enables LGWR to work again.</p>
<p>Over time, these archived redo log files will eventually fill up whatever target directory they are being written to, so some process (there are several ways to do this) needs to remove them before that happens. If this is not accomplished, the target directory fills up. You can see from the model above, that the ARCH program won&#8217;t be able to complete archiving an online redo log file, the LGWR fills up all other available online redo log files, until finally LGWR ends up waiting on ARCH to complete, until disk space is available again.</p>
<p>There are a few interesting facts about this setup, which is virtually identical with every disk-based modern relational database:</p>
<ul>
<li> Redo is only generated by database changes (commonly inserts/updates/deletes).  A read-only database will generate no redo.</li>
<li>If the disk containing the online redo logs can&#8217;t keep up in pure bandwidth (Mb/second), transactions will slow down; there will be a pause after every client &#8216;commit&#8217;.</li>
<li>If the disks can&#8217;t keep up in latency (if they take a long time for each write to complete), again, transactions will slow down. This is different than than bandwidth; if there are 1000 sessions committing every second, then there will likely be a demand of 1000 writes/second to the online redo log files. Most modern magnetic disks can only do about 100-200 operations per second, so this is a very common problem, usually solved by using RAID.</li>
<li>If archiving is overall slower than the redo rate, then eventually LGWR will need to wait for ARCH to finish as explained above. Again, sessions end up waiting on the &#8216;commit&#8217; statement.</li>
<li>If a client application issues a lot of small transactions with frequent commits, LGWR will need to do more separate writes to the online redo log files. Doing fewer commits means that the IOPS of the online redo log files is reduced, improving throughput if this is a bottleneck.</li>
<li>This has very little to do with the writes that happen to the datafiles themselves; this is a completely separate process (DBWR), and this happens using asychronous operating system calls. LGWR uses operating system calls which are synchronous; they will not return until it is confirmed that the data really is on disk.</li>
<li>When ARCH copies an online redo log file and archives it, it does it continuously, so the target archivelog directory typically doesn&#8217;t require the IOPS that online redo log files do.</li>
<li>If online redo log files are too small, since LGWR has to pause a bit when it switches log groups, this also causes sessions to wait on &#8216;commits&#8217;.</li>
</ul>
<p>There are a lot of considerations about redo; I have not touched on the topics of standby databases, supplemental logging, or duplexed online redo log files, and there are many others.</p>
<p>To see if your database is suffering because of a slow redo stream, look for the &#8216;log file sync&#8217; wait event in the Database Specialists DBRX portal if you are a customer, or you can use Enterprise Manager, AWR reports, statspack reports, or other tools to find this.</p></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/database-backups/understanding-oracle-redo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simplifying storage management; using fewer tablespaces</title>
		<link>http://www.dbspecialists.com/blog/uncategorized/simplifying-storage-management-using-fewer-tablespaces/</link>
		<comments>http://www.dbspecialists.com/blog/uncategorized/simplifying-storage-management-using-fewer-tablespaces/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:21:19 +0000</pubDate>
		<dc:creator>Jay Stanley, Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Database Maintenance]]></category>

		<category><![CDATA[Database Monitoring]]></category>

		<category><![CDATA[High Availability]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=203</guid>
		<description><![CDATA[Sooner or later, every DBA will need to address how to manage storage capacity in their databases. Nearly every database needs more storage as time goes on, and without attention, the database will fill up, and new data/inserts can&#8217;t happen. It&#8217;s been my experience that bad space mangement is the root cause of a high [...]]]></description>
			<content:encoded><![CDATA[<p>Sooner or later, every DBA will need to address how to manage storage capacity in their databases. Nearly every database needs more storage as time goes on, and without attention, the database will fill up, and new data/inserts can&#8217;t happen. It&#8217;s been my experience that bad space mangement is the root cause of a high percentage of database downtime incidents.</p>
<p>In the Oracle RDBMS, every <em>segment</em> (table/table partition, index/index partition, queue) must be assigned to a particular tablespace. Each tablespace is composed of one or more datafiles. Datafiles do have a maximum size, depending on the blocksize for traditional <em>smallfile</em> tablespaces; for a tablespace with a block size of 8k, the maximum size of a datafile is just under 32Gb. So, each tablespace is typically comprised of many datafiles. Oracle has several tablespaces that are built-in; these include the SYSTEM, SYSAUX, TEMP, and UNDO/ROLLBACK tablespaces.</p>
<p>Let&#8217;s say that you wanted to make the work of the next DBA who manages a database you control as hard as possible. One of the easiest ways to do this is to create a database with LOTS of tablespaces; you could even create 1 tablespace per segment. This means that instead of worrying about one &#8216;pool&#8217; of storage, the next DBA will need to manage dozens, or hundreds, of storage pools. Because this management is mission-critical (if ANY tablespace fills up, your application may not work), it is far more likely that one will be overlooked, and fill up. Using lots of tablespaces will also make it far more likely that a lot of space is wasted in each tablespace, because every tablespace will need to maintain a certain amt of free space to be &#8217;safe&#8217; from future increases in growth.  If a segment is dropped or shrunk, the space released will be only in that one tablespace, and won&#8217;t be able to be used by segments assigned to all of the other tablespaces.</p>
<p>If you wanted to make the the work of the next DBA who manages a database you control the easiest, you&#8217;d create just one tablespace (which could be a BIGFILE tablespace, which can use larger files than SMALLFILE tablespaces), and stick all of your segments into there. There would only be one tablespace to manage; when segments are shrunk or removed in the course of business, that space can immediately be used by any other segment. To manage extent sizes, you could simply use the EXTENT MANAGEMENT LOCAL AUTOALLOCATE feature, which automatically gives you near-to-optimimum sizes.</p>
<p>Prior to Oracle 10g, there were many legitimate reasons to use multiple tablespaces and there still are good reasons to segregate your segments into separate tablespaces. Some of these reasons are:</p>
<ul>
<li>You may need different block sizes for different segments for best performance; since each tablespace has one block size, to use different ones you need different tablespaces.</li>
<li>If you aren&#8217;t using a SAN, or ASM, or similar storage solution, you may wish to segregate segments on differnet LUNs/drives for better performance. Given the size of today&#8217;s databases, and the need for high IOPS storage solutions, most non-trivial databases are using SANs/ASM/other storage solutions these days. Using these, it doesn&#8217;t give you better performance by segregating tablespaces.</li>
<li> If you need to use the &#8216;transportable tablespaces&#8217; feature to move large quantities of data between Oracle databases,</li>
<li>If you use Oracle&#8217;s direct-path load feature, which loads data above the high-water mark of each datafile directly for faster data loading (by bypassing the internal SQL engine), then you may wish to continually create new tablespaces for this purpose.</li>
<li>If you have several separate users in your database, and wish to &#8217;split&#8217; the database in the future so that you have one databases each for each user, then you may wish to create a dedicated tablespace for each user. This would allow you to clone half of the database using RMAN on a new machine, and OFFLINE DROP the datafiles you do not want.</li>
</ul>
<p>In conclusion, one easy way to make your oracle database use space more efficiently, be easier to manage, and therefore be less likely to fill up, is to use fewer, larger application tablespaces, rather than more.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/uncategorized/simplifying-storage-management-using-fewer-tablespaces/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Need uptime?  Use an Oracle Physical Standby database</title>
		<link>http://www.dbspecialists.com/blog/database-backups/need-uptime-use-and-oracle-physical-standby-database/</link>
		<comments>http://www.dbspecialists.com/blog/database-backups/need-uptime-use-and-oracle-physical-standby-database/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 22:56:55 +0000</pubDate>
		<dc:creator>Jay Stanley, Sr. Staff Consultant</dc:creator>
		
		<category><![CDATA[Best Practices]]></category>

		<category><![CDATA[Database Backups]]></category>

		<category><![CDATA[High Availability]]></category>

		<category><![CDATA[remote dba]]></category>

		<category><![CDATA[Remote DBA services]]></category>

		<guid isPermaLink="false">http://www.dbspecialists.com/blog/?p=196</guid>
		<description><![CDATA[Over the years of experience with Oracle databases, there is one feature, far more than any others, that has proved itself again and again in the real world; I speak of course, of the Oracle Physical Standby feature.]]></description>
			<content:encoded><![CDATA[<p>Oracle over the years has come out with a bewildering array of features to minimise downtime for databases.  In fact, the number of methods to accomplish this goal is at least a dozen.  Over the years of experience with Oracle databases, there is one feature, far more than any others, that has proved itself again and again in the real world; I speak of course, of the Oracle Physical Standby feature.</p>
<p>The Oracle Physical Standby feature is not new at all; I was using it back in 1995 when I first started working as an Oracle DBA with version 7; perhaps that&#8217;s why it&#8217;s as reliable as it is.  Although there have been cases where standby databases do encounter bugs, with proper monitoring (for example, with the monitoring done by <a title="Database Rx" href="http://www.dbspecialists.com/remotedba.html">Database Rx</a>) this is not an issue.</p>
<p>So, why am I recommending Oracle Physical Standby databases over the other methods you can use to insure uptime?  What makes it so special?</p>
<ul>
<li>An Oracle Physical Standby database has nothing shared with the primary database; it (typically) runs on a separate server, using its own storage, it&#8217;s own memory, and it&#8217;s own network interface; machines/disks/memory/network cards all break sooner or later (it&#8217;s not &#8220;if&#8221;, it&#8217;s &#8220;when&#8221;).  Some folks say that RAC serves this purpose, but in fact it does not; all nodes in a RAC cluster read and write to the same storage subsystem, so that is a potential single point of failure.</li>
<li>If you can afford the network connection necessary, you can physically place your physical standby database in a separate data center, so even if your primary data center burns up, your data is safe.</li>
<li>This feature is available in all versions of Oracle, though for Standard Edition and lower, you will need to come up with scripts to move archivelogs and apply them on the standby, as we do for our<a title="Remote DBA" href="http://www.dbspecialists.com/remotedba.html"> Remote DBA</a> clients.</li>
<li>For Standard Edition, you can tune it so that you will lose a maximum of one archived redo log worth of data worst-case, if your primary database disappears.</li>
<li>If using the Enterprise Edition, you can have Oracle itself manage it, and in fact use advanced automatic failover methods using a feature called Dataguard, that can switch primary/standby database roles very quickly and easily.</li>
<li>If using the Enterprise Edition, you can set parameters to delay the application of data from the primary to the standby by a certain amount of time.  This would be useful if you suffered logical corruption on the primary database (ie someone dropping a table) and could catch it fast enough.</li>
<li>If using the Enterprise Edition, you can use the Flashback Database feature to allow the standby to recover from logical errors on the primary database even easier,</li>
<li>Also, if using the Enterprise Edition, you can actually make the standby stay up-to-date with the primary database in near-real-time, by making the log-writer (LGWR) process on the primary, ship redo directly to the standby, even before that redo is archived.</li>
<li>Although there are restrictions, you can actually open up a standby database in read-only mode for reporting.  In versions before Oracle 11g, the standby cannot apply changes from the primary while it is open this way; however, there is a new feature in 11G called &#8216;Active Data Guard&#8217; that allows this.</li>
<li>In my experience, Oracle Logical standby databases are not as reliable as compared with Physical Standbys.</li>
<li>Another advantage; you can use your physical standby database to do RMAN backups from, which can dramatically reduce the load on your primary database.</li>
</ul>
<p>The main disadvantage to setting up a standby database, is that you will double your hardware cost; you will need a server/disk able to handle your peak production loads.  It will also cost you an extra Oracle license for that instance.  This will double the amount of space in your datacenter used, and also double the amount of electricity/heat produced.  For many businesses though, this cost is far less then the cost incurred by a lengthy database recovery.</p>
<p>There is nothing more relieving than when a primary database malfunctions, and you are able to continue production with failover times usually measured in under 10 minutes, rather than potentially waiting days/weeks for new hardware and a full restore from backup.  There is no other feature that as dramatically improves the potential uptime of an Oracle Database as much, as using a Physical Standby database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dbspecialists.com/blog/database-backups/need-uptime-use-and-oracle-physical-standby-database/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

