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

<channel>
	<title>die Seilerwerks</title>
	<atom:link href="http://seilerwerks.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://seilerwerks.wordpress.com</link>
	<description>Chronicling Life, Love, Linux and Oracle database administration.</description>
	<lastBuildDate>Sun, 22 Nov 2009 16:38:16 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='seilerwerks.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/0415339fd68a5fa9c79221fdb653162a?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>die Seilerwerks</title>
		<link>http://seilerwerks.wordpress.com</link>
	</image>
			<item>
		<title>A Drupal Backup Script</title>
		<link>http://seilerwerks.wordpress.com/2009/11/22/a-drupal-backup-script/</link>
		<comments>http://seilerwerks.wordpress.com/2009/11/22/a-drupal-backup-script/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 16:28:55 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=454</guid>
		<description><![CDATA[I maintain a drupal codebase that hosts multiple sites.  I&#8217;ve been shamefully lax in getting regular backups of those files and databases, until today.  Here is a pretty basic bash script that will create a bzip2 archive of the drupal codebase (including site-specific dirs), and then create mysqldump exports of each site&#8217;s database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=454&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I maintain a drupal codebase that hosts multiple sites.  I&#8217;ve been shamefully lax in getting regular backups of those files and databases, until today.  Here is a pretty basic bash script that will create a bzip2 archive of the drupal codebase (including site-specific dirs), and then create mysqldump exports of each site&#8217;s database and gzip those files.  This particular script requires that the drupal install directory be named &#8220;drupal&#8221;, but you can change this easily enough to suit your needs.</p>
<p>This does require a ~/.drupalsites file that contains the needed database login info (suggest chmod 600).  Like I said, nothing too clever.</p>
<pre class="brush: bash;">
#!/bin/bash
DATESTAMP=`date +%Y%m%d`
SITESFILE=${HOME}/.drupalsites
# SITESFILE contents are in the following format:
# SITENAME:DBNAME:DBUSER:DBPASSWD
DRUPALDIR=/path/to/drupal
BACKUPDIR=${HOME}/backups/${DATESTAMP}

mkdir -p ${BACKUPDIR}

# Backup the drupal codebase
echo -n &quot;Backing up ${DRUPALDIR} ... &quot;
cd ${DRUPALDIR}/../
tar -cjpf ${BACKUPDIR}/drupal_${DATESTAMP}.tar.bz2 drupal
echo &quot;Done.&quot;

cd ${BACKUPDIR}

# Backup MySQL Databases
cat $SITESFILE | while read line; do
        #echo $line
        line=(${line//:/ })
        echo -n &quot;Backing up MySQL db ${line[1]} ... &quot;
        DUMPFILE=${line[0]}_${DATESTAMP}.sql
        mysqldump -u ${line[2]} -p${line[3]} ${line[1]} &gt; ${DUMPFILE}
        gzip ${DUMPFILE}
        echo &quot;Done.&quot;
done

echo &quot;Backup completed, all files are in ${BACKUPDIR}.&quot;
</pre>
<p>This script runs fine from cron, I have it scheduled for a weekly run.  I then plan to rsync this to my home server for an offsite copy, even though the hosting service provides backups as well.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/454/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/454/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/454/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=454&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/11/22/a-drupal-backup-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>HOWTO: Oracle Cross-Platform Migration with Minimal Downtime</title>
		<link>http://seilerwerks.wordpress.com/2009/10/27/howto-oracle-cross-platform-migration-with-minimal-downtime/</link>
		<comments>http://seilerwerks.wordpress.com/2009/10/27/howto-oracle-cross-platform-migration-with-minimal-downtime/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 18:49:33 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=449</guid>
		<description><![CDATA[Originally posted at The Pythian Group blog.
I recently performed a migration from Oracle 10gR2 on Solaris to the same version on Linux, immediately followed by an upgrade to 11g.  Both platforms were x86-64.  Migrating to Linux also included migrating to ASM, whereas we had been using ZFS to hold the datafiles on Solaris. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=449&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Originally posted at <a href="http://www.pythian.com/news/3653/howto-oracle-cross-platform-migration-with-minimal-downtime">The Pythian Group blog</a>.</em></p>
<p>I recently performed a migration from Oracle 10gR2 on Solaris to the same version on Linux, immediately followed by an upgrade to 11g.  Both platforms were x86-64.  Migrating to Linux also included migrating to ASM, whereas we had been using ZFS to hold the datafiles on Solaris.  Restoring files into ASM meant we would have to use RMAN (which we would probably choose to use anyway).</p>
<p>As with many databases, the client wanted minimal downtime.  It was obvious to us that the most time-consuming operation would be the restore and recovery into the new instance.  We were basically doing a restore and recovery from production backups and archived redo logs.  It quickly dawned on me that we could start this operation well before the scheduled cutover time and downtime window, chopping at least six hours from the downtime window.  The client would only need to keep the new instance in mount mode after the initial restore/recovery finished, periodically re-catalog the source instance&#8217;s FRA (which was mounted via NFS), and then re-run the <code>recover database</code> command in RMAN.  Once the time comes to cutover, simply <code>archivelog current</code> the original instance and <code>shutdown immediate</code>.  Then open the new instance with the <code>RESETLOGS</code> option, and voila!  Migration complete!</p>
<p>I&#8217;ll try to recreate a simple example here.  <span id="more-449"></span></p>
<p>On the new instance, assume that you have ASM set up and configured with two disk groups, <code>DATA</code> and <code>REDO</code>.  Let&#8217;s also assume that you have the FRA directory (or the directory where you hold backups and archivelogs) mounted from the Solaris host to the Linux host under <code>/solfra/prod/</code>.  Here&#8217;s the command we used:</p>
<pre class="brush: bash;">
mount -o hard,bg,tcp,nfsvers=3,suid,rsize=32768,wsize=32768,nointr,noac,ro solhost:/fra /solfra/
</pre>
<p>We then need to get a pfile and edit it for <em>ASM-ification</em>.  You can either restore the spfile from backup or just export a pfile from the current running production instance.  To do the former, you&#8217;d need to go into RMAN and run an operation similar to this (best to ensure that the <code>ORACLE_HOME</code>, <code>ORACLE_SID</code>, and other Oracle-related environment variables are set properly):</p>
<pre class="brush: sql;">
RMAN&gt; startup force

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/home/oracle/app/oracle/product/10.2.0/db_1/dbs/initprod.ora'

starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 06/29/2009 13:34:50
ORA-00205: error in identifying control file, check alert log for more info
RMAN&gt;
RMAN&gt; restore spfile to pfile 'initprod.ora' from autobackup recovery area = '/solfra/' db_unique_name = 'PROD';

Starting restore at 29-JUN-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK

recovery area destination: /solfra/
database name (or database unique name) used for search: PROD
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /solfra/PROD/autobackup/2009_06_29/o1_mf_s_690813149_54kypcxz_.bkp
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 29-JUN-09
</pre>
<p>From here you can go into sqlplus and <code>CREATE PFILE FROM SPFILE;</code>.</p>
<p>Now we have our text pfile in <code>$ORACLE_HOME/dbs/initprod.ora</code>, and we want to make these changes specific to the transition to ASM:</p>
<pre>
*.control_files='+DATA','+REDO'
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+REDO'
*.db_recovery_file_dest='/path/to/fra'
*.db_recovery_file_dest_size='2000G'
</pre>
<p>Obviously, the last two parameters about location and size of the FRA should be tailored to your setup.</p>
<p>We then create a new SPFILE with <code>CREATE SPFILE FROM PFILE;</code>.</p>
<p>Now we&#8217;re ready to restore the controlfile(s) from backup:</p>
<pre class="brush: sql;">
RMAN&gt; startup force;

Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 08/13/2009 20:20:56
ORA-00205: error in identifying control file, check alert log for more info

RMAN&gt; restore controlfile from autobackup recovery area = '/solfra/' db_unique_name = 'PROD';

Starting restore at 13-AUG-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=650 devtype=DISK

recovery area destination: /solfra/
database name (or database unique name) used for search: PROD
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /solfra/PROD/autobackup/2009_08_13/o1_mf_s_694801261_5890xyoj_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=+DATA/prod/controlfile/current.256.694815695
output filename=+REDO/prod/controlfile/current.256.694815697
Finished restore at 13-AUG-00
</pre>
<p>Note that if you restored the spfile from backup, you don&#8217;t need to specify the recovery area in the <code>restore controlfile from autobackup</code> command.  In this case, because I chose to create a pfile from the source instance, I needed to supply the recovery area location.  Note that this is the recovery area that holds the source backups, not the recovery area that your new instance will use once it is opened.</p>
<p>With the control files restored, we can mount the new instance:</p>
<pre class="brush: sql;">
RMAN&gt; alter database mount;

database mounted
released channel: ORA_DISK_1
</pre>
<p>The next step is to catalog the backup files and archivelogs from the remote FRA.</p>
<pre class="brush: sql;">
RMAN&gt; CATALOG START WITH '/solfra/PROD' NOPROMPT;

Starting implicit crosscheck backup at 13-AUG-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=646 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=650 devtype=DISK
Crosschecked 565 objects
Finished implicit crosscheck backup at 13-AUG-09

Starting implicit crosscheck copy at 13-AUG-09
using channel ORA_DISK_1
using channel ORA_DISK_2
Finished implicit crosscheck copy at 13-AUG-09

searching for all files in the recovery area
cataloging files...
</pre>
<p>This will continue listing all the files in the catalog, and some files that were not cataloged (e.g. online redo logs, non-RMAN files, etc.).</p>
<p>Now we&#8217;re ready to begin our RESTORE phase.  You&#8217;ll need an rman command file that looks something like this:</p>
<pre class="brush: sql;">
run {
  set newname for datafile X to new;
  # ... (repeat for other datafiles)
  set newname for tempfile Y to new;
  # ... (repeat for other tempfiles)
  restore database;
  switch datafile all;
  switch tempfile all;
}
recover database;
</pre>
<p>Note that X and Y are the file# of the individual datafile and tempfile, respectively.  You will probably want to generate this file if you have a large number of datafiles.</p>
<p>It is important that you read MetaLink Doc 415884.1, if you are performing a migration to a different platform with the same endian.  Oracle suggests that you should perform a CONVERT DATABASE, but later admits that you only need to perform a CONVERT on tablespaces containing UNDO segments:</p>
<blockquote><p>
The convert database command is a no operation command for all files that do not contain undo but they are scanned regardless during the conversion. Using the convert tablespace/datafile for those containing undo will suffice and all other source files not containing undo can be moved to the target (same endian) platform without the Recovery Manager conversion. This will greatly reduce the time required to move and database with thousands of files from source to target platform also decreasing the amount of time the database is unavailable.</p></blockquote>
<p>We had an internal debate over whether or not it is truly necessary even to do this.  However, I would advise you to read this document and discuss it with Oracle Support Services.  They would most likely try to convince you to do it or threaten to not support your database.</p>
<p>Once the script finishes with the <code>recover database</code> portion, this query should indicate that datafile headers and controlfiles are in sync:</p>
<pre class="brush: sql;">
SQL&gt; alter session set nls_date_format='YYYY/MON/DD hh24:mi:ss';

Session altered.

SQL&gt; select checkpoint_time,fuzzy,count(*),status
from ( select checkpoint_time,fuzzy,status
       from v$datafile_header
       union all
       select controlfile_time,'CTL',null from v$database)
group by checkpoint_time,fuzzy,status;

CHECKPOINT_TIME      FUZ   COUNT(*) STATUS
-------------------- --- ---------- -------
2009/AUG/14 02:22:11 CTL	  1
2009/AUG/14 02:22:11 YES       1266 ONLINE
</pre>
<p>The database is still in mount mode.  If we were ready to cut over now, we could open the database with the <code>RESETLOGS</code> option.  However, we are still a few hours or a day away from the cutover.  What we want to do is apply more logs from the current production instance as they get archived. To minimize the babysitting, we decided to run this in a script once every few hours:</p>
<pre class="brush: sql;">
CATALOG START WITH '/solfra/PROD' NOPROMPT;
RECOVER DATABASE;
</pre>
<p>As you can guess, this re-catalogs the NFS-mounted FRA, ignoring files that were already cataloged.  So now the controlfile knows about the new archivelogs.  The <code>RECOVER DATABASE</code> command then beautifully applies logs from where it left off until it runs out of logs again.  We re-run this periodically to keep our new instance as close to current as possible until it&#8217;s time to cut over.</p>
<p>When the cutover time comes, we run this on the current production instance:</p>
<pre class="brush: sql;">
SQL&gt; alter system archive log current;

System altered.

SQL&gt; shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
</pre>
<p>Then, on the new instance, we do one last catalog and recover.  This should bring us completely up to date with the original prod instance.  Now we just need to open with resetlogs:</p>
<pre class="brush: sql;">
SQL&gt; alter database open resetlogs;

Database altered.
</pre>
<p>In my case, I manually renamed the online and standby redo logs to <code>+REDO</code> (they still had the old filesystem names in v$logfile), but I believe that <code>OPEN RESETLOGS</code> does this automatically anyway.</p>
<p>And so, here we are in Linux on on the same version (10.2.0.2) as Solaris with appropriate one-off patches, using ASM.  At this point, I was just under 30 minutes into my downtime window since the original prod instance was shutdown.  I don&#8217;t think that&#8217;s too bad for moving a 1.3T database!</p>
<p>After this, I immediately went into upgrading to 11gR1 (11.1.0.7) and then building a new standby instance, but that is outside the scope of the initial migration that I wanted to share with you today.  Cheers!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/449/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=449&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/10/27/howto-oracle-cross-platform-migration-with-minimal-downtime/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>Moving Oracle Datafiles to a ZFS Filesystem with the Correct Recordsize</title>
		<link>http://seilerwerks.wordpress.com/2009/10/24/moving-oracle-datafiles-to-a-zfs-filesystem-with-the-correct-recordsize/</link>
		<comments>http://seilerwerks.wordpress.com/2009/10/24/moving-oracle-datafiles-to-a-zfs-filesystem-with-the-correct-recordsize/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 16:20:05 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=442</guid>
		<description><![CDATA[Originally posted on The Pythian Group blog.
Full credit for this tale should go to my colleague Christo Kutrovsky for the inspiration and basic plan involved.

We recently migrated a large database from Solaris SPARC to Solaris x86-64. All seemed to go well with the migration, but in the next few weeks, we noticed some I/O issues [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=442&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Originally posted on <a href="http://www.pythian.com/news/3627/moving-oracle-datafiles-to-a-zfs-filesystem-with-the-correct-recordsize">The Pythian Group blog</a>.</em></p>
<p><em>Full credit for this tale should go to my colleague <a href="http://www.pythian.com/news/author/kutrovsky">Christo Kutrovsky</a> for the inspiration and basic plan involved.<br />
</em></p>
<p>We recently migrated a large database from Solaris SPARC to Solaris x86-64. All seemed to go well with the migration, but in the next few weeks, we noticed some I/O issues cropping up. Some research led us to find that the ZFS filesystem used to hold the datafiles was killing us on I/O. The default “recordsize” setting for ZFS was 128k.</p>
<pre class="brush: bash;">
$ /usr/sbin/zfs get recordsize zfs-data
NAME      PROPERTY    VALUE     SOURCE
zfs-data  recordsize  128K      default
</pre>
<p>An Oracle database typically uses 8k for the block size, but in this case it was 16k. We saw basically the same thing that Neelakanth Nadgir described in his blog post, <a href="http://blogs.sun.com/realneel/entry/zfs_and_databases">Databases and ZFS</a>:</p>
<blockquote><p>With ZFS, not only was the throughput much lower, but we used more [than] twice the amount of CPU per transaction, and we are doing 2x times the IO. The disks are also more heavily utilized. We noticed that we were not only reading in more data, but we were also doing more IO operations [than] what is needed.</p></blockquote>
<p>The fix is to set the ZFS recordsize for a datafile filesystem to match the Oracle instance’s <code>db_block_size</code>.  We also read in <a href="http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide#ZFS_and_Database_Recommendations">the ZFS Best Practices Guide</a> that redo logs should be in a separate filesystem with the default ZFS recordsize of 128k. We already had them separate, so we just needed to get our datafiles on a ZFS filesystem with a 16k recordsize.<br />
<span id="more-442"></span><br />
The first step is to change the ZFS recordsize for the current filesystem. Easy enough, but the change in recordsize will only apply to new files written there. It doesn’t do anything for our existing terabyte-plus of datafiles. This means we need to move the files to a new ZFS filesystem with the correct recordsize already set. That’s where the magic happens.</p>
<p><span id="more-3627"> </span></p>
<p>My first thought was that we’d need whole other slab of disk. Then I learned that we can simply create a new ZFS filesystem on the same pool of disks as the old filesystem. Obviously we won’t be able to hold two complete copies of the datafiles, but this would let us migrate groups of files at a time (for example, a tablespace). When the move is complete, disk space is released from the old filesystem, so the sum of used disk is essentially unchanged.</p>
<p>The rest is just a matter of moving datafiles. Now, we all know you can’t just move or copy Oracle datafiles from a running instance. We also know that clients want as little downtime as possible, so doing a complete shutdown/move/mount/rename/open is out of the question. We could offline a tablespace, move its datafiles, rename them in the database, then online the tablespace again. Here’s a sample scenario, starting with tablespace and datafile creation:</p>
<pre class="brush: sql;">
SQL&gt; create tablespace zfstest
  2          datafile '/u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf'
  3          size 128m;

Tablespace created.

SQL&gt; alter tablespace zfstest
  2          add datafile '/u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf'
  3          size 128m;

Tablespace altered.

SQL&gt; create table zfsobjects tablespace zfstest
  2          as select * from dba_objects;

Table created.
</pre>
<p>Accept the following:</p>
<ul>
<li><code>/u01/app/oracle/oradata/orcl/zfs128k/</code> is a ZFS filesystem with default 128k recordsize</li>
<li><code>/u01/app/oracle/oradata/orcl/zfs16k/</code> is a ZFS filesystem with a 16k recordsize</li>
</ul>
<p>So here we have datafiles created on a ZFS filesystem with the default 128k recordsize, and a small table just to test data access. To move the entire tablespace in one go, we do this:</p>
<pre class="brush: sql;">
SQL&gt; alter tablespace zfstest offline;

Tablespace altered.

SQL&gt; !mv /u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf
     /u01/app/oracle/oradata/orcl/zfs16k/zfstest01.dbf

SQL&gt; alter database rename file '/u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf' to
'/u01/app/oracle/oradata/orcl/zfs16k/zfstest01.dbf';

Database altered.

SQL&gt; !mv /u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf
/u01/app/oracle/oradata/orcl/zfs16k/zfstest02.dbf

SQL&gt; alter database rename file '/u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf' to
'/u01/app/oracle/oradata/orcl/zfs16k/zfstest02.dbf';
Database altered.

SQL&gt; alter tablespace zfstest online;

Tablespace altered.

SQL&gt; select count(*) from zfsobjects;

  COUNT(*)
----------
     68844
</pre>
<p>Pretty simple.  We do the one escape to the OS <code>mv</code> command to move the datafile.  If you want to be safe, you could use <code>cp</code> instead of <code>mv</code> to copy the file.  Just know that disk space from the old filesystem won’t be released until you delete the old files.</p>
<p>Note that this operation could take a very long time in the case of large tablespaces. We could try a somwhat similar approach of taking one datafile offline at a time and moving it. We’d just need to perform a quick recovery before bringing it online. That would look like this:</p>
<pre class="brush: sql;">
SQL&gt; alter database datafile '/u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf' offline;

Database altered.

SQL&gt; !mv /u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf
/u01/app/oracle/oradata/orcl/zfs16k/zfstest01.dbf

SQL&gt; alter database rename file '/u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf' to
'/u01/app/oracle/oradata/orcl/zfs16k/zfstest01.dbf';

Database altered.

SQL&gt; recover datafile '/u01/app/oracle/oradata/orcl/zfs16k/zfstest01.dbf';
Media recovery complete.

SQL&gt; alter database datafile '/u01/app/oracle/oradata/orcl/zfs16k/zfstest01.dbf' online;

Database altered.

SQL&gt; alter database datafile
'/u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf' offline;

Database altered.

SQL&gt; !mv /u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf
/u01/app/oracle/oradata/orcl/zfs16k/zfstest02.dbf

SQL&gt; alter database rename file '/u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf'
to '/u01/app/oracle/oradata/orcl/zfs16k/zfstest02.dbf';

Database altered.

SQL&gt; recover datafile '/u01/app/oracle/oradata/orcl/zfs16k/zfstest02.dbf';
Media recovery complete.

SQL&gt; alter database datafile '/u01/app/oracle/oradata/orcl/zfs16k
/zfstest02.dbf' online;

Database altered.

SQL&gt; select count(*) from zfsobjects;

  COUNT(*)
----------
     68844
</pre>
<p>Seems fine. Note that your instance needs to be in ARCHIVELOG mode to be able to take datafiles offline. Obviously, if someone tried to access data on an offline datafile they’d get this error:</p>
<pre class="brush: sql;">
SQL&gt; select count(*) from zfsobjects;
select count(*) from zfsobjects
                     *
ERROR at line 1:
ORA-00376: file 6 cannot be read at this time
ORA-01110: data file 6: '/u01/app/oracle/oradata/orcl/zfs16k/zfstest01.dbf'
</pre>
<p>So if a datafile is particularly large, this can mean still a few minutes of some data being offline. We have one more tool at our disposal that provides for a quicker turnaround: RMAN’s <code>BACKUP AS COPY</code> command. As it says, this creates a copy of a datafile as a backup. The benefit is that it does this while the current datafile (and data) remains online. We then just need to offline, switch, recover, and online each datafile, which takes very little time compared to the time spent moving a large datafile. That process would be something like this.</p>
<p>First, we want to know the file numbers of our datafiles. This is because the RMAN procedure doesn’t provide for an easy way to preserve datafile names when we backup an entire tablespace (which we’re going to do):</p>
<pre class="brush: sql;">
SQL&gt; select file_id, file_name
  2  from dba_data_files
  3  where tablespace_name='ZFSTEST';

   FILE_ID FILE_NAME
---------- -------------------------------------------------------
	 6 /u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf
	 7 /u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf
</pre>
<p>So we have file numbers 6 and 7.  Now we create our RMAN command file and execute it:</p>
<pre class="brush: sql;">
RMAN&gt; backup as copy
2&gt; 	tablespace zfstest format '/u01/app/oracle/oradata/orcl/zfs16k/%U';
3&gt;
4&gt; sql 'alter database datafile 6 offline';
5&gt; switch datafile 6 to copy;
6&gt; recover datafile 6;
7&gt; sql 'alter database datafile 6 online';
8&gt;
9&gt; sql 'alter database datafile 7 offline';
10&gt; switch datafile 7 to copy;
11&gt; recover datafile 7;
12&gt; sql 'alter database datafile 7 online';
13&gt;
Starting backup at 18-AUG-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf
output file name=/u01/app/oracle/oradata/orcl/zfs16k/data_D-ORCL_I-1203425866_TS-ZFSTEST_FNO-6_01kn0irh tag=TAG20090818T140640 RECID=2 STAMP=695225208
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=/u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf
output file name=/u01/app/oracle/oradata/orcl/zfs16k/data_D-ORCL_I-1203425866_TS-ZFSTEST_FNO-7_02kn0is0 tag=TAG20090818T140640 RECID=3 STAMP=695225222
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 18-AUG-09

sql statement: alter database datafile 6 offline

datafile 6 switched to datafile copy
&quot;/u01/app/oracle/oradata/orcl/zfs16k/data_D-ORCL_I-1203425866_TS-ZFSTEST_FNO-6_01kn0irh&quot;

Starting recover at 18-AUG-09
using channel ORA_DISK_1

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

Finished recover at 18-AUG-09

sql statement: alter database datafile 6 online

sql statement: alter database datafile 7 offline

datafile 7 switched to datafile copy
&quot;/u01/app/oracle/oradata/orcl/zfs16k/data_D-ORCL_I-1203425866_TS-ZFSTEST_FNO-7_02kn0is0&quot;

Starting recover at 18-AUG-09
using channel ORA_DISK_1

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

Finished recover at 18-AUG-09

sql statement: alter database datafile 7 online

Recovery Manager complete.
</pre>
<p>Voila!  The tablespace is moved with minimal downtime:</p>
<pre class="brush: sql;">SQL&gt; select file_id, file_name
  2  from dba_data_files
  3  where tablespace_name='ZFSTEST';

   FILE_ID
----------
FILE_NAME
--------------------------------------------------------------------------------
	 6
/u01/app/oracle/oradata/orcl/zfs16k/data_D-ORCL_I-1203425866_TS-ZFSTEST_FNO-6_01kn0irh

	 7
/u01/app/oracle/oradata/orcl/zfs16k/data_D-ORCL_I-1203425866_TS-ZFSTEST_FNO-7_02kn0is0

SQL&gt; select count(*) from zfsobjects;

  COUNT(*)
----------
     68844
</pre>
<p>Obviously, you can generate all your statements from SQL scripts, and you’ll definitely want to do this if your tablespace has a large amount of datafiles. If you are scripting, you could opt to backup one datafile at a time if you need to preserve file names. In this case, I wasn’t too concerned.</p>
<p>UPDATE: Teammate Marc Billette pointed out that the old datafiles were not removed when doing a datafile copy and switch. I clearly left them on disk, continuing to use space! So, once we are done with all the datafile switches, then our original datafiles become the copies, and we can list and delete those in RMAN like this:</p>
<pre class="brush: sql;">
RMAN&gt; list datafilecopy all;

List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time
------- ---- - --------------- ---------- ---------------
4       6    A 18-AUG-09       629982     18-AUG-09
        Name: /u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf

5       7    A 18-AUG-09       630001     18-AUG-09
        Name: /u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf

RMAN&gt; delete datafilecopy all;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK
List of Datafile Copies
=======================

Key     File S Completion Time Ckp SCN    Ckp Time
------- ---- - --------------- ---------- ---------------
4       6    A 18-AUG-09       629982     18-AUG-09
        Name: /u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf

5       7    A 18-AUG-09       630001     18-AUG-09
        Name: /u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf

Do you really want to delete the above objects (enter YES or NO)? YES
deleted datafile copy
datafile copy file name=/u01/app/oracle/oradata/orcl/zfs128k/zfstest01.dbf RECID=4 STAMP=695225227
deleted datafile copy
datafile copy file name=/u01/app/oracle/oradata/orcl/zfs128k/zfstest02.dbf RECID=5 STAMP=695225228
Deleted 2 objects
</pre>
<p>Thanks to Marc for catching this early in the published life of the article!</p>
<p>I hope this post can help other people that run into this problem with Oracle on ZFS (I’ve heard from one on twitter already), or people just wanting to move datafiles. Again, thanks to Pythian DBA Christo Kutrovsky for laying this process out for us!</p>
<p><em>Note: this process was tested on Oracle 10gR2 (10.2.0.2) and 11gR1 (11.1.0.6).</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/442/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/442/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=442&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/10/24/moving-oracle-datafiles-to-a-zfs-filesystem-with-the-correct-recordsize/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting up Network ACLs in Oracle 11g… For Dummies</title>
		<link>http://seilerwerks.wordpress.com/2009/08/19/setting-up-network-acls-in-oracle-11g%e2%80%a6-for-dummies/</link>
		<comments>http://seilerwerks.wordpress.com/2009/08/19/setting-up-network-acls-in-oracle-11g%e2%80%a6-for-dummies/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:37:46 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=434</guid>
		<description><![CDATA[Originally posted on The Pythian Group blog.

Having recently performed a test upgrade for a client from Oracle RDBMS 10g to 11g, I can tell you that one of the big changes that will likely require action on your part as DBA is the new fine-grained access control for the packages UTL_SMTP, UTL_TCP, UTL_MAIL, UTL_HTTP and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=434&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Originally posted on <a href="http://www.pythian.com/news/3434/setting-up-network-acls-in-oracle-11g-for-dummies">The Pythian Group blog</a>.<br />
</em></p>
<p>Having recently performed a test upgrade for a client from Oracle RDBMS 10g to 11g, I can tell you that one of the big changes that will likely require action on your part as DBA is the new fine-grained access control for the packages <code>UTL_SMTP</code>, <code>UTL_TCP</code>, <code>UTL_MAIL</code>, <code>UTL_HTTP</code> and <code>UTL_INADDR</code>.  Part of the Oracle 11g pre-upgrade tool will <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/upgrade.htm#BABJHIHH">notify you of users that will require new privileges</a>.</p>
<p>Of course, Oracle’s <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28300/afterup.htm#BABFCBJI">post-upgrade network ACL setup documentation</a> is much more confusing than it needs to be, at least for simple minds like me. A colleague stepped forward with a simple set of commands for a basic setup that even the tired and stressed can understand.</p>
<p>I’ll share that here, with some basic explanation:</p>
<p><span id="more-3434"> </span></p>
<pre class="brush: sql;">
BEGIN
  -- Create the new ACL, naming it &quot;netacl.xml&quot;, with a description.
  -- Also, provide one starter privilege, granting user FOO
  -- the privilege to connect.
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('netacl.xml',
      'Allow usage to the UTL network packages', 'FOO', TRUE, 'connect');

  -- Now grant privilege to resolve DNS names for FOO,
  -- and then grant connect and resolve to user BAR
  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('netacl.xml' ,'FOO', TRUE, 'resolve');
  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('netacl.xml' ,'BAR', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('netacl.xml' ,'BAR', TRUE, 'resolve');

  -- Specify which hosts this ACL applies to,
  -- for simplicity, we're saying all (*)
  -- You might want to specify certain hosts to lock this down.
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('netacl.xml','*');
END;
/
</pre>
<p>As you can see, this example will let the <code>FOO</code> and <code>BAR</code> database users connect and resolve to any host.  The <code>ASSIGN_ACL</code> section in the full package documentation (see link below) details how this can be used to lock down a user’s ability to make outside connections.</p>
<p>Of course, nothing beats reading the <a href="http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_networkacl_adm.htm#insertedID0">Oracle 11g DBMS_NETWORK_ACL_ADMIN documentation</a>, where you can see some examples of stricter ACL setups.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/434/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/434/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=434&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/08/19/setting-up-network-acls-in-oracle-11g%e2%80%a6-for-dummies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>Turn Off db_cache_advice To Avoid Latch Contention Bugs</title>
		<link>http://seilerwerks.wordpress.com/2009/08/19/turn-off-db_cache_advice-to-avoid-latch-contention-bugs/</link>
		<comments>http://seilerwerks.wordpress.com/2009/08/19/turn-off-db_cache_advice-to-avoid-latch-contention-bugs/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:35:12 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=429</guid>
		<description><![CDATA[Originally posted on The Pythian Group blog.
A couple of weeks ago, we noticed some timeouts in some of our standard Oracle RDBMS health check scripts on a new instance. I had just migrated this instance to bigger, better, badder hardware and so it had been given more SGA to use, namely a bigger buffer cache. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=429&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Originally posted on <a href="http://www.pythian.com/news/2838/turn-off-db_cache_advice-to-avoid-latch-contention-bugs">The Pythian Group blog</a>.</em></p>
<p>A couple of weeks ago, we noticed some timeouts in some of our standard Oracle RDBMS health check scripts on a new instance. I had just migrated this instance to bigger, better, badder hardware and so it had been given more SGA to use, namely a bigger buffer cache. The software version was still Oracle 10.2.0.2, as we wanted to introduce as few variables as possible (we were already moving to a new platform with an <a href="http://en.wikipedia.org/wiki/Endianness">endian</a> change).</p>
<p>At first the timeouts were infrequent, but over the course of a week started to grow in frequencey until the point where none of the checks were finishing in the allowed timeframe. We ran an AWR report, and tucked far down in the “Latch Activity” section, a colleague noticed this:</p>
<pre>                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
...
<strong>simulator lru latch          10,032,617    3.3    0.7  44950      336,837    0.3</strong>
...
Latch Activity                             DB/Inst: FOO/foo  Snaps: 156-157
-&gt; "Get Requests", "Pct Get Miss" and "Avg Slps/Miss" are statistics for
   willing-to-wait latch get requests
-&gt; "NoWait Requests", "Pct NoWait Miss" are for no-wait latch get requests
-&gt; "Pct Misses" for both should be very close to 0.0

                                           Pct    Avg   Wait                 Pct
                                    Get    Get   Slps   Time       NoWait NoWait
Latch Name                     Requests   Miss  /Miss    (s)     Requests   Miss
------------------------ -------------- ------ ------ ------ ------------ ------
transaction branch alloc        112,412    0.0    0.0      0            0    N/A
undo global data                466,321    0.0    0.0      0            0    N/A
user lock                         7,440    0.8    0.4      1            0    N/A
          -------------------------------------------------------------</pre>
<p>The “simulator lru latch” event brought us to MetaLink note 5918642.8 and bug 5918642. Affecting 10g and 11g prior to 10.2.0.4 and 11.1.0.7, respectively. The bug is with the database buffer cache advisor, controlled by the parameter <a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams042.htm#sthref126">db_cache_advice</a>, which defaults to ON (depending on statistics_level).  The note simply states:</p>
<blockquote><p>High simulator lru latch contention can occur when db_cache_advice is set to ON if there is a large buffer cache.</p></blockquote>
<p>We simply set db_cache_advice to OFF (thankfully it is a dynamic parameter), and pretty quickly our checks were running just fine.</p>
<p>My suggestion is to simply turn this off unless you are actively using the cache advisor to tune an instance. Once you are done tuning, and are no longer using the advisor, turn it off.</p>
<p>NOTE:  As Mladen Gogola pointed out in the comments, turning this off will cause problems if you are using automatic memory management (i.e. sga_target &gt; 0).   Re-pasting his post here:</p>
<blockquote><p>The problem with that advice is that it will prevent automatic memory management from resizing the buffer cache and the instance will end up with a huge, mostly empty, shared pool and default buffer cache. Automatic memory management is biased toward shared pool even with the cache dvice turned on, without it, buffer cache will be reduced to the minimum size, usually only 64MB. If you disable cache advice, I would also recommend disabling the automatic memory management and configuring SGA manually.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/429/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=429&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/08/19/turn-off-db_cache_advice-to-avoid-latch-contention-bugs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>Sending Timezone-Aware Email with UTL_SMTP</title>
		<link>http://seilerwerks.wordpress.com/2009/08/19/sending-timezone-aware-email-with-utl_smtp/</link>
		<comments>http://seilerwerks.wordpress.com/2009/08/19/sending-timezone-aware-email-with-utl_smtp/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:32:43 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=420</guid>
		<description><![CDATA[Originally posted at The Pythian Group blog.
I’m back again with another in what I hope will be a long line of “Quick Tips for Newbies” series.
At The Pythian Group, we have employees all over the globe, from our headquarters in Ottawa to regional offices in Boston, Prague, India and Sydney, and a few scattered remote [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=420&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Originally posted at <a href="http://www.pythian.com/news/1976/sending-timezone-aware-email-with-utl_smtp">The Pythian Group blog</a>.</em></p>
<p>I’m back again with another in what I hope will be a long line of “Quick Tips for Newbies” series.</p>
<p>At The Pythian Group, we have employees all over the globe, from our headquarters in Ottawa to regional offices in Boston, Prague, India and Sydney, and a few scattered remote workers in Seattle, Paris, Kiev, Brazil, South Africa and Wisconsin, among other places. In other words, we are spread across multiple timezones, and since it wasn’t too long ago that everyone was in Ottawa, this is something that still presents little quirks.</p>
<p>One such quirk involved email generated by one of our internal Oracle instances—via a stored procedure that used <code>UTL_SMTP</code> to send the messages—did not have timezone information in the “Date” email header. As a result, they would be stamped with the hour in Eastern timezone (Ottawa time), but the mail clients would think that hour was local. Depending on where you are relative to Ottawa, this could be many hours in the past or future. Of course, this wouldn’t be noticed if you were in Ottawa or even Boston, both in Eastern. For the rest, it was at the very least, an annoyance—but one that is easily fixed.</p>
<p><span id="more-1976"> </span></p>
<p>Looking at the PL/SQL stored procedure that we used to generate email messages, I saw that the “Date” header was being built with this code:</p>
<pre class="brush: sql;">date_hdr := 'Date: '||to_char(sysdate,'dd Mon yy hh24:mi:ss');</pre>
<p>The fix is almost trivial—just use <code>SYSTIMESTAMP</code> instead of <code>SYSDATE</code>, and include the timezone in the <code>TO_CHAR</code> function:</p>
<pre class="brush: sql;">date_hdr := 'Date: '||to_char(systimestamp,'dd Mon yy hh24:mi:ss tzhtzm');</pre>
<p>Voila!  Emails now had a full Date header. And there was much rejoicing from around the world.</p>
<p>Here’s a quick query to highlight the difference:</p>
<pre class="brush: sql;">
SQL&gt; select to_char(sysdate,'dd Mon yy hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'D
------------------
01 Dec 08 18:50:02

SQL&gt; select to_char(systimestamp,'dd Mon yy hh24:mi:ss tzhtzm') from dual;

TO_CHAR(SYSTIMESTAMP,'DD
------------------------
01 Dec 08 18:50:10 -0500
</pre>
<p>Even if you aren’t sending email to all the ends of the Earth, it won’t hurt to make your messages timezone-aware. I’m sure it will save some confusion and frustration down the line.</p>
<p><em>Note: I discovered the fix via <a href="http://hidowb.blogspot.com/2008/04/time-zone-and-header-in-emails-using.html">this blog post</a>, which seems to be invite-only at the time of this writing.</em></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/420/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=420&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/08/19/sending-timezone-aware-email-with-utl_smtp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>ORA-16069? You May Need A New Standby Controlfile</title>
		<link>http://seilerwerks.wordpress.com/2009/08/19/ora-16069-you-may-need-a-new-standby-controlfile/</link>
		<comments>http://seilerwerks.wordpress.com/2009/08/19/ora-16069-you-may-need-a-new-standby-controlfile/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:20:34 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=414</guid>
		<description><![CDATA[Originally posted on The Pythian Group blog.
On a recent Monday, I had to perform an emergency Oracle standby switchover for a client whose primary instance host had mysteriously rebooted itself over the previous day. Confidence in that host was, understandably, shaken.
The Oracle Data Guard configuration is a 3-instance setup using Data Guard Broker: one primary, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=414&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Originally posted on <a href="http://www.pythian.com/news/1902/ora-16069-new-standby-controlfile">The Pythian Group blog</a>.</em></p>
<p>On a recent Monday, I had to perform an emergency Oracle standby switchover for a client whose primary instance host had mysteriously rebooted itself over the previous day. Confidence in that host was, understandably, shaken.</p>
<p>The Oracle Data Guard configuration is a 3-instance setup using Data Guard Broker: one primary, we’ll call it OraA, feeding two standby instances, OraB and OraC. In this particular configuration, we perform switchovers between OraA and OraC. Caught in the middle is OraB, which is on a 60-minute standby delay.</p>
<p>After this particular switchover, OraB started complaining with this message in the alert log:</p>
<p><span id="more-1902"> </span></p>
<pre>ORA-16069: Archive Log standby database activation identifier mismatch</pre>
<p>We had seen this occasionally in prior switchovers, and the problem would fix itself once the standby delay passed and the OraB standby would process the log notifying it of the switchover. This time, however, recovery was stopped and more than enough time had elapsed. OraA and OraC were performing perfectly fine.</p>
<p>Much of the reference searching I saw suggested that the standby instance would have to be completely rebuilt. Not an appetizing option. A search of metalink turned up Bug 4048687, which seemed to demonstrate a similar problem, although on a different OS/Platform. That solution was to recreate the standby controlfile. Trust me, it sounds more drastic than it is!</p>
<p>Here’s how to do it in just 6 easy steps!</p>
<ol>
<li>Shutdown the misbehaving standby.</li>
<li>Copy one of the current standby controlfiles for safekeeping (just in case).</li>
<li>On the primary instance, create a new standby controlfile: <code>alter database create standby controlfile as '/tmp/stdby.ctl';</code></li>
<li>Transfer that new standby controlfile to the standby host.</li>
<li>Copy the new controlfile to the controlfile location(s) used by the instance (you have more than one, right?).</li>
<li>STARTUP MOUNT the standby instance. If you use the Data Guard Broker, it should automatically begin recovery for you; otherwise restart managed recovery with <code>alter database recover managed standby database disconnect;</code></li>
</ol>
<p>Voila.  Standby recovery should resume nicely, assuming logs are there to apply.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/414/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=414&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/08/19/ora-16069-you-may-need-a-new-standby-controlfile/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>RMAN Redundancy is not a Viable Retention Policy</title>
		<link>http://seilerwerks.wordpress.com/2009/08/19/rman-redundancy-is-not-a-viable-retention-policy/</link>
		<comments>http://seilerwerks.wordpress.com/2009/08/19/rman-redundancy-is-not-a-viable-retention-policy/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:17:34 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=406</guid>
		<description><![CDATA[Originally posted on The Pythian Group blog.
The story you are about to read is based on actual events. Names and paths have been changed to protect the innocent. I call this scenario “The Perfect Storm” because it took just the right combination of events and configurations. Sadly, this doesn’t make it an unlikely occurrence, so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=406&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Originally posted on <a href="http://www.pythian.com/news/1509/rman-redundancy-is-not-a-viable-retention-policy">The Pythian Group blog</a>.</em></p>
<p>The story you are about to read is based on actual events. Names and paths have been changed to protect the innocent. I call this scenario “The Perfect Storm” because it took just the right combination of events and configurations. Sadly, this doesn’t make it an unlikely occurrence, so I’m posting it here in hopes that you’ll be able to save yourselves before it’s too late.</p>
<p>I have always had a preternatural dislike for using REDUNDANCY as a retention policy for Oracle RMAN, greatly preferring RECOVERY WINDOW instead, simply because REDUNDANCY doesn’t really guarantee anything valuable to me, whereas RECOVERY WINDOW guarantees that I’ll be able to do a point-in-time recovery to anytime within the past x days. Plus, I had already been burned once by a different client using REDUNDANCY. With the story I’m about to tell, this dislike has turned into violent hatred. I’m going to be light on the technical details, but I hope you’ll still feel the full pain.</p>
<p><span id="more-1509"> </span></p>
<p>First some table setting:</p>
<ul>
<li>Standalone 10.2.0.2 instance (no RAC, no DataGuard/Standby)</li>
<li>RMAN retention policy set to REDUNDANCY 2</li>
<li>Backups stored in the Flash Recovery Area (FRA)</li>
</ul>
<p>A few months ago, we had a datafile corruption on this relatively new instance (data had been migrated from an old server about a week prior). The on-call DBA followed up the page by checking for corruptions in the datafile with this command:</p>
<pre>RMAN&gt; backup check logical datafile '/path/to/foobar_data.dbf';</pre>
<p>This, my friends, led to the major fall, though we did not know it for many hours. You see, the FRA was already almost full. This causes the FRA to <em>automatically delete obsolete files</em> to free up space. That last backup command, while only intended to check for logical corruption, did actually perform a backup of the file, and rendered the earliest backup of the file obsolete since there were two newer copies. That earliest file happened to be from the level 0 backup from which we would later want to restore.</p>
<p>Of course, at first we didn’t know why the file was missing. Logs showed that it was on disk no less than two hours before the problem started. Later, scanning the alert log for the missing backup filename yielded this:</p>
<pre>Deleted Oracle managed file
/path/to/flash_recovery_area/FOO_DB/backupset/2008_12_01/o1_xxxx.bkp</pre>
<p>Oracle deleted the one backup file that we needed!</p>
<p>Even worse, it wasn’t until this time on a Monday night that we realized that the level 0 taken the previous weekend had failed to push the backup files to tape because of a failure on the NetBackup server. The problem was reported as part of Monday morning’s routine log checks, but the missing files had not yet been pushed to tape.</p>
<p>In the end, we were able to drop and restore the tablespace to a previous point in time on a test instance from another backup file and exp/imp data back over. It was ugly, but it got things back online. Many DBAs better than myself gave their all on this mission.</p>
<p>To summarize, the ingredients:</p>
<ol>
<li>Oracle RMAN</li>
<li>CONFIGURE RETENTION POLICY TO REDUNDANCY 2;</li>
<li>Flash Recovery Area near full, obediently deleting obsolete files.</li>
<li>Tape backup failure</li>
</ol>
<p>Add in an innocent backup command and . . . BOOM!  Failure Surprise.</p>
<p>The two biggest points to take away are:</p>
<ol>
<li>Tape backup failures are still serious backup failures and should be treated as such, even if you backup to disk first.</li>
<li>REDUNDANCY is not a viable retention policy.   In my house, it is <em>configuration non grata</em>.</li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/406/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/406/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/406/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=406&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2009/08/19/rman-redundancy-is-not-a-viable-retention-policy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>GNU basename in PL/SQL</title>
		<link>http://seilerwerks.wordpress.com/2008/10/01/gnu-basename-in-plsql/</link>
		<comments>http://seilerwerks.wordpress.com/2008/10/01/gnu-basename-in-plsql/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 04:20:24 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[basename]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[pl/sql]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=393</guid>
		<description><![CDATA[Reposted from The Pythian Group blog.
In the process of scripting a database migration, I was in need of something akin to the GNU basename utility that I know and love on Linux.  basename is most famous for taking a full file path string and stripping away the leading path component, returning just the name [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=393&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Reposted from <a href="http://www.pythian.com/blogs/1229/gnu-basename-in-plsql">The Pythian Group blog</a>.</em></p>
<p>In the process of scripting a database migration, I was in need of something akin to the <a href="http://www.opengroup.org/onlinepubs/007908799/xcu/basename.html">GNU basename</a> utility that I know and love on Linux.  <code>basename</code> is most famous for taking a full file path string and stripping away the leading path component, returning just the name of the file. This can be emulated in PL/SQL with calls to <code>SUBSTR</code> and <code>INSTR</code>, like this:</p>
<pre class="brush: sql;">
substr(dirname,instr(dirname,'/',-1)+1)
</pre>
<p>(Thanks to Ian Cary, who shared this logic on <a href="http://www.freelists.org/archives/oracle-l/08-2005/msg01654.html">oracle-l</a>)</p>
<p>As you can see, this simply finds the last occurence of <code>/</code>, which is our directory separator on *nix and Solaris operating systems.  On Windows, it would be <code>\</code>. It then returns a substring beginning one character after that last separator until the end of the string. Voila, a basic basename routine!</p>
<p>Upon reading the <a href="http://www.opengroup.org/onlinepubs/007908799/xcu/basename.html">basename man page</a> again, I found that basename also takes an optional parameter, a suffix string. If this suffix string is provided, basename will also truncate that string from the end. For example:</p>
<pre class="brush: xml;">
$ basename /home/seiler/bookmarks.html
bookmarks.html
$ basename /home/seiler/bookmarks.html .html
bookmarks
</pre>
<p>I decided that this would be handy to have, and set out to create a compatible basename function in PL/SQL. Here is what I came up with:</p>
<pre class="brush: sql;">

CREATE OR REPLACE FUNCTION basename (v_full_path IN VARCHAR2,
                                        v_suffix IN VARCHAR2 DEFAULT NULL,
                                        v_separator IN CHAR DEFAULT '/')
        RETURN VARCHAR2
        IS
                v_basename VARCHAR2(256);
        BEGIN
                v_basename := SUBSTR(v_full_path, INSTR(v_full_path,v_separator,-1)+1);
                IF v_suffix IS NOT NULL THEN
                        v_basename := SUBSTR(v_basename, 1, INSTR(v_basename, v_suffix, -1)-1);
                END IF;

                RETURN v_basename;
        END;
/
</pre>
<p>I’ve also added an optional third parameter to specify a directory separator other than the default. It would probably be rarely useful, but not hard to remove if you don’t like it. As you can see, I’ve used similar SUBSTR/INSTR logic to identify the suffix index and prune it out.</p>
<p>Here it is in action:</p>
<pre class="brush: sql;">
SQL&gt; COLUMN file_name FORMAT a45;
SQL&gt; COLUMN basename FORMAT a15;
SQL&gt; COLUMN no_suffix FORMAT a12;
SQL&gt; SELECT file_name
  2          , basename(file_name) as basename
  3          , basename(file_name, '.dbf') as no_suffix
  4  FROM dba_data_files;

FILE_NAME                                     BASENAME        NO_SUFFIX
--------------------------------------------- --------------- ------------
/u01/app/oracle/oradata/orcl/users01.dbf      users01.dbf     users01
/u01/app/oracle/oradata/orcl/sysaux01.dbf     sysaux01.dbf    sysaux01
/u01/app/oracle/oradata/orcl/undotbs01.dbf    undotbs01.dbf   undotbs01
/u01/app/oracle/oradata/orcl/system01.dbf     system01.dbf    system01
/u01/app/oracle/oradata/orcl/example01.dbf    example01.dbf   example01
</pre>
<p>I hope this makes your work just a little bit easier, as it has mine.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/393/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=393&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2008/10/01/gnu-basename-in-plsql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
		<item>
		<title>Does Oracle’s Block Change Tracking File Shrink?</title>
		<link>http://seilerwerks.wordpress.com/2008/10/01/does-oracle%e2%80%99s-block-change-tracking-file-shrink/</link>
		<comments>http://seilerwerks.wordpress.com/2008/10/01/does-oracle%e2%80%99s-block-change-tracking-file-shrink/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 04:10:34 +0000</pubDate>
		<dc:creator>Don Seiler</dc:creator>
				<category><![CDATA[oracle]]></category>
		<category><![CDATA[block change tracking]]></category>

		<guid isPermaLink="false">http://seilerwerks.wordpress.com/?p=391</guid>
		<description><![CDATA[Reposted from The Pythian Group blog.
Just a quick post to get myself back into blogging mode.  Recently in IRC (#oracle on freenode, to be precise), a fresh face asked if the Block Change Tracking file ever shrinks.  She had been worrying about the file in her instance continuing to grow.  A number [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=391&subd=seilerwerks&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><em>Reposted from <a href="http://www.pythian.com/blogs/1163/does-oracle-block-change-tracking-file-shrink">The Pythian Group blog</a>.</em></p>
<p>Just a quick post to get myself back into blogging mode.  Recently in IRC (<a href="irc://irc.freenode.net/#oracle">#oracle on freenode</a>, to be precise), a fresh face asked if the <a href="http://www.oracle.com/technology/oramag/oracle/04-nov/o64rman.html">Block Change Tracking file</a> ever shrinks.  She had been worrying about the file in her instance continuing to grow.  A number of us speculated (non-<a href="http://www.battleagainstanyguess.com/">BAAG</a>!) that perhaps taking an RMAN backup would somehow purge the file of what it was keeping track of, and then the magical Oracle fairies would promptly resize it for us. Needless to say, I was hesitant to take this theory forward with <a href="http://www.pythian.com/blogs/483/block-change-tracking-internals-x-tables-research-xkrc-snappack">Alex Gorbachev</a> aware of my home address.</p>
<p>After setting up Oracle 10.2.0.1 on a nice <a href="http://www.virtualbox.org/">VirtualBox</a> image<br />
(more on that in another post) running <a href="http://centos.org/">CentOS</a> 5, I began to do some reading.  For some reason, actually reading <a href="http://tahiti.oracle.com/">the official tahiti docs</a> was last on my list.  A search of the 10gR2 docs quickly yielded <a href="http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/bkup004.htm#sthref424">this (from <em>RMAN Incremental Backups</em>)</a>:</p>
<blockquote><p><strong>4.4.4.4 Estimating Size of the Change Tracking File on Disk<br />
</strong></p>
<p>The size of the change tracking file is proportional to the size of the database and the number of enabled threads of redo. The size is not related to the frequency of updates to the database. Typically, the space required for block change tracking is approximately 1/30,000 the size of the data blocks to be tracked. Note, however, the following two factors that may cause the file to be larger than this estimate suggests:</p>
<ul>
<li>To avoid overhead of allocating space as your database grows, the change tracking file size starts at 10MB, and new space is allocated in 10MB incremenents [<em>sic</em>]. Thus, for any database up to approximately 300GB the file size is no smaller than 10MB, for up to approximately 600GB the file size is no smaller than 20MB, and so on.</li>
<li>For each datafile, a minimum of 320K of space is allocated in the change tracking file, regardless of the size of the file. Thus, if you have a large number of relatively small datafiles, the change tracking file is larger than for databases with a smaller number of larger datafiles containing the same data.</li>
</ul>
</blockquote>
<p>So (if the docs are to be trusted), it would seem that whether or not a backup is taken has no effect on the size of the file, or at least wouldn’t cause it to be shrunk. The size is tied to the amount of data in the database itself, not necessarily the changes in the database waiting to be included in the next incremental RMAN backup.</p>
<p>The documentation does suggest, however, that file size might be affected if (for example) a tablespace and its datafiles were dropped from the database. I’ll save this test for another day!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/seilerwerks.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/seilerwerks.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/seilerwerks.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/seilerwerks.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/seilerwerks.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/seilerwerks.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/seilerwerks.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/seilerwerks.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/seilerwerks.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/seilerwerks.wordpress.com/391/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=seilerwerks.wordpress.com&blog=2020677&post=391&subd=seilerwerks&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://seilerwerks.wordpress.com/2008/10/01/does-oracle%e2%80%99s-block-change-tracking-file-shrink/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a26f7f3e30943f45acff81cd87feba6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Don</media:title>
		</media:content>
	</item>
	</channel>
</rss>