<?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>Andrew Kerber's Oracle DBA Weblog &#187; Uncategorized</title>
	<atom:link href="http://dbakerber.wordpress.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://dbakerber.wordpress.com</link>
	<description>The World of the Oracle DBA</description>
	<lastBuildDate>Fri, 03 Jul 2009 15:36:36 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='dbakerber.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/d17e601b1433df521bff529f99570b8a?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Andrew Kerber's Oracle DBA Weblog &#187; Uncategorized</title>
		<link>http://dbakerber.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dbakerber.wordpress.com/osd.xml" title="Andrew Kerber&#8217;s Oracle DBA Weblog" />
		<item>
		<title>Swap Space in Linux and Unix</title>
		<link>http://dbakerber.wordpress.com/2008/04/18/swap-space-in-linux-and-unix/</link>
		<comments>http://dbakerber.wordpress.com/2008/04/18/swap-space-in-linux-and-unix/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 00:24:21 +0000</pubDate>
		<dc:creator>dbakerber</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbakerber.wordpress.com/?p=10</guid>
		<description><![CDATA[For those of us who review the Oracle installation documentation, we know that Oracle suggests that you configure a substantial amount of swap space. If you have between 1 and 2G RAM, you need to configure 1.5x RAM for swap space. For 2 to 8G RAM, swap space has to equal RAM. For RAM more [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=10&subd=dbakerber&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal"><span style="font-size:12pt;line-height:115%;">For those of us who review the Oracle installation documentation, we know that Oracle suggests that you configure a substantial amount of swap space.<span> </span>If you have between 1 and 2G RAM, you need to configure 1.5x RAM<span> </span>for swap space.<span> </span>For 2 to 8G RAM, swap space has to equal RAM.<span> </span>For RAM more than 8G, swap needs to be ¾ RAM.</span></p>
<p class="MsoNormal"><span style="font-size:12pt;line-height:115%;">No doubt your system administrator (in Unix) will tell you that that is more swap than you need.<span> </span>He may tell you that you only need one or two gig of swap when you have plenty of memory.</span></p>
<p class="MsoNormal"><span style="font-size:12pt;line-height:115%;">I can tell you from personal experience, that your system administrator is wrong if he tells you that.<span> </span>I have been there, and done that as the saying goes.<span> </span>Make sure you configure the full amount of swap recommended by Oracle, more if possible.<span> </span>Here’s why: </span></p>
<p class="MsoNormal"><span style="font-size:12pt;line-height:115%;">In a Unix operating system, there are two methods of allocating swap, eager swap and lazy swap.<span> </span>Under lazy swap, swap space is allocated only when needed, that is when an active process needs additional memory and all real memory is used up.<span> </span>If there is insufficient swap space available, the Operating system will create more swap space by killing idle processes.<span> </span>Obviously this is a dangerous and undesirable situation.</span><span style="font-size:12pt;"> A process using eager swap will allocate swap as it allocates real memory. If your oracle database has 6G RAM allocated in the SGA, it will allocate both 6G RAM and 6G swap.<span> </span>If there is insufficient swap space, it won’t kill other processes to make space.<span> </span>It will lock up the program attempting to allocate space, and eventually any other processes on the system that need swap space will also hang.<span> </span>In Solaris, I have seen such errors as ‘unable to fork a process’ or Solaris error 12, not enough space.<span> </span>In oracle, you will get messages like this: TNS-12500, TNS-12540, TNS-12560, TNS-00510. <span> </span>Usually your server will lock up shortly after the ‘not enough space’ or ‘unable to fork a process’ message.</span> <span style="font-size:12pt;"> </span></p>
<p class="MsoNormal"><span style="font-size:12pt;line-height:115%;">The example above actually happened.<span> </span>It was my fault.<span> </span>I had given the Unix system administrator the system requirements, including the amount of swap required.<span> </span>However, I had not followed up to make sure the settings were actually in effect.<span> </span>As it turns out, the Unix administrator had only allocated about 1/3 of the system RAM for swap, relying on his knowledge and understanding of swap.<span> </span>This was my fault because as an Oracle DBA, it was my job to verify everything before you hand the installation over to the users.<span> </span>That includes the system level settings.<span> </span>If you can’t see the settings (but as a DBA you should be able to see the settings), you have to rely on your system administrators word.<span> </span>But I could see the settings, I just didn’t follow up and verify them.</span><span style="font-size:12pt;"></span></p>
<p class="MsoNormal"><span style="font-size:12pt;">Some Oracle DBA’s I have talked to have allocated twice as much swap space as system RAM, following the older Oracle guidelines.<span> </span>After doing some researched I have discovered that Unix can be configured used to hold an image of the operating system processes for diagnostic purposes in the event of a system crash.<span> </span>Thus, my recommendation is that the minimum swap space should be equal to the available RAM, and configuring twice the amount of RAM is the maximum amount that should be needed.<span> </span>Despite what the official Oracle documentation says.</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbakerber.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbakerber.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbakerber.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbakerber.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbakerber.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbakerber.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbakerber.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbakerber.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbakerber.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbakerber.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbakerber.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbakerber.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=10&subd=dbakerber&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dbakerber.wordpress.com/2008/04/18/swap-space-in-linux-and-unix/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1086aff871513b5e8ac592325bdbd885?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dbakerber</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating an Oracle listener on a Non-Standard port</title>
		<link>http://dbakerber.wordpress.com/2008/02/11/creating-an-oracle-listener-on-a-non-standard-port/</link>
		<comments>http://dbakerber.wordpress.com/2008/02/11/creating-an-oracle-listener-on-a-non-standard-port/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 01:10:10 +0000</pubDate>
		<dc:creator>dbakerber</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbakerber.wordpress.com/?p=9</guid>
		<description><![CDATA[With the onset of Sarbanes-Oxley, one of the new requirements that DBA’s have to meet is to create instance specific Oracle listeners that are not on the default listener port of 1521.  This is really a fairly straightforward process, but one that a DBA may not be familiar with if his site standard is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=9&subd=dbakerber&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal"><span style="font-family:'Arial','sans-serif';">With the onset of Sarbanes-Oxley, one of the new requirements that DBA’s have to meet is to create instance specific Oracle listeners that are not on the default listener port of 1521.<span>  </span>This is really a fairly straightforward process, but one that a DBA may not be familiar with if his site standard is to always use the default.</span></p>
<p class="MsoNormal"><span style="font-family:'Arial','sans-serif';">Most DBA’s create the new listener with the word listener in the name, and an identifying string either preceding or following the word listener.<span>  </span>For example, LISTENER_KRB11G or KRB11G_LISTENER.<span>  </span>The entry for creating the listener would look like this:</span></p>
<p><code>LISTENER_KRB11G =<br />
(DESCRIPTION_LIST =<br />
(DESCRIPTION =<br />
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))<br />
(ADDRESS = (PROTOCOL = TCP)(HOST = krbrhel)(PORT = 1522))<br />
)<br />
)<br />
SID_LIST_LISTENER_KRB11G=<br />
( SID_LIST =<br />
( SID_DESC =<br />
( GLOBAL_DBNAME = krb11g )<br />
( ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1 )<br />
( SID_NAME = krb11g )<br />
)<br />
)</code></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Courier New';"> </span></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Arial','sans-serif';">The command to start the listener is (remember, on Unix the listener name is case sensitive):</span></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Arial','sans-serif';"> </span></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><i><span style="font-family:'Arial','sans-serif';">lsnrctl start LISTENER_KRB11G</span></i></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><i><span style="font-family:'Arial','sans-serif';"> </span></i></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Arial','sans-serif';">To check the status:</span></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Arial','sans-serif';"> </span></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><i><span style="font-family:'Arial','sans-serif';">lsnrctl status LISTENER_KRB11G</span></i></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><i><span style="font-family:'Arial','sans-serif';"> </span></i></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Arial','sans-serif';">To set the listener password (also part of Sarbanes-Oxley), see this excellent post on the subject:</span></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Arial','sans-serif';"> </span></p>
<p class="MsoNormalCxSpMiddle" style="line-height:normal;"><span style="font-family:'Arial','sans-serif';">http://www.dba-oracle.com/t_listener_password_security_lsnrctl.htm</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbakerber.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbakerber.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbakerber.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbakerber.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbakerber.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbakerber.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbakerber.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbakerber.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbakerber.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbakerber.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbakerber.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbakerber.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=9&subd=dbakerber&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dbakerber.wordpress.com/2008/02/11/creating-an-oracle-listener-on-a-non-standard-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1086aff871513b5e8ac592325bdbd885?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dbakerber</media:title>
		</media:content>
	</item>
		<item>
		<title>Questions to ask the DBA Candidate.</title>
		<link>http://dbakerber.wordpress.com/2008/01/16/questions-to-ask-the-dba-candidate/</link>
		<comments>http://dbakerber.wordpress.com/2008/01/16/questions-to-ask-the-dba-candidate/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 05:27:42 +0000</pubDate>
		<dc:creator>dbakerber</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbakerber.wordpress.com/2008/01/16/questions-to-ask-the-dba-candidate/</guid>
		<description><![CDATA[Below are some questions you might want to ask a potential DBA you are considering hiring.  Rampant Press has a very good book with technical questions on this subject,
http://www.rampant-books.com/book_2008_1_oracle_job_interview.htm
but these aren&#8217;t nearly so technical.  These questions are designed to find out how the DBA thinks, and how well he will fit in with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=8&subd=dbakerber&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Below are some questions you might want to ask a potential DBA you are considering hiring.  Rampant Press has a very good book with technical questions on this subject,</p>
<p><a href="http://www.rampant-books.com/book_2008_1_oracle_job_interview.htm">http://www.rampant-books.com/book_2008_1_oracle_job_interview.htm</a></p>
<p>but these aren&#8217;t nearly so technical.  These questions are designed to find out how the DBA thinks, and how well he will fit in with the others in your organization.  There are no 100% correct answers to this, but there incorrect answers.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">1.  Describe your work experience.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">2.  Describe your activities during a typical day in your current job?</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">3.  What do you do when priorities change quickly? Please give an example.</p>
<p class="western" style="margin-bottom:0;">If she answers &#8216;finish my current task&#8217; before looking at the requirements of the new one, she has given a wrong answer.</p>
<p class="western" style="margin-bottom:0;"> 4.  It is 2:22 am Monday.  A database has crashed and you are the on call DBA what steps will you follow to bring the database back on line?<br />
An incorrect answer would be turn over and go back to sleep.  Correct answers might be log onto the server box and read the alert log.  Check for activity on the server, etc.</p>
<p class="western" style="margin-bottom:0;">5.  What is the biggest error in judgement you have made in your current job?  Why did you make it?  How did you correct it?  What did you learn from it?</p>
<p class="western" style="margin-bottom:0;">If he says he has never made a big error in judgment, he is lying.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">6.  When given a special project to work on (patch all the dbs with a critical patch for example), how do you approach the project.</p>
<p class="western" style="margin-bottom:0;">A reverse planning method would be appropriate.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">7. As an on-call DBA what are the most common issues you have had?</p>
<p class="western" style="margin-bottom:0;">A full archive log destination is pretty common.  Failed backup scripts also.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">8.  Describe a time when you came up with a creative solution to a database performance problem.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">9.  A developer comes to you with a complex query that does not perform well.  What steps do you take to help her optimize this query.</p>
<p class="western" style="margin-bottom:0;">Get an explain plan, look at the indexes and use of wildcards.  There are a lot of good answers for this.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">10.  An application in production that has always performed well in the past has suddenly started timing out.  During your research, you discover that a query that has performed well in the past has suddenly started running slowly.  What steps do you take to resolve this problem?</p>
<p class="western" style="margin-bottom:0;">See if the explain plan has changed.  See if stats are good on the table.  Check for invalid indexes.</p>
<p class="western" style="margin-bottom:0;">&nbsp;</p>
<p class="western" style="margin-bottom:0;">11.  You are observing the database, and discover that there are several ad-hoc queries being run through sql-navigator in the production database.  There is no rule against this, but you suspect that the number and size of the queries is slowing down the response time in production.  What do you do?</p>
<p class="western" style="margin-bottom:0;">This is really a trick question.  The answer you are looking for is talk to the people who are running the queries, or their supervisors, explain the problem, and see if they can reduce or eliminate the activity.  Diplomatically.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbakerber.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbakerber.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbakerber.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbakerber.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbakerber.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbakerber.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbakerber.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbakerber.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbakerber.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbakerber.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbakerber.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbakerber.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=8&subd=dbakerber&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dbakerber.wordpress.com/2008/01/16/questions-to-ask-the-dba-candidate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1086aff871513b5e8ac592325bdbd885?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dbakerber</media:title>
		</media:content>
	</item>
		<item>
		<title>Read a Text File into an Oracle Table using an External Table</title>
		<link>http://dbakerber.wordpress.com/2007/12/31/read-a-text-file-into-an-oracle-table-using-an-external-table/</link>
		<comments>http://dbakerber.wordpress.com/2007/12/31/read-a-text-file-into-an-oracle-table-using-an-external-table/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 23:15:36 +0000</pubDate>
		<dc:creator>dbakerber</dc:creator>
				<category><![CDATA[Oracle hints]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbakerber.wordpress.com/2007/12/31/read-a-text-file-into-an-oracle-table-using-an-external-table/</guid>
		<description><![CDATA[Nice Trick for Reading Text Files Into Oracle
Have you ever had the need to read a text file into Oracle?  And parse out pieces of information when you do it?  Yes, you can do it with SQL Loader, but Oracle external tables offer much more flexibility.  The example below shows you how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=7&subd=dbakerber&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoNormal"><b>Nice Trick for Reading Text Files Into Oracle</b></p>
<p class="MsoNormal">Have you ever had the need to read a text file into Oracle?<span>  </span>And parse out pieces of information when you do it?<span>  </span>Yes, you can do it with SQL Loader, but Oracle external tables offer much more flexibility.<span>  </span>The example below shows you how to load an Oracle alert log into an Oracle table using an external table, but you can use this method with any text file.</p>
<p class="MsoNormal">First, define your directory and grant the required privileges:</p>
<p class="MsoNormal"><span style="font-family:'Courier New';">create directory log_dir as &#8216;/u01/app/oracle/admin/orcl/bdump&#8217;;<br />
grant read on directory log_dir to dba;<br />
grant write on directory log_dir to dba;</span></p>
<p class="MsoNormal"><span style="font-family:'Courier New';"></span>Next, we create our table:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span style="font-family:'Courier New';">create table alert_log<br />
(txt_line varchar2(512))<br />
organization external<br />
(type ORACLE_LOADER<br />
default directory log_dir<br />
access parameters (records delimited by newline<br />
fields<br />
(txt_line char(512)))<br />
location (&#8216;alert_orcl.log&#8217;)<br />
);</span></p>
<p class="MsoNormal"><span style="font-family:'Courier New';"></span>Note that we set the length of the line to 512.<span>  </span>Just set it to the maximum length of the line.<span>  </span>Oracle will read to the end of the record as delimited by the new line.</p>
<p class="MsoNormal">At this point, we can read the table as any oracle table.</p>
<p class="MsoNormal"><span style="font-family:'Courier New';">Select * from alert_log;</span></p>
<p class="MsoNormal"><span style="font-family:'Courier New';">Create table ora_alert_log as (select rownum as line_number, txt_line from alert_log);</span></p>
<p class="MsoNormal"><span style="font-family:'Courier New';"></span>If you run the create table as select, you now have a standard Oracle table containing lines of text.<span>  </span>At this point, you can do all kinds of queries and data manipulations.<span>  </span>You can search for shutdown and startup times, look for Oracle error messages, or anything else you may need.<span>  </span>This external table feature is very handy, and there is a lot you can do with it.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbakerber.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbakerber.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbakerber.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbakerber.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbakerber.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbakerber.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbakerber.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbakerber.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbakerber.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbakerber.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbakerber.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbakerber.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=7&subd=dbakerber&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dbakerber.wordpress.com/2007/12/31/read-a-text-file-into-an-oracle-table-using-an-external-table/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1086aff871513b5e8ac592325bdbd885?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dbakerber</media:title>
		</media:content>
	</item>
		<item>
		<title>Rebuilding Oracle Indexes</title>
		<link>http://dbakerber.wordpress.com/2007/12/29/rebuilding-oracle-indexes/</link>
		<comments>http://dbakerber.wordpress.com/2007/12/29/rebuilding-oracle-indexes/#comments</comments>
		<pubDate>Sat, 29 Dec 2007 15:10:56 +0000</pubDate>
		<dc:creator>dbakerber</dc:creator>
				<category><![CDATA[Oracle hints]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dbakerber.wordpress.com/2007/12/29/rebuilding-oracle-indexes/</guid>
		<description><![CDATA[Don Burleson recently sent out to one of his Oracle DBA mailing lists some information about rebuilding indices (or is it indexes?) to his Oracle tips mailing list.  He also provided a link to more information on his web site: http://www.dba-oracle.com/t_index_rebuilding_issues.htm.  His information is valuable, and I have a few more observations from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=5&subd=dbakerber&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="left">Don Burleson recently sent out to one of his Oracle DBA mailing lists some information about rebuilding indices (or is it indexes?) to his Oracle tips mailing list.<span>  </span>He also provided a link to more information on his web site: <a href="http://www.dba-oracle.com/t_index_rebuilding_issues.htm" target="_blank">http://www.dba-oracle.com/t_index_rebuilding_issues.htm</a>.<span>  </span>His information is valuable, and I have a few more observations from my experience at my previous job.</p>
<p class="MsoNormal"> Burleson notes that Oracle recommends rebuilding indexes when the b-level is more than four or the percent deleted is greater than 20.</p>
<p class="MsoNormal">At my previous employer, the hardware budget was always very tight.<span> </span>We couldn’t always lay out the tablespaces in the ideal manner to optimize performance, but I think we did a pretty good job within the constraints we had.<span>   </span>We rarely hit a b-level higher than three, but we discovered that in Oracle Versions 8i, 9i, and 10g, the larger the table the more noticeable the performance degradation on index reads as the percentage of deletes goes up.<span>  </span>That is, on larger tables the performance degradation was much quicker and more noticeable than on smaller tables.<span>  </span>A large table would see noticeable performance degradation on as few as 5% delete, whereas on smaller tables it would need to hit 10-15% before the degradation became noticeable.<span>  </span>These were not minor differences, measured in milliseconds.<span>  </span>The performance changes were dramatic, highly noticeable to end users.<span>  </span>For the purposes of this article, a smaller table is from one hundred thousand to one million rows, a medium size table could be up to five million rows, and a large table is more than five million rows.</p>
<p>Obviously this sort of statistic is highly dependent on hardware, but I suspect there are plenty of Oracle shops that have seen similar results.</p>
<p class="MsoNormal"> I eventually wrote a simple query that generates a list of candidates for index rebuilds, and the commands necessary to rebuild the indexes once the tables reached a point where it was necessary.<span>  </span>The query reads a table we built called TABLE_MODIFICATIONS that we loaded each night from DBA_TAB_MODIFICATIONS before we ran statistics.  Monitoring must be turned on to use the DBA_TAB_MODIFICATIONS table.</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'Courier New';">select<br />
&#8216;exec analyzedb.reorg_a_table4(&#8216;||&#8221;&#8221;||rtrim(t.table_owner)||&#8221;&#8221;||&#8217;,'||&#8221;&#8221;||<br />
rtrim(t.table_name)||&#8221;&#8221;||&#8217;);&#8217;,<br />
t.table_owner||&#8217;.'||t.table_name name,<br />
a.num_rows,<br />
sum(t.inserts) ins,<br />
sum(t.updates) upd,<br />
sum(t.deletes) del,<br />
sum(t.updates)+sum(t.inserts)+sum(t.deletes) tot_chgs,<br />
to_char((sum(t.deletes)/(decode(a.num_rows,0,1,a.num_rows)))*100.0,&#8217;999999.99&#8242;) per_del,<br />
round(((sum(t.updates)+sum(t.inserts)+sum(t.deletes))/(decode(a.num_rows,0,1,a.num_rows)) *100.0),2) per_chg<br />
from analyzedb.table_modifications t,<br />
all_tables a<br />
where t.timestamp &gt;= to_date(&#8216;&amp;from_date&#8217;,'dd-mon-yyyy&#8217;) and<br />
t.table_owner = a.owner and t.table_owner not in (&#8216;SYS&#8217;,'SYSTEM&#8217;) and<br />
t.table_name=a.table_name<br />
having (sum(t.deletes)/(decode(a.num_rows,0,1,a.num_rows)))*100.0 &gt;=5<br />
group by t.table_owner, t.table_name, a.num_rows<br />
order by num_rows desc, t.table_owner, t.table_name;</span></p>
<p class="MsoNormal">&nbsp;</p>
<p>Of course, your mileage will vary.<span>  </span>Reorg_a_table4 was the stored procedure that actually generated the DDL.<span>  </span>It just reads the data dictionary to get the index name and tablespace name and generates the alter index rebuild command.<span>  </span></p>
<p class="MsoNormal">This was a site with a traditional one night per week operations window, and we usually didn’t have enough time to rebuild everything, so the list was sorted so that those tables most in need of work were listed first.</p>
<p><span id="more-5"></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dbakerber.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dbakerber.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dbakerber.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dbakerber.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dbakerber.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dbakerber.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dbakerber.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dbakerber.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dbakerber.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dbakerber.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dbakerber.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dbakerber.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dbakerber.wordpress.com&blog=2405702&post=5&subd=dbakerber&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dbakerber.wordpress.com/2007/12/29/rebuilding-oracle-indexes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1086aff871513b5e8ac592325bdbd885?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dbakerber</media:title>
		</media:content>
	</item>
	</channel>
</rss>