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

<channel>
	<title>Ardent Performance Computing &#187; Oracle</title>
	<atom:link href="http://www.ardentperf.com/category/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ardentperf.com</link>
	<description>Jeremy Schneider</description>
	<lastBuildDate>Mon, 16 Jan 2012 06:04:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Making Simple Performance Charts</title>
		<link>http://www.ardentperf.com/2011/11/28/making-simple-performance-charts/</link>
		<comments>http://www.ardentperf.com/2011/11/28/making-simple-performance-charts/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 11:35:46 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=1334</guid>
		<description><![CDATA[Before I dive into this blog post, quick heads up for anyone attending UKOUG: on Tuesday only, I&#8217;ll be hanging out with some very smart people from the IOUG RAC Special Interest Group in the &#8220;gallery&#8221; above the exhibition hall. We&#8217;re ready to help anyone run a RAC cluster in a virtual environment on their [...]]]></description>
			<content:encoded><![CDATA[<p>Before I dive into this blog post, quick heads up for anyone attending UKOUG: <a href="http://2011.ukoug.org/default.asp?p=9188">on Tuesday only</a>, I&#8217;ll be <a href="http://racattack.org/e">hanging out with some very smart people</a> from the IOUG RAC Special Interest Group in the &#8220;gallery&#8221; above the exhibition hall.  We&#8217;re ready to help anyone run a RAC cluster in a virtual environment on their own laptop.  And if your laptop <a href="http://racattack.org/o">doesn&#8217;t meet the minimum requirements</a> then you can try with one of our demo workstations.  Come find us!!</p>
<h3>Why Make Charts</h3>
<p>I&#8217;ve heard <a href="http://dboptimizer.com/">Kyle Hailey</a> speak on a few different occasions, and more than once he&#8217;s talked about the power of visualizing data.  (In fact Kyle was a key person behind <a href="https://sites.google.com/site/youvisualize/oem-10g-performance-pages---before-and-after">Grid Control&#8217;s performance screens</a>.)</p>
<p>I couldn&#8217;t agree more.  I regularly visualize data when I&#8217;m working.  Two reasons come immediately to mind:</p>
<ol>
<li>It helps <strong>me</strong> to better understand what&#8217;s happening.  There have been times when I&#8217;ve had an &#8220;aha&#8221; moment very quickly after seeing the picture.
</li>
<li>It helps <strong>others</strong> more easily understand what i&#8217;m trying to communicate.  It&#8217;s great for management reports and such &#8211; not because it&#8217;s fluff, but because it&#8217;s a good communication tool.</li>
</ol>
<p>Last week, I made a few quick charts as illustrations for a performance report.  The process really isn&#8217;t that complicated, but I thought I&#8217;d put the steps into a blog post&#8230; for myself to reference in the future and for anyone else who might find this helpful.  :)</p>
<p><a href="http://www.ardentperf.com/wp-content/uploads/2011/11/more-research_html_m5273695a.jpg"><img src="http://www.ardentperf.com/wp-content/uploads/2011/11/more-research_html_m5273695a-300x175.jpg" alt="" title="more-research_html_m5273695a" width="300" height="175" class="aligncenter size-medium wp-image-1369" /></a></p>
<h3>Making Simple Charts</h3>
<p>This demonstration will use data from the AWR to build graphs.  Note that if you run these queries, Oracle legally requires you to purchase the extra-cost &#8220;diagnostic pack&#8221; license.  But similar queries could be written from free <a href="http://kerryosborne.oracle-guy.com/2008/11/statspack-still-works-in-10g-and-11g/">statspack</a> or <a href="http://ashmasters.com/ash-simulation/simulation-v22/">S-ASH</a> tables.</p>
<p>You need multiple data points to make a graph.  For this demo, The AWR was configured to take snapshotsd every 30 minutes and I&#8217;m looking at a query which ran for about 10 hours.  Also, it was the only query running in the instance for most of that time &#8211; so I will also look at some instance-wide statistics.<br />
<span id="more-1334"></span></p>
<ol>
<li>
<p>The first step is to get any needed parameters for pulling performance data.  In the case of the AWR, I will need the INSTANCE_NUMBER, the SQL_ID and the first/last SNAP_ID.</p>
<p>It&#8217;s pretty easy to get this information from Grid Control or from Database Console.  But if you don&#8217;t have access to the web console then you can still get the info from SQLPlus.</p>
<p>Here&#8217;s a useful query to get an overview of the SNAP_IDs:</p>
<pre><code>SQL&gt; select to_char(BEGIN_INTERVAL_TIME,'MON YYYY') month,
       min(snap_id) min_snap, max(snap_id) max_snap
     from dba_hist_snapshot
     where instance_number=4
     group by to_char(BEGIN_INTERVAL_TIME,'MON YYYY');

MONTH        MIN_SNAP     MAX_SNAP
-------- ------------ ------------
APR 2009        10239        10240
DEC 2009        28752        31924
FEB 2010        38115        40939
MAY 2010        47498        48783
AUG 2010        54975        55013
NOV 2010        60979        61986
DEC 2010        61987        64218
JAN 2011        64219        66448
FEB 2011        66449        67803
MAR 2011        67804        69291
APR 2011        69292        70731
MAY 2011        70732        72219
JUN 2011        72220        73655
JUL 2011        73656        75139
AUG 2011        75140        76608
SEP 2011        76609        78048
OCT 2011        78049        79536
NOV 2011        79537        80338

18 rows selected.</code></pre>
<p>Something similar to this might also be useful:</p>
<pre><code>SQL&gt; select snap_id,instance_number,begin_interval_time,snap_level
     from dba_hist_snapshot
     where begin_interval_time between '11-nov-11 17:30' and '11-nov-11 19:00'
       and instance_number=4
     order by snap_id, instance_number;</code></pre>
<p>For this demo I&#8217;m going to use INSTANCE_NUMBER 4 and SQL_ID 8suhywrkmpj5c between snaps 80298 and 80318.</p>
</li>
<li style="margin-top:4em">
<p>Now create a new spreadsheet in your office suite.  I use the free OpenOffice spreadsheet application, but Excel or iWork Numbers should work pretty much the same.</p>
<p>In the second row of the new spreadsheet, enter the time of the first snapshot you&#8217;re going to analyze.  In the third row, enter this formula:</p>
<pre><code>= A2 + 1/24/60 * [minutes between snaps]</code></pre>
<p>Select several rows below this formula and select Edit > Fill > Down to copy the formula to the following rows.  Repeat this until you have reached the end of your analysis window.</p>
<p><a href="http://www.ardentperf.com/wp-content/uploads/2011/11/ooo-filldown.png"><img src="http://www.ardentperf.com/wp-content/uploads/2011/11/ooo-filldown-286x300.png" alt="" title="ooo-filldown" width="286" height="300" class="aligncenter size-medium wp-image-1358" /></a></p>
</li>
<li style="margin-top:4em">
<p>Open a SQLPlus session.  We will copy-and-paste directly from SQLPlus into the spreadsheet.</p>
<p>Use a SQL like this to retrieve data for one system statistic:</p>
<pre><code>set pagesize 999
col value format 999999999999999

select value from dba_hist_sysstat
 where instance_number=4 and snap_id between 80298 and 80318
   and stat_name='transaction tables consistent read rollbacks'
 order by snap_id</code></pre>
<p>You can copy the statistic name directly from an AWR report of there&#8217;s a certain stat you&#8217;re interested in.  You can find more information about <a href="http://docs.oracle.com/cd/E11882_01/server.112/e25513/stats002.htm#i375475">system statistics in Oracle&#8217;s docs</a>.</p>
<p>Now move right to the next empty column. First, copy the name of this statistic into the first row. Then, in the second box, enter a formula to find the difference between its left peer and the left upper peer.  For cell C3, the formula is B3-B2.  Choose Edit > Fill > Down again, as before.</p>
<pre><code>= B3 - B2</code></pre>
<p><a href="http://www.ardentperf.com/wp-content/uploads/2011/11/ooo-paste.png"><img src="http://www.ardentperf.com/wp-content/uploads/2011/11/ooo-paste-300x194.png" alt="" title="ooo-paste" width="300" height="194" class="aligncenter size-medium wp-image-1373" /></a></p>
<p>You can repeat this step to access further system statistics.  You can also create another column where you divide or multiply each other.</p>
<p><a href="http://www.ardentperf.com/wp-content/uploads/2011/11/more-research_html_7559fa03.jpg"><img src="http://www.ardentperf.com/wp-content/uploads/2011/11/more-research_html_7559fa03-300x175.jpg" alt="" title="more-research_html_7559fa03" width="300" height="175" class="aligncenter size-medium wp-image-1371" /></a></p>
</li>
<li style="margin-top:4em">
<p>The previous SQL statement retrieved system statistics.  Another easy query runs against historical V$SQLSTAT snapshots.  (This only works for long-running queries.)</p>
<pre><code>SQL&gt; select BUFFER_GETS_TOTAL value from dba_hist_sqlstat
     where instance_number=4 and snap_id between 80298 and 80318
       and sql_id='8suhywrkmpj5c'
     order by snap_id</code></pre>
<p>Once again, you can read about the available fields and statistics <a href="http://docs.oracle.com/cd/E11882_01/server.112/e25513/statviews_4052.htm#REFRN23447">in the oracle docs</a>.  You can repeat this step to quickly get additional statistics for a particular SQL, and you can then combine some stats for better graphs.</p>
<p><a href="http://www.ardentperf.com/wp-content/uploads/2011/11/more-research_html_7e8de68c.jpg"><img src="http://www.ardentperf.com/wp-content/uploads/2011/11/more-research_html_7e8de68c-300x177.jpg" alt="" title="more-research_html_7e8de68c" width="300" height="177" class="aligncenter size-medium wp-image-1375" /></a></p>
</li>
</ol>
<p>That&#8217;s it!  I know, really not that complicated.  I hope it&#8217;s helpful.  :)</p>
<h3>Post Script</h3>
<p>For anyone who&#8217;s curious, the charts in this article are related to a SQL report which was <a href="http://www.freelists.org/post/oracle-l/index-with-very-high-LIO">recently discussed on the mailing list</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2011/11/28/making-simple-performance-charts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Performance Tuning for Oracle Developers</title>
		<link>http://www.ardentperf.com/2011/08/30/performance-tuning-for-oracle-developers/</link>
		<comments>http://www.ardentperf.com/2011/08/30/performance-tuning-for-oracle-developers/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 14:50:56 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=1278</guid>
		<description><![CDATA[One of my recent customers was a company with a somewhat large warehouse (around 60TB) on Oracle 10gR2.  The system was using RAC, though it was a fairly simple setup: two nodes, very large AIX LPARs, workload manually partitioned between them and somewhat evenly balanced.  The most important demand of their business is a large [...]]]></description>
			<content:encoded><![CDATA[<p>One of my recent customers was a company with a somewhat large warehouse (around 60TB) on Oracle 10gR2.  The system was using RAC, though it was a fairly simple setup: two nodes, very large AIX LPARs, workload manually partitioned between them and somewhat evenly balanced.  The most important demand of their business is a large number of reports that must be generated every day from the warehouse.  These reports were beginning to take most of the day and consume a large amount of resources&#8230; and the current forecast is for dramatic data growth later this year.  So our project goal was to improve performance.</p>
<p>Our project was very successful &#8211; the key changes had dramatic effects and we are now running the same set of reports much faster.  (Some reports went from many hours to less than 30 minutes.)  My final project summary included a small section where I passed along a few suggestions specifically for these developers &#8211; but looking over the suggestions now, I think they might actually be good tips for a wider audience.  At any rate it might be interesting to put them out for comments!</p>
<p>Of course these tips aren&#8217;t my own original work; in fact I think they&#8217;re pretty widely accepted in the Oracle professional community.  We&#8217;ve been hearing these ideas for years now at conferences and user groups.  I just picked a few that could make the biggest impact for this team right now &#8211; and I put the ideas in my own words.  These were my top three:</p>
<ul>
<li>Aggressively search for opportunities to do less computational work.
<ul>
<li>Fewer switches between SQL, PL/SQL and Java.</li>
<li>Java is slowest, PL/SQL is faster, C and SQL are fastest.</li>
<li>Operate in bulk whenever possible.
<ul>
<li>Avoid using any kind of loop in your code whenever possible. If loops are required, operate on large chunks at a time (for example, by increasing fetch sizes).</li>
<li>Avoid coding in multiple steps whenever possible. If multiple steps are faster, ask how you&#8217;re code works and why Oracle isn&#8217;t automatically doing the same.</li>
</ul>
</li>
</ul>
</li>
<li>Always utilize tracing/logging when coding and tuning. Create logs at the most granular level possible, then summarize the results by time (aka profiling). Calibrate everything in terms of wall clock elapsed time for entire job.
<ul>
<li>Utilize database 10046 log files for any jobs where the database is an important component. There are several profilers available with various feature levels and price points (starting with free); utilize one of these to summarize the logs. These logs can safely be generated in production.</li>
<li>Use the Oracle PL/SQL Profiler to generate profiles on critical path PL/SQL code.</li>
</ul>
</li>
<li>When tuning SQL, follow these steps:
<ol>
<li>Remove all hints.</li>
<li>Use dbms_xplan, 10046 and 10053 traces &#8211; in that order &#8211; to determine where the CBO went wrong. Compare CBO row count estimates with actual row counts before time-consuming, in-depth analysis of 10053 logs.</li>
<li>Add hints only with justification about why the hint is preferable to fixing underlying cause. Generally speaking, hints should be viewed as band-aids.</li>
<li>When a good plan is found and underlying causes cannot be addressed, use DBMS_XPLAN functions with the ADVANCED flag to retrieve a full set of hints. Use this to lock in the good plan and document the situation with SQL comments. (11g will offer new options for plan management, but this method will be sufficient for 10g.)</li>
</ol>
</li>
</ul>
<p>I&#8217;m sure that these tips aren&#8217;t perfect &#8211; so please share your thoughts!  How could I better word them?  Do they apply to your development team?</p>
<h3>Post-Script</h3>
<p>I&#8217;m definitely no guru of Oracle performance yet, but I have been involved in a number of performance-oriented projects. My experience has been that it&#8217;s pretty common to have certain assumptions built in to the project through scoping and goal statements before I arrive. Often, project sponsors have already decided that one of the most important items in a performance project is that someone with experience in storage and system configuration for Oracle (this is usually me) will review settings and statistics for things like database parameters, AWR reports, operating system kernel settings, networking, I/O, etc.  The contractual &#8220;statement of work&#8221; might say something like &#8220;review and assess configuration and architecture&#8221; with a list of specific areas of configuration.</p>
<p>I&#8217;m not opposed to periodic configuration audits or having a second set of eyes look over the setup.  But this very customer was a perfect example of how these assumptions about performance tuning through system review really are not the best way to work.  Due to the many parties involved in this contract and various expectations, it was important for me to review the system configuration &#8211; so I did spend time on this review.  However I was lucky that the team and managers who I directly worked with were sharp and open-minded. After some spirited discussion we slightly altered our approach: starting at the top of the stack and working down rather than the other way around.</p>
<p>Our first two weeks were focused on the most important business reports and only during the last two weeks did I take an in-depth look at storage and system configuration.  Can you guess what happened?  Looking at the top business problems led us straight to the most important bottlenecks impacting reports across the board.  It also showed me which areas of system configuration could have the biggest impact on the business.  By the time I started doing a system review, I already knew which areas to focus on.  Furthermore, I could already make some estimations about best-case impact of system changes on overall report run-times.  Not surprisingly, I knew that no system change was going to give us the improvement we wanted &#8211; but tuning a few small pieces of code that were used widely gave us even more improvement than we had thought possible.</p>
<p>Again, this isn&#8217;t new&#8230; it&#8217;s stuff we&#8217;ve been hearing at conferences and user groups for years now.  But it seems to me that it&#8217;s still worth repeating.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2011/08/30/performance-tuning-for-oracle-developers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Developer Access To 10046 Trace Files</title>
		<link>http://www.ardentperf.com/2011/08/19/developer-access-to-10046-trace-files/</link>
		<comments>http://www.ardentperf.com/2011/08/19/developer-access-to-10046-trace-files/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 16:20:59 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=1249</guid>
		<description><![CDATA[Lets suppose you are a DBA at a large company. You have some great developers, and they&#8217;re learning all about how to turn on full logging of their code through the 10046 database trace. They just learned how to use this data in summary form to find out &#8211; at a very detailed level &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Lets suppose you are a DBA at a large company.  You have some great developers, and they&#8217;re learning all about how to turn on full logging of their code through the 10046 database trace.  They just learned how to use this data in summary form to find out &#8211; at a very detailed level &#8211; what&#8217;s REALLY taking up all the time during their big batch program which runs too long.  They&#8217;re salivating over this trace data &#8211; but you work for a big company with security policies that can&#8217;t be easily changed, where developers rarely get any kind of shell-level or filesystem-level access to a database server.  You WANT them to have the ability to profile their own database code&#8230; but every time they run a trace, you get dragged into a long email exchange to locate their tracefile and transfer it to a network drive where they can access it.  We&#8217;re so close to a great situation&#8230; but this last part is such a drag!!!</p>
<p><em>However: please notice the Security Addendum at the end of this article.</em></p>
<p>Of course if you&#8217;re lucky enough that your developers use certain tools from Oracle, then there are some slick 3rd party plugins that will help download and manage tracefiles for you.  But what if your developers don&#8217;t want to add a whole new environment to their already memory-bound workstations?  What if there are corporate policies making this difficult &#8211; such as a time-consuming review and approval process for any new software installs?</p>
<p>Wouldn&#8217;t it be nice of Oracle had a system view that your developers could just QUERY to find tracefiles?  Maybe something like this (which of course displayed data in real time, reflecting the current status of the filesystem):</p>
<pre><code>SQL&gt; desc all_trace_files
 Name                          Null?    Type
 ----------------------------- -------- --------------------
 DIRECTORY                              CHAR(5)
 FILE_NAME                              VARCHAR2(400)
 FILE_TIME                              DATE
 FILE_BYTES                             NUMBER
 FILE_TRACEID                           VARCHAR2(100)
 FIRST_TIME                             DATE
 FIRST_ACTION                           VARCHAR2(100)
 FIRST_MODULE                           VARCHAR2(100)
 FIRST_SERVICE                          VARCHAR2(100)
 SID                                    NUMBER
 SERIAL                                 NUMBER
 ERROR                                  VARCHAR2(400)</code></pre>
<p>Sure, this looks nice &#8211; maybe in the next version of Oracle.  When you upgrade to it, 10 years from now.  But what about NOW &#8211; your old 10g database running on a huge mainframe?</p>
<p>We all know how nice it would be if your developers run a query like this&#8230; today&#8230; on almost any database:</p>
<pre style="clear:right"><code>SQL&gt; select directory, file_name, file_traceid, first_action from all_trace_files
  2  where first_action is not null;

DIREC FILE_NAME                                FILE_TRACE FIRST_ACTION
----- ---------------------------------------- ---------- ----------------------------------------
UDUMP ardentp1_ora_12386502.trc                           Test Window - New
UDUMP ardentp1_ora_22347974.trc                           Test Window - New
UDUMP ardentp1_ora_22675498.trc                           SQL Window - xml_file_writing_te
UDUMP ardentp1_ora_24248536.trc                           SQL Window - test_cases.sql
UDUMP ardentp1_ora_24641726.trc                           DEQ
UDUMP ardentp1_ora_2621852.trc                            Test Window - New
UDUMP ardentp1_ora_3342766.trc                            problemTbsp
UDUMP ardentp1_ora_4063428.trc                            SQL Window - New
UDUMP ardentp1_ora_45350944.trc                           Debug Test Window - New
UDUMP ardentp1_ora_45547538.trc                           Main session
UDUMP ardentp1_ora_48103606.trc                           SQL Window - SELECT * FROM ext.e
UDUMP ardentp1_ora_50593842.trc                           SQL Window - test_cases.sql
UDUMP ardentp1_ora_50790578.trc                           SQL Window - New
UDUMP ardentp1_ora_51380240.trc                           Debug Test Window - New
UDUMP ardentp1_ora_52429026.trc                           UserBlock
UDUMP ardentp1_ora_52691004.trc                           SQL Window - New
UDUMP ardentp1_ora_60817584.trc                           Test Window - New
UDUMP ardentp1_ora_61538330.trc                           Test Window - New
UDUMP ardentp1_ora_62783512_schn_02.trc        schn_02    Test Window - New
UDUMP ardentp1_ora_62783512_schn_03.trc        schn_03    Test Window - New
UDUMP ardentp1_ora_6291778.trc                            Test Window - New
UDUMP ardentp1_ora_63176754.trc                           Test Window - New
UDUMP ardentp1_ora_66388158.trc                           Test Window - New
UDUMP ardentp1_ora_8192480.trc                            Test Window - New
UDUMP ardentp1_ora_8651144.trc                            SQL Window - test_cases.sql
BDUMP ardentp1_m000_12517418.trc                          Monitor Tablespace Thresholds
BDUMP ardentp1_m000_20119784.trc                          Monitor Tablespace Thresholds
BDUMP ardentp1_m000_24248408.trc                          Monitor Tablespace Thresholds
BDUMP ardentp1_m000_45154330.trc                          Monitor Tablespace Thresholds
BDUMP ardentp1_mmnl_52560064.trc                          Monitor Tablespace Thresholds
BDUMP ardentp1_mmon_52756580.trc                          Monitor Tablespace Thresholds

31 rows selected.</code></pre>
<p>And of course &#8211; last but not least, you&#8217;d like your developers to actually be able to download the tracefile themselves, right?  Actually, this has already been done &#8211; Dion Cho blogged some sample code about two and a half years ago.  He has a very elegant solution using a pipelined PL/SQL function and UTL_FILE.</p>
<p><a href="http://dioncho.wordpress.com/2009/03/19/another-way-to-use-trace-file/">http://dioncho.wordpress.com/2009/03/19/another-way-to-use-trace-file/</a></p>
<p>Just one minor tweak would be needed, to grab files from more than one directory.  (In addition to your session traces, you might need to get logs from parallel query slaves or DBMS_JOB/SCHEDULER processes.)</p>
<p>Not only can you write queries to your heart&#8217;s content on this, but just about every developer environment on the planet can easily take this query output and save it to a file &#8211; then they can run the profiler of their choice on the tracefile.  That would be cool, right?!</p>
<pre><code>SQL&gt; select * from table(textfile('ardentp1_ora_52691004.trc','UDUMP')) where rownum&lt;20;

COLUMN_VALUE
-------------------------------------------------------------------------------------------
/u0001/app/oracle/admin/ardentp/udump/ardentp1_ora_52691004.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
ORACLE_HOME = /u0001/app/oracle/product/db/10.2.0/ardentp
System name:    AIX
Node name:      ardent4
Release:        1
Version:        6
Machine:        00F66BE22C00
Instance name: ardentp1
Redo thread mounted by this instance: 1
Oracle process number: 59
Unix process pid: 52691004, image: oracle@ardent4

*** ACTION NAME:(SQL Window - New) 2011-08-15 16:35:24.791
*** MODULE NAME:(PL/SQL Developer) 2011-08-15 16:35:24.791
*** SERVICE NAME:(ardentp_dba) 2011-08-15 16:35:24.791
*** SESSION ID:(572.24734) 2011-08-15 16:35:24.791

19 rows selected.</code></pre>
<p>Well I AGREE that this would be cool!  And as it happens, the customer I&#8217;m working with now would find it very useful.  And honestly&#8230; it&#8217;s really not that complicated to code something like this.  So last night I stayed late a few hours to write it up and test it.  It&#8217;s mainly build on a pipelined java function, and of course a minor tweak on Dion&#8217;s code for getting the file.</p>
<p>Basically, every time you query the view it scans the first 30 lines of all files in the bdump and udump directories for timestamps and identification information (module, action, service, sid, serial).  This information is combined with basic file stats (name, size, last-modified-date) and the tracefile_identifier is calculated from the filename.  Any errors encountered are reported in the error column (file permissions, etc).</p>
<p>You can download the entire thing at <a href="https://github.com/ardentperf">my github repo</a> (specifically, the files <a href="https://github.com/ardentperf/tracefile_helper/blob/master/tracefile_find.txt">tracefile_find.txt</a> and <a href="https://github.com/ardentperf/tracefile_helper/blob/master/tracefile_get.txt">tracefile_get.txt</a>).  All examples in this blog post are from a real system &#8211; nothing here is cooked, except that I changed database and host names to protect the innocent.</p>
<p>Enjoy!</p>
<h2>Security Addendum</h2>
<p>As pointed out in the comments after I published this post, there are some important security considerations with allowing access to trace files.  A good explanation can be found in Pete Finnigan&#8217;s blog article: <a href="http://www.petefinnigan.com/weblog/archives/00001234.htm">Is it possible to steal data with just ALTER SESSION?</a>  To summarize: if a clever hacker is able to access tracefiles then it is possible for them to see things that the database normally protects.  This certainly includes table data, and it may even include passwords for other database accounts &#8211; <a href="http://lists.jammed.com/pen-test/2001/08/0138.html">sometimes even in cleartext</a>.  This is very important if you&#8217;re considering any tool that grants access to tracefiles &#8211; including the scripts I&#8217;ve published here.  Although he generally disapproves of any tracefile access, Pete&#8217;s comment suggested a way to reduce the risk. The second table (which actually gives tracefile contents) can be limited to DBAs and then developers can get a view which only shows files that the DBAs explicitly grant.  I think that the most useful part of my program is the first view anyway, which scans tracefiles and lets you use SQL to search on module/action/service.</p>
<p>One further quick postscript&#8230; lest you think I was terribly irresponsible with this client, we did consider security implications before endorsing this script.  Admittedly I didn&#8217;t consider every scenario that Pete has written about, but I do still think we made an appropriate decision.  (Also&#8230; the script wasn&#8217;t yet installed into production when I left the client, because it had to go through an approval process itself.  <g>)  In this particular case, the small group of developers getting access to tracefiles were people who already had full access to all data in the database and they had passwords for all key application accounts.  Although they didn&#8217;t have SYSDBA passwords or shell access, they essentially had everything else &#8211; including all the data.  Furthermore, they were in a stage of performance troubleshooting where their productivity could be significantly increased with the ability to run many traces and quickly access the tracefiles (think Method R).  And finally, these developers were on the same small, tight team as the DBAs who took care of backups and patching, all sitting together in one corner of the office building.  The DBAs were involved in the decision and seemed to find their reduced workload a very positive thing &#8211; especially since they know all the developers who would get access.</p>
<p>One could certainly comment on the security policies of this client, and their decisions about balancing trust and productivity.  But I do not think that we were circumventing the company security policies in this case.  And certainly my scripts are not intended to support such activity.  Nonetheless, I do think there are cases where this is a very useful script.  It&#8217;s much more convenient for developers who &#8211; even if they can get shell access &#8211; may not know much about navigating unix and are more comfortable working in their SQL development environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2011/08/19/developer-access-to-10046-trace-files/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RAC Attack &#8211; Oracle Cluster Database at Home</title>
		<link>http://www.ardentperf.com/2011/05/17/rac-attack-oracle-cluster-database-at-home/</link>
		<comments>http://www.ardentperf.com/2011/05/17/rac-attack-oracle-cluster-database-at-home/#comments</comments>
		<pubDate>Tue, 17 May 2011 15:17:13 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=1219</guid>
		<description><![CDATA[First of all, the RAC Attack deep dive at Collaborate went great &#8211; thanks to everyone who participated! The room was full (20 participants) and I got evaluations from about half of them. Here&#8217;s a summary of the eval results: 100% class met expectations, would recommend to others 66% easy to follow, could use skills [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, the RAC Attack deep dive at Collaborate went great &#8211; thanks to everyone who participated!  The room was full (20 participants) and I got evaluations from about half of them. Here&#8217;s a summary of the eval results:</p>
<ul>
<li>100% class met expectations, would recommend to others</li>
</ul>
<ul>
<li> 66% easy to follow, could use skills in working environment</li>
</ul>
<ul>
<li> 100% already familiar with oracle, 90% use oracle daily</li>
</ul>
<ul>
<li> 0 negative reviews of instructor (phew!)</li>
</ul>
<ul>
<li> 1 negative review of curriculum: said practice exercises weren&#8217;t relevant but training manual was still above average.</li>
</ul>
<ul>
<li>0 negative &#8220;comments&#8221;</li>
</ul>
<p>There were several positive comments such as this: &#8220;I would recommend this class to others. This setup is perfect to     pick up new skills and expose what ifs w/out worrying about pressing     the wrong button.&#8221;</p>
<p>There were also some suggestions for improvements which I&#8217;ve taken note of. The most common suggestion was this: &#8220;More time to practice / explore new concepts.&#8221;</p>
<h4>What&#8217;s Next</h4>
<p>The RAC Attack curriculum has been around for over three years now &#8211; and I&#8217;m still getting requests to put it on.  Seems that a number of people have felt that it&#8217;s a decent quality class and handbook.  I talked to several other Oracle instructors and speakers at Collaborate this year about the RAC Attack curriculum &#8211; including an in-depth conversation with <a href="http://arup.blogspot.com/">Arup Nanda</a>.</p>
<p>As a result of these conversations, I did some careful thinking and I&#8217;ve been very busy for the past few weeks since Collaborate.  And I now have three major announcements about RAC Attack:</p>
<p><span id="more-1219"></span></p>
<ol>
<li>Last week, I published an <a href="http://www.ardentperf.com/downloads/">updated RAC Attack Lab Handbook</a>.  The handbook is now <strong>completely self-contained for home use</strong>.  I&#8217;ve added significant new content:
<ul>
<li>Detailed hardware requirements (taking into consideration optimal I/O and memory configuration)</li>
<li>How to install and setup VMware environment (including networking and storage)</li>
<li>How to create the RAC Attack Classroom DVD (this is actually scripted now)</li>
</ul>
</li>
<p>This means that you can now (finally) setup RAC Attack on your own computer &#8211; without needing any external assistance!</p>
<li>Although I created most of the labs for RAC Attack, some labs were also contributed by <a href="http://www.dannorris.com/">Dan Norris</a> and Parto Jalili.  Last week I also obtained their permission to move all RAC Attack content under a Creative Commons Attribution-ShareAlike license &#8211; which you will see in the latest handbook.The RAC Attack lab handbook has now been <strong>donated to the Oracle professional community</strong> with a solid copyleft license.
<ul>
<li>New DBAs are invited to use this material at home.</li>
<li>Experienced DBAs are invited to make corrections and enhancements to the textbook.  Also you can add your own labs which work on the RAC Attack &#8220;platform&#8221;.</li>
<li>Instructors are invited to use this material partially or completely in their own classes, as they wish.  You can even run your own class based solely on this material &#8211; without needing anyone&#8217;s permission.  Also, you can charge for these classes &#8211; there isn&#8217;t a &#8220;non-commercial&#8221; limitation on the terms of our license.</li>
</ul>
</li>
<p>On a related note, all code related to RAC Attack (including the jumpstart scripts and supplemental DVD build script) is now under the GPL and has been published on <a href="https://github.com/ardentperf/racattack">github</a> for easy downloading, copying and branching.</p>
<li>Finally&#8230; how are you supposed to make corrections, enhancements and additions if you&#8217;ve only got a PDF version?  Right now the textbook sources are in OpenOffice format (with a master document and about 50 lab documents).  Although this is very well suited to print media, it&#8217;s difficult to coordinate with very many authors or editors.  I&#8217;ve decided that the best way to truly encourage collaboration with other teachers &amp; instructors is to use the best platform on the web for collaborative open-content textbook projects: <strong>the RAC Attack lab textbook has a new home on wikibooks</strong>.
<p><a href="http://en.wikibooks.org/wiki/RAC_Attack_-_Oracle_Cluster_Database_at_Home">http://en.wikibooks.org/wiki/RAC_Attack_-_Oracle_Cluster_Database_at_Home</a></p>
<p>I&#8217;m just getting started now &#8211; but I&#8217;m hoping to have all existing RAC Attack content on this wiki textbook by the end of the month.  Please have a look at the project page and consider getting involved!</li>
</ol>
<h4>Feedback</h4>
<p>I consider these to be some major changes.  I&#8217;ve put some careful thought into them, and I&#8217;m excited about the new direction for this class.  Let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2011/05/17/rac-attack-oracle-cluster-database-at-home/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mysterious Oracle Net Errors</title>
		<link>http://www.ardentperf.com/2010/09/08/mysterious-oracle-net-errors/</link>
		<comments>http://www.ardentperf.com/2010/09/08/mysterious-oracle-net-errors/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 18:53:00 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=1028</guid>
		<description><![CDATA[Yesterday, I had a fight to the death with a nasty Oracle Net problem. The battle consumed a little more of the day than I intended&#8230; but it was worthwhile for the sweet taste of victory. Everything started with this short, innocent-seeming instant message: there is something wrong with a 10g server config. connecting to [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I had a fight to the death with a nasty Oracle Net problem. The battle consumed a little more of the day than I intended&#8230; but it was worthwhile for the sweet taste of victory.</p>
<p>Everything started with this short, innocent-seeming instant message:</p>
<blockquote><p>there is something wrong with a 10g server config. connecting to it from windows works, the linux instant client returns ORA-28547. the same linux client can connect to 9g installation though. google is not helpful, does anyone have an idea?</p></blockquote>
<p>Seems like a simple question!  But we ended up chatting on-and-off throughout the whole day as I helped troubleshoot the problem.  We finally found the problem at the end of the day &#8211; and I promise you that it would have taken Oracle Support weeks (or even months) to find this problem.  Yikes!</p>
<h4>Troubleshooting Summary</h4>
<p>The client was php on a linux box.  This client was connecting to the database server over a network connection which includes a VPN tunnel.  The database is being upgraded from 9i to 10g &#8211; and the new database is already running on a new server.  The client can connect to the 9i database but it can&#8217;t connect to the 10g database.  The developer also has a windows box with an oracle client; this windows box can connect to the 10g database over the network link just fine.  TNSNAMES is not used, and all connect strings are identical except for the IP addresses.  The 11g instant client for Linux is being used.</p>
<p>Our investigation process involved a lot of trial-and-error.  We repeated this cycle: gather data, postulate a theory, suggest an action.  We knew that we were close because often the error messages would change &#8211; but they didn&#8217;t go away!  For posterity (and google), here are the errors we encountered:</p>
<ul>
<li>ORA-28547: connection to server failed, probable Oracle Net admin error</li>
<li>ORA-12170: TNS:Connect timeout occurred</li>
<li>ORA-03113: end-of-file on communication channel</li>
<li>WARNING: inbound connection timed out (ORA-3136)</li>
<li>Fatal NI connect error 12170.</li>
<li>TNS-12535: TNS:operation timed out / ns secondary err code: 12606</li>
<li>ntt2err:Read unexpected EOF ERROR on 7</li>
<li>ORA-12537 or TNS-12537: TNS: connection closed  / ns2: 12560</li>
</ul>
<p>We started with simple changes before looking into deep logs or tracefiles.  I didn&#8217;t have any access to the actual system, just a chat connection to the developer.  And of course I was hoping for a quick fix&#8230; though it didn&#8217;t end up happening.  But FWIW, here&#8217;s everything we tried:<span id="more-1028"></span></p>
<ul>
<li>Double-check that TNSNAMES or connection string is correct</li>
<li>If RAC, then check REMOTE SERVER connect string in LSNRCTL output (this comes from local_listener/remote_listener settings)</li>
<li>Add server hostname to local client DNS.  (Connect string used IP, but server might pass back hostname for re-connect during connection process.)</li>
<li>Check if DB server is behind a firewall, client seeing IP address different than server &#8211; see metalink note 270096.1 (can possibly address on 10g+ with DIRECT_HANDOFF_TTC_ in listener.ora or USE_SHARED_SOCKET in windows registry)</li>
<li>Attempt to <strong>disable</strong> shared-socket/direct-handoff.  (Trace revealed that the working 9i connection didn&#8217;t bequeath its connection but broken 10g connection did.)</li>
<li>Downgraded instant client from 11g to 10g (to match target database)</li>
<li>Check if there&#8217;s a software firewall active on the database server</li>
</ul>
<p>To gather data, of course we first just captured error messages from the client.  Later, we checked the server sqlnet.log, alert log, bdump/udump, and windows OS event log for messages.  The developer I was working with was very savvy, so I actually had him generate some client trace files fairly early on &#8211; from both working and non-working connections.</p>
<p>We heavily leveraged the two working connections (linux->9i and windows->10g) by comparing tracefiles.  In the end, these tracefiles tipped us off to the real problem.</p>
<h4>Infuriating</h4>
<p>I expected a quick, easy answer &#8211; but it wasn&#8217;t.  It drove me crazy all day.</p>
<p>From the beginning it was obviously some kind of networking problem.  The database was running on a windows server, so my first thought was that it was related to the re-connect that happens when the listener hands off the connection to the database process.  But the trace file revealed that 10g was actually bequeathing (or rather, sharing) the connection &#8211; shame on me for not keeping up to speed with Oracle/Windows developments!!  (I usually work with unix environments.)</p>
<p>Generating a client trace is easy &#8211; you just edit (or create) the text file sqlnet.ora and add two lines TRACE_DIRECTORY_CLIENT and TRACE_LEVEL_CLIENT <a href="http://www.juliandyke.com/Diagnostics/Trace/NetTrace.html">(detailed description)</a>.  If you&#8217;re using the instant client then you can set the environment variable TNS_ADMIN to the directory containing this file.</p>
<p>Here are a few lines from the client trace we generated:</p>
<pre><code>2010-09-07 20:41:00.451918 : nscall:connecting...
2010-09-07 20:41:00.452854 : nsopen:opening transport...
2010-09-07 20:41:00.453086 : nttcni:Tcp conn timeout = 60000 (ms)
2010-09-07 20:41:00.504377 : nttcni:connected on ipaddr 10.10.0.97
2010-09-07 20:41:00.506948 : nscon:doing connect handshake...
<span style='background-color:#DFDFDF'>2010-09-07 20:41:00.506979 : nscon:sending NSPTCN packet</span>
2010-09-07 20:41:00.507113 : nttwr:socket 7 had bytes written=233
2010-09-07 20:41:00.567169 : nttrd:socket 7 had bytes read=8
<span style='background-color:#DFDFDF'>2010-09-07 20:41:00.567434 : nscon:got NSPTRS packet
2010-09-07 20:41:00.567692 : nscon:sending NSPTCN packet</span>
2010-09-07 20:41:00.567817 : nttwr:socket 7 had bytes written=233
2010-09-07 20:41:00.617139 : nttrd:socket 7 had bytes read=32
<span style='background-color:#DFDFDF'>2010-09-07 20:41:00.617362 : nscon:got NSPTAC packet</span>
2010-09-07 20:41:00.617453 : nscon:connect handshake is complete
<span style='background-color:#DFDFDF'>2010-09-07 20:41:00.620093 : nsdofls:sending NSPTDA packet</span>
2010-09-07 20:41:00.620253 : nttwr:socket 7 had bytes written=156
2010-09-07 20:41:00.667129 : nttrd:socket 7 had bytes read=127
<span style='background-color:#DFDFDF'>2010-09-07 20:41:00.667359 : nsrdr:got NSPTDA packet</span>
2010-09-07 20:41:00.670112 : nttfpwr:socket 7 had bytes written=47
2010-09-07 20:41:00.717287 : nttfprd:socket 7 had bytes read=181
2010-09-07 20:41:00.719612 : nttfpwr:socket 7 had bytes written=2011
2010-09-07 20:41:00.720401 : nttfpwr:socket 7 had bytes written=666
<span style='background-color:#DFDFDF'>2010-09-07 20:42:01.577217 : ntt2err:Read unexpected EOF ERROR on 7</span></code></pre>
<p>The presence of NSPTRS indicates that the connection is being bequeathed/shared on the server.  Metalink notes 270096.1 and 1007807.1 are very helpful for understanding this handshake process.  Here&#8217;s a brief outline of what&#8217;s happening:</p>
<table>
<tr>
<th>Client</th>
<th>Server</th>
</tr>
<tr>
<td>Connect (nsptCN)</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Re-Send (nsptRS)</td>
</tr>
<tr>
<td>Connect (nsptCN)</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Acknowledge (nsptAK)</td>
</tr>
<tr>
<td>Data (nsptDA)</td>
<td></td>
</tr>
<tr>
<td></td>
<td>Data (nsptDA)</td>
</tr>
<tr>
<td>DEATH!!</td>
<td>DEATH!!</td>
</tr>
</table>
<p>One other important piece of information we eventually unearthed was this error in sqlnet.log on the <strong>server</strong>:</p>
<pre><code>Fatal NI connect error 12170.
...
  Tns error struct:
    ns main err code: 12535
    TNS-12535: TNS:operation timed out
    ns secondary err code: 12606</code></pre>
<p>Both the server and client were seeing the connection spontaneously die!  Yet the client connects fine to a 9i database, and a different client connects fine to this database!!  Right about now, I was thinking of two possible root causes:</p>
<ol>
<li>Rogue firewall somewhere that&#8217;s killing the connection for some unknown reason.  But the developer is pretty sure that there&#8217;s no firewall killing connections.</li>
<li>Bug?!</li>
</ol>
<h4>Breakthrough</h4>
<p>At this point I asked the developer to run a level 16 client trace (which includes packet dumps) and I started reading through the dump.  Then I noticed two important things.</p>
<ol>
<li>There is a 60 second pause before the client detects the dead connection.  This is equal to the TCP connection timeout.  I suddenly realized that the client &#8220;EOF&#8221; error was not from the server terminating the connection &#8211; the client was <em>timing out</em> while waiting for the server.  And then I realized that the server was doing the same thing &#8211; waiting for the client!</li>
<li>I looked a lot closer at a certain section of the tracefile that immediately precedes this timeout.  In particular, I looked at the packet contents and sizes &#8211; and I compared with the working 9i connection.</li>
</ol>
<p>Here&#8217;s a snip from the diff between the working 9i connection and the broken 10g connection:</p>
<pre><code><span style='background-color:#DFDFDF'> nttfpwr:socket 7 had bytes written=47</span>
-nttfprd:socket 7 had bytes read=164
-nscontrol:Vect I/O support: 02010-09-07 20:48:06.447554 : nscontrol:cmd=44, lcl=0x0
-nttfpwr:socket 7 had bytes written=1080
-nttfprd:socket 7 had bytes read=949
-nttfpwr:socket 7 had bytes written=213
-nttfprd:socket 7 had bytes read=22
<span style='background-color:#DFDFDF'>+nttfprd:socket 7 had bytes read=181
+nscontrol:Vect I/O support: 02010-09-07 20:52:12.267498 : nscontrol:cmd=44, lcl=0x0
+nttfpwr:socket 7 had bytes written=2011
+nttfpwr:socket 7 had bytes written=666
+ntt2err:Read unexpected EOF ERROR on 7</span></code></pre>
<p>When I looked at the packet contents for the broken connection, it was immediately evident that those TWO packets (2011 bytes and 666 bytes) were ONE message.  The message was too large for one packet so it had been fragmented.</p>
<p>However the first big message sent to the 9i database is 1080 bytes.  It gets sent in a single packet.</p>
<p>I asked the developer, what&#8217;s the max packet size on the Linux box?  He replied that the MTU was 1456.</p>
<p><strong>WILD guess&#8230;</strong> I wondered, was the big packet getting dropped somewhere?  (Windows client trace shows the large packet getting through without any problem, but still&#8230;)</p>
<h4>Oracle is Better than MySQL</h4>
<p>&#8230;ok, maybe the standard MySQL client has this functionality too &#8211; I actually don&#8217;t know.  I just wrote that title because it&#8217;s provocative!!  But when it comes to tweaks, Oracle really does shine.  It has more switches and knobs than you&#8217;d believe.</p>
<p>It&#8217;s very simple to reduce the max packet size in the Oracle client: just add &#8220;(SDU=####)&#8221; to the connect string.  The default is 2048 &#8211; which explains the fragment sizes we observed.</p>
<p>Here&#8217;s what transpired next in my chat (please excuse the language):</p>
<blockquote><p>f**k me<br />
just tried with 1024 and it worked
</p></blockquote>
<p>Seems that we identified the problem!  And most importantly, we have a working connection so that this developer can get back to what&#8217;s important &#8211; coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2010/09/08/mysterious-oracle-net-errors/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>RAC Investigation on Low-Memory Linux</title>
		<link>http://www.ardentperf.com/2010/09/02/rac-investigation-on-low-memory-linux/</link>
		<comments>http://www.ardentperf.com/2010/09/02/rac-investigation-on-low-memory-linux/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 19:05:44 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=987</guid>
		<description><![CDATA[Back in the Oracle 9i days, I was one of those people who got on eBay to buy firewire PCI cards and disks that could do non-exclusive login.  Remember that?  The first time a little test cluster could be cheap enough for the home enthusiast?  I still have the parts in my closet. Of course, [...]]]></description>
			<content:encoded><![CDATA[<p>Back in the Oracle 9i days, I was one of those people who got on eBay to buy firewire PCI cards and disks that could do non-exclusive login.  Remember that?  The first time a little test cluster could be cheap enough for the home enthusiast?  I still have the parts in my closet.</p>
<p>Of course, we all know what happened after that &#8211; virtualization.  It didn&#8217;t take long before my home-built test clusters were running on VMware.  (Personally, I think that virtualization really started because of those NES and SNES emulators.  Most great achievements start with a geek who wants to play more video games.)  There are lots of people now who run RAC on virtual environments and it&#8217;s easy to find tutorials on the web for many different OS and VM combinations.</p>
<h4>Low-Memory Linux</h4>
<p>Something I haven&#8217;t seen many other people do is RAC with a very small memory configuration.  Like 760M of memory per server.  (!)  Of course you&#8217;d only do this for a hobby setup &#8211; never on a system where you want any kind of support.  But I&#8217;m kinda cheap&#8230; and running RAC on these small VMs means that I don&#8217;t have to go buy an expensive new home computer.  My current gateway laptop with Vista Home does the job quite nicely!</p>
<p>10.2 and 11.1 RAC will install and run on servers with 760M of memory.  But things were a little unstable at first.  Now I&#8217;m the curious type&#8230; I like to fiddle with things&#8230; so I investigated a little bit.</p>
<h4>Basic Unix Investigation</h4>
<p>There are two basic investigation scenarios:</p>
<table>
<tr>
<td>what happened in the past</td>
<td>My main tool is <strong>sar</strong> (System Activity Reporter).  Or <a href="http://sourceforge.net/projects/ksar/">Java-based ksar</a> on my desktop &#8211; it gets data via ssh and graphs it.</td>
</tr>
<tr>
<td>what is happening now</td>
<td>My starting point is <strong>vmstat</strong> and <strong>top</strong>.  To dig a little deeper, I might then use other tools like <strong>ps</strong>, <strong>free</strong>, <strong>iostat</strong> or <strong>netstat</strong>.</td>
</tr>
</table>
<p>In this particular case, I noticed pretty quickly from the <strong>top</strong> utility that one process was consuming over 30% of the system&#8217;s memory!  <span id="more-987"></span><em>(Note: in <strong>top</strong>, you can press the &#8216;&lt;&#8217; and &#8216;&gt;&#8217; keys to move the sort column left and right.  The initial sort column is %CPU.  I moved it one column to the right, sorting by %MEM.)</em></p>
<pre><code>top - 18:41:13 up  5:28,  3 users,  load average: 0.04, 0.35, 0.60
Tasks: 180 total,   2 running, 178 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  3.7%sy,  0.0%ni, 89.4%id,  6.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    767020k total,   754296k used,    12724k free,     7084k buffers
Swap:  1540088k total,   654696k used,   885392k free,   361800k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
<span style='background-color:#DFDFDF'>17435 oracle    RT   0  230m 229m  31m S  0.3 30.6   0:26.21 /u01/crs/oracle/product/11.1.0/crs/bin/ocssd.bin</span>
 7765 oracle    15   0  464m 111m 102m S  0.0 14.9   0:04.52 ora_smon_RAC1
 7743 oracle    -2   0  445m  90m  83m S  0.0 12.1   0:12.01 ora_lms0_RAC1
 7783 oracle    15   0  440m  70m  66m S  0.0  9.4   0:05.35 ora_mmon_RAC1
20321 oracle    15   0  438m  48m  45m S  0.0  6.5   0:00.88 oracleRAC1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
 8676 oracle    16   0  437m  46m  45m S  0.0  6.2   0:02.69 oracleRAC1 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
 8801 oracle    15   0  440m  44m  41m S  0.0  6.0   0:04.57 ora_cjq0_RAC1</code></pre>
<p>This process (ocssd) is Oracle&#8217;s <em>Cluster Synchronization Services</em> Daemon.  It&#8217;s the process that sends and receives heartbeats from other nodes.  Any delays sending or receiving those heartbeats can cause node evictions (a.k.a. server reboots) &#8211; so it&#8217;s a pretty important process!  That&#8217;s why it runs with realtime (RT) scheduling priority, as you can see in the above output from <strong>top</strong>.</p>
<p>I was surprised that CSS uses so much physical memory &#8211; usually Linux is very good at memory management.  In <strong>top</strong>, the VIRT column shows how much total memory each process is using, while the RES column shows how much actual physical memory Linux has allocated to it.  It&#8217;s clear that Linux is pretty actively managing the physical memory for other processes.</p>
<p>A quick glance at <strong>vmstat</strong> shows that although we are actively swapping, it seems under control.  This is about what I&#8217;d expect when we&#8217;re idle and all of the processes except CSS are sharing only 500M of memory:</p>
<pre><code>collabn1:/home/oracle[RAC1]$ vmstat 5
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 604144  14024  34948 300632    0    0    32    86 1044 1797  1  8 84  7  0
 2  1 603912  11224  34968 303968   87    0   763    81 1083 1902  3 11 56 30  0
 0  0 604840  12660  34912 303904   25    0   253    38 1050 1975  2 11 69 18  0
 0  0 604840  12728  34924 303900    0    0    68   106 1043 1975  1  9 82  8  0
 0  0 604784  14536  34936 304140   19    0    89    71 1043 2042  1  5 81 13  0
 1  0 604752  14168  34944 304496    6    0   119    21 1040 2016  2  8 80 11  0
 0  1 604736  18732  35020 306212    0    0   384    73 1050 2489  1 10 70 19  0
 1  1 604736  11144  35232 311252  104    0  1209   128 1074 2024  2 12 38 47  0
 3  1 607900   8056  30788 307352   77 1500   504  1661 1055 2642  9 16 56 19  0
 0  0 607900   9836  30800 307360    0    0    71    70 1031 1798  1  6 85  8  0
 1  0 607884  10536  30812 307400    8    0    44    93 1031 1832  1  4 87  8  0</code></pre>
<p>The SO column tells us when memory is written to disk (and removed from physical).  The SI column tells us when memory is read from disk (and put back in physical).  On a side note, remember that on a healthy Unix system the free memory is always small.  Sometimes this is confusing at first.</p>
<h4>Linux Process Memory Investigation</h4>
<p>Nonetheless, I&#8217;m not happy that CSS is using 30% of my physical memory in this highly-constrained hobby environment.  Why is Linux allowing this?  The first clue comes simply from the output of the familiar unix <strong>ps</strong> utility:</p>
<pre><code>collabn1:/home/oracle[RAC1]$ ps v -C ocssd.bin
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
17435 ?        SLl    0:08      7   588 235331 234840 30.6 /u01/crs/oracle/product/11.1.0/crs/bin/ocssd.bin</code></pre>
<p>On Linux, the &#8220;v&#8221; flag tells ps to give information relevant to virtual memory.  TRS and DRS tell me how much physical (resident) memory is used for machine executable code (text) and data, respectively.  But more importantly &#8211; the STAT column gives some informative BSD-style flags about the process.  That capital-L indicates that CSS has some pages that are locked into physical memory.  Bingo.</p>
<p>If I have root access, then I can get a very detailed report on process memory usage with the <strong>pmap</strong> command.  The output was a little long, so I&#8217;ve abbreviated it here:</p>
<pre><code>[root@collabn1 ~]# pmap -x 17435
17435:   /u01/crs/oracle/product/11.1.0/crs/bin/ocssd.bin
Address   Kbytes     RSS    Anon  Locked Mode   Mapping
00110000     656       -       -       - r-x--  libhasgen11.so
001b4000       8       -       -       - rwx--  libhasgen11.so
<span style='background-color:#DFDFDF'>  ... 37 more library blocks</span>
02a0d000     100       -       -       - rwx--    [ anon ]
02a26000       4       -       -       - --x--    [ anon ]
02a27000   10240       -       -       - rwx--    [ anon ]
03427000       4       -       -       - --x--    [ anon ]
03428000   10240       -       -       - rwx--    [ anon ]
<span style='background-color:#DFDFDF'>  ... 10 more anonymous blocks, half are 10240K</span>
08048000     592       -       -       - r-x--  ocssd.bin
080dc000       4       -       -       - rwx--  ocssd.bin
<span style='background-color:#DFDFDF'>  ... 30 more anonymous blocks, half are 10240K</span>
bfe40000     148       -       -       - rwx--    [ stack ]
bfe65000       8       -       -       - rw---    [ anon ]
-------- ------- ------- ------- -------
total kB  235920       -       -       -</code></pre>
<p>Interestingly, the linux <strong>pmap</strong> utility does not indicate any locked memory!  I don&#8217;t know whether that output column is non-functional or if it refers only to some particular kind of locking.  But at any rate, I know <em>something</em> is locked.  I couldn&#8217;t think of anything better, so the next place I looked was in the Linux /proc pseudo-filesystem.</p>
<pre><code>collabn1:/home/oracle[RAC1]$ grep Vm /proc/17435/status
VmPeak:   235924 kB
VmSize:   235920 kB
<span style='background-color:#DFDFDF'>VmLck:    235920 kB</span>
VmHWM:    234844 kB
VmRSS:    234840 kB
VmData:   202272 kB
VmStk:       156 kB
VmExe:       592 kB
VmLib:     31960 kB
VmPTE:       268 kB</code></pre>
<p>Now we&#8217;re talking. The process has a total of 235920 kB of memory &#8211; and it&#8217;s <em>ALL</em> locked.  On a normal RAC system you&#8217;d want this. Generally, important realtime processes should be locked so that they are never delayed by paging or swapping.  (Remember how that could cause node reboots?)</p>
<p>But I personally doubt that all of the memory really NEEDS to be locked, and I think that Linux will actually do a decent job of not swapping the most important parts.  And my highly constrained hobby environment will probably run much smoother if Linux has more flexibility when managing a measly 760M of memory.</p>
<h4>Unlocking Linux Process Memory</h4>
<p>But is it actually possible to unlock the process memory?  As far as I know, Oracle provides no option to disable CSS memory locking.  (For good reason.)  There is the <a href="http://linux.die.net/man/2/munlockall">system call munlockall()</a> &#8211; which unlocks all of a particular processes&#8217; memory.  But the CSS process itself would have to call this function.  And of course it will not.  Or will it?</p>
<p>If you&#8217;ve got root, then there&#8217;s a hacker-back-door way of doing this.  Remember, you&#8217;d be crazy to try this anywhere besides a dark closet at home.  And if you type too slow then CSS could reboot your machine.  </p>
<p>But watch this&#8230;</p>
<pre><code>[root@collabn1 ~]# grep Vm /proc/17435/status
VmPeak:   235924 kB
VmSize:   235920 kB
VmLck:    235920 kB
VmHWM:    234844 kB
VmRSS:    234840 kB
VmData:   202272 kB
VmStk:       156 kB
VmExe:       592 kB
VmLib:     31960 kB
VmPTE:       268 kB

[root@collabn1 ~]# gdb -p 17435 &lt;&lt;EOF
&gt; call munlockall()
&gt; quit
&gt; EOF

GNU gdb Fedora (6.8-27.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
Attaching to process 17435
Reading symbols from /u01/crs/oracle/product/11.1.0/crs/bin/ocssd.bin...done.
<span style='background-color:#DFDFDF'>  ... 17 more Reading/Loading symbols.</span>
[Thread debugging using libthread_db enabled]
[New Thread 0xb7f629f0 (LWP 17435)]
<span style='background-color:#DFDFDF'>  ... 19 more New Threads.</span>
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libnsl.so.1...done.
<span style='background-color:#DFDFDF'>  ... 13 more Loaded/Reading symbols.</span>
0x008e7402 in __kernel_vsyscall ()
(gdb) $1 = 0
(gdb) The program is running.  Quit anyway (and detach it)? (y or n) [answered Y; input not from terminal]
Detaching from program: /u01/crs/oracle/product/11.1.0/crs/bin/ocssd.bin, process 17435

[root@collabn1 ~]# grep Vm /proc/17435/status
VmPeak:   235924 kB
VmSize:   235920 kB
VmLck:         0 kB
VmHWM:    234844 kB
VmRSS:    234840 kB
VmData:   202272 kB
VmStk:       156 kB
VmExe:       592 kB
VmLib:     31960 kB
VmPTE:       268 kB</code></pre>
<p>Ha. This is something you won&#8217;t find on metalink. After generating some activity on the system, the <strong>top</strong> utility shows me that Linux has significantly reduced the physical memory used by CSS.</p>
<p>These days I&#8217;ve actually scripted this for my home and classroom VM environments.  I haven&#8217;t done a careful comparison or analysis, but it really has seemed to me that my low-memory Linux systems run noticeably smoother.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2010/09/02/rac-investigation-on-low-memory-linux/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>DBCA Missing – Oracle 11.2 ASM/Grid</title>
		<link>http://www.ardentperf.com/2010/08/16/dbca-missing-oracle-11-2-asmgrid/</link>
		<comments>http://www.ardentperf.com/2010/08/16/dbca-missing-oracle-11-2-asmgrid/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 21:54:04 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=969</guid>
		<description><![CDATA[Oracle provides three ways to manage ASM: (1) through SQL, (2) through the web-based database console or grid control, and (3) through the server-based java GUI tool DBCA.  These are your choices for adding storage, replacing a disk, growing a volume, etc. But if you&#8217;re an experienced DBA who recently started playing with 11gR2 ASM, [...]]]></description>
			<content:encoded><![CDATA[<p>Oracle provides three ways to manage ASM: (1) through SQL, (2) through the web-based database console or grid control, and (3) through the server-based java GUI tool DBCA.  These are your choices for adding storage, replacing a disk, growing a volume, etc. But if you&#8217;re an experienced DBA who recently started playing with 11gR2 ASM, you may have been surprised to find that DBCA is missing from the ASM/grid installation!</p>
<p>DBCA is not missing by mistake &#8211; this is a change in Oracle 11g Release 2.  There is a new server-based java GUI tool for ASM management: <strong>ASMCA</strong>.</p>
<h4>A Few ASM-related 11gR2 Changes</h4>
<p>You might remember that there haven&#8217;t been <em>major</em> changes in Oracle clustering since version 10gR1 &#8211; when Oracle introduced their Clusterware package. But 11gR2 brings big changes and big new features to database clustering.</p>
<p>Here are a few that I found very noticeable when installing a cluster:</p>
<div id="attachment_972" class="wp-caption alignright" style="width: 160px"><a href="http://www.ardentperf.com/wp-content/uploads/2010/08/asmca.png"><img class="size-thumbnail wp-image-972" title="ASMCA" src="http://www.ardentperf.com/wp-content/uploads/2010/08/asmca-150x150.png" alt="" width="150" height="150" /></a><p class="wp-caption-text">New Tool: ASMCA</p></div>
<ul>
<li>You can&#8217;t defer storage configuration until after CRS installation.  Furthermore, raw/block storage is no longer supported.  Before you begin the CRS install you must either (1) install and configure a Cluster Filesystem or (2) prepare storage for ASM.</li>
<li>The CRS install includes ASM.  This means that the bare-minimum space requirements are higher by about 3 or 4 GB.  (I used to run ASM and DB from a single home for VMware test/educational environments.)</li>
<li>You can&#8217;t do any ASM operations when connected as sysdba!  A new role called &#8220;sysasm&#8221; was introduced in 11gR1&#8230; it&#8217;s now the <em>only</em> way to manage ASM.  Connect / as sysasm.</li>
<li>There&#8217;s a new tool called ASMCA to manage ASM.  DBCA isn&#8217;t even installed in the ASM/Grid home.  This tool is pretty slick &#8211; it also manages the new ASM dynamic volumes and ASM cluster filesystems.</li>
</ul>
<p>I noticed that there wasn&#8217;t much on google about ASM and DBCA.  Hopefully this will save you a few minutes of head-scratching if you&#8217;re trying out 11g Release 2 for the first time.  Happy testing!<img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/pixy.gif?x-id=56f324d1-9afc-4786-b39b-eef795e6308e" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2010/08/16/dbca-missing-oracle-11-2-asmgrid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Michigan OakTable &#8211; Illinois Visitors?</title>
		<link>http://www.ardentperf.com/2010/07/29/michigan-oaktable-illinois-visitors/</link>
		<comments>http://www.ardentperf.com/2010/07/29/michigan-oaktable-illinois-visitors/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 15:39:28 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=879</guid>
		<description><![CDATA[Quite a few people have already plugged this event (Charles Hooper, Jonathan Lewis, Tanel Poder, Doug Burns, Christian Antognini, Randolf Geist, etc) &#8211; but I want to chime in anyway.  It&#8217;s so closeby and the price goes up in two days! The Thursday and Friday before OpenWorld (September 16-17), some kind folks in Michigan are [...]]]></description>
			<content:encoded><![CDATA[<p>Quite a few people have already plugged this event (<a href="http://hoopercharles.wordpress.com/2010/01/08/the-oaktable-network-invades-michigan-usa-advert/">Charles Hooper</a>, <a href="http://jonathanlewis.wordpress.com/2010/07/15/advert-odtug/">Jonathan Lewis</a>, <a href="http://blog.tanelpoder.com/2010/02/11/future-appearances-conferences-and-seminars/">Tanel Poder</a>, <a href="http://www.oracledoug.com/serendipity/index.php?/archives/1566-Advert-Michigan-Oak-Table-Symposium-registration-open.html">Doug Burns</a>, <a href="http://antognini.ch/2010/04/michigan-oaktable-symposium-2010/">Christian Antognini</a>, <a href="http://oracle-randolf.blogspot.com/2010/04/michigan-oaktable-symposium-mots-2010.html">Randolf Geist</a>, etc) &#8211; but I want to chime in anyway.  It&#8217;s <a href="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=FbGUfgId_JDG-inty_TQPCwOiDEAwMAJrabgrw%3BFZgAhQIdB3AC-ykzH0PUDbA8iDHitciGRvkJ2w&amp;q=chicago+to+ann+arbor&amp;sll=41.997718,-87.689879&amp;sspn=0.008005,0.01929&amp;ie=UTF8&amp;z=8&amp;saddr=chicago&amp;daddr=ann+arbor">so closeby</a> and the price goes up in two days!</p>
<p>The Thursday and Friday before OpenWorld (September 16-17), some kind folks in Michigan are bringing many of the best and brightest minds (see them <a href="http://michiganoaktable.intuitwebsites.com/about.html">here</a> and <a href="https://www.speak-tech.com/seminars/seminar_detail.php?SeminarID=84">here</a>) to the Midwest to share their experience.  It&#8217;s like attending the best sessions from San Francisco &#8211; for less than a third of the cost.  The event is being called the <a href="http://michiganoaktable.intuitwebsites.com/">Michigan OakTable Symposium</a> or MOTS.</p>
<p>If anyone lives around the midwest and won&#8217;t be at OpenWorld, then I think this would be especially good.  It&#8217;s only a two day event!  But of course I&#8217;m sure there&#8217;ll also be folks who go to the Michigan Symposium and still catch a last-minute flight to San Francisco&#8230;</p>
<p>I&#8217;ve always been very enthusiastic about local user groups and independent talent, so this is really my kind of event.  I&#8217;m pretty sure that any enthusiasm you hear will be based solely on proven real-world usefulness &#8211; with no influence from sales commissions (direct or indirect).  It&#8217;ll probably be just as much relational as it is technical.  You can bring an especially hard problem that you can&#8217;t solve &#8211; maybe someone will have a useful tip or new approach.  But taking home an &#8220;answer&#8221; is insignificant compared with taking home a better problem-solving process.  If I were you, I&#8217;d come to <a href="http://michiganoaktable.intuitwebsites.com/Abstracts.html">these sessions</a> looking for that.</p>
<p>Anyone in Illinois who is heading over for this?  I think it would be worth the drive (only 4 hours from Chicago).  Maybe we could even arrange for Illinois folks to hang out together at some point.</p>
<p>Reminder &#8211; seating is limited and prices go up Sunday.  If you are interested, then you might want to try for management sign-off and event registration by tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2010/07/29/michigan-oaktable-illinois-visitors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASM Mirroring &#8211; No Hot Spare Disk</title>
		<link>http://www.ardentperf.com/2010/07/15/asm-mirroring-no-hot-spare-disk/</link>
		<comments>http://www.ardentperf.com/2010/07/15/asm-mirroring-no-hot-spare-disk/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 23:36:49 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=690</guid>
		<description><![CDATA[Some time ago, we installed Oracle on a Sun box with 48 local 1TB disks (spread across six controllers). I explained to the storage and system teams that we would use ASM as the volume manager &#8211; and as such, it would take care of mirroring. One storage admin asked me which disk was the [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, we installed Oracle on <a href="http://www.oracle.com/us/products/servers-storage/servers/x86/031210.htm">a Sun box with 48 local 1TB disks (spread across six controllers)</a>.  I explained to the storage and system teams that we would use ASM as the volume manager &#8211; and as such, it would take care of mirroring.  One storage admin asked me which disk was the hot spare. I replied that there was no hot spare.</p>
<p>What?!!  You call this a volume manager and it doesn&#8217;t support a hot spare disk?!  That&#8217;s it, we&#8217;re going back to filesystems!</p>
<p>Not so fast.</p>
<p>You&#8217;ll remember that the purpose of a hot spare disk is to restore protection in the event of a disk failure.  When the RAID controller or volume manager detects a failed disk (R.I.P.), it uses the spare and reproduces a copy of the complete now-missing disk (R.I.P.) by reading the mirror or parity data.</p>
<h4>Restoring Protection Without A Hot Spare Disk</h4>
<p>In fact, ASM does even better.  Instead of a <em>hot spare disk</em>, it has <strong>hot spare capacity</strong> &#8211; spread across all of the disks.  There are two immediate effects of this: (1) no loss of potential performance from a usable disk head sitting idle and (2) the hot spare capacity is available for an emergency situation (like the archivelog volume filling up).</p>
<p>How is this possible?  The key of course is understanding how ASM mirrors data &#8211; by <em>extent</em> rather than <em>disk</em>. <span id="more-690"></span>So if I allocate three extents on disk 1, the first could be mirrored on disk 10, the second on disk 11 and the third on disk 12. </p>
<p>Now if disk 1 fails, I don&#8217;t need to rebuild the disk &#8211; I only need to ensure that each extent is mirrored. For example: lets copy the first extent to disk 11, the second to disk 12, and the third to disk 10.  Once everything has two copies, my data is protected &#8211; even though the first disk was never rebuilt!</p>
<p>You&#8217;ll also notice that the I/O for the rebuild operation is spread across all of the disks.  Faster and better.</p>
<p>So there actually is a &#8220;hot spare&#8221; of sorts &#8211; spare capacity instead of a spare disk. And unlike RAID, this hot spare isn&#8217;t optional: ASM will <em>always</em> reserve enough spare capacity to bring the diskgroup back to its proper level of redundancy after a failure.</p>
<h4>Failure Groups Mean A Little Less Usable Space</h4>
<p>WAIT WAIT WAIT!!  I know you&#8217;re excited, but before you press enter and execute that migration script, I need to tell you about one more very important detail.  How does ASM know that amount of spare capacity to reserve?  The size of the largest disk, right?  NO!!!</p>
<p>This is, in fact, what <strong>failure groups</strong> are for!!  (You always wondered, right?!)  Because ASM doesn&#8217;t mirror across <em>disks</em> &#8211; it mirrors across <em>failure groups</em>.  And accordingly, ASM will always reserve enough spare capacity to restore protection after losing the largest failure group.</p>
<p>Now it&#8217;s important to understand how ASM will report this.  Lets look quickly at asmcmd&#8217;s <strong>lsdg</strong> command.  This command (11gR1) gives us four important numbers: Total_MB, Free_MB, Req_mir_free_MB and Usable_file_MB.  The <a href="http://download.oracle.com/docs/cd/E11882_01/server.112/e10500/asm_util004.htm#BABJBAEG">11gR2 Storage Administrator&#8217;s Guide</a> gives good descriptions of the output:</p>
<table>
<tr>
<td>
Total_MB
</td>
<td>
Size of the disk group in megabytes.
</td>
</tr>
<tr>
<td>
Free_MB
</td>
<td>
Free space in the disk group in megabytes, <strong>without regard to redundancy</strong>. From the V$ASM_DISKGROUP view.
</td>
</tr>
<tr>
<td>
Req_mir_free_MB
</td>
<td>
Amount of space that must be available in the disk group to restore full redundancy after the most severe failure that can be tolerated by the disk group. This is the REQUIRED_MIRROR_FREE_MB column from the V$ASM_DISKGROUP view.
</td>
</tr>
<tr>
<td>
Usable_file_MB
</td>
<td>
Amount of free space, <strong>adjusted for mirroring</strong>, that is available for new files. From the V$ASM_DISKGROUP view.
</td>
</tr>
</table>
<p>Putting it all together, we see that Req_mir_free_MB should be equal to the largest failure group.  Secondly, Usable_file_MB is the most important number &#8212; that&#8217;s how much space we can <em>actually</em> use.  And with normal (2-way) mirroring, it should always be half of the available raw free space.  And available raw free space is total raw free space minus Req_mir_free_MB.</p>
<h4>Example</h4>
<p>So let&#8217;s see if we can observe this on a system in the wild.  We&#8217;ll revisit one that I <a href="http://www.ardentperf.com/2009/03/12/asm-space-calculations-and-hot-spares/">briefly described last year</a>.</p>
<p>The system had 46 local disks (500M each).  The disks were attached to six controllers: two controllers had six disks each, the other four controllers had eight disks each.  We configured ASM so that each controller is a failure group.</p>
<p>First lets get the output of lsdg, which we&#8217;ll verify step-by-step:</p>
<pre><code>ASMCMD&gt; lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB   Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name
MOUNTED  NORMAL  N         512   4096  1048576  18041706  18041326          3137688         7451819              0  DATA01/</code></pre>
<p>Now &#8211; to begin our verification &#8211; lets look at the exact size of a single disk:</p>
<pre><code># sfdisk -suM /dev/sdav1
401624968</code></pre>
<p>The Linux kernel is reporting KB and we need MB &#8211; so we&#8217;ll divide by 1024.</p>
<p>401624968 /1024 = 392211.8828125 M</p>
<p>ASM uses &#8220;allocation units&#8221; of 1M and can&#8217;t use a partial AU &#8211; so we truncate that to 392211.  Now there were 46 disks &#8211; so the total amount of space available should be 392211 * 46 = 18041706.  And this perfectly matches Total_MB from the lsdg output!  So far, so good!</p>
<p>Next, lets look at the largest failure group.  The four large failure groups were each the same size with eight disks: 392211 * 8 = 3137688.  This perfectly matches Req_mir_free_MB from the lsdg output!  Lovely!</p>
<p>Finally, lets see how much space I can actually use for datafiles and such &#8211; accounting for mirroring.  The available raw free space should be Total_MB minus our calculated Req_mir_free_MB: 18041326 &#8211; 3137688 = 14903638.  I&#8217;m using normal mirroring, so my available/usable free space should be half of that: 14903638 / 2 = 7451819.  Perfectly matches Usable_file_MB from the lsdg output.  Wow.</p>
<h4>The Big Caveat</h4>
<p>Sounds amazing, right?  Well there is one very important caveat.  I alluded to it earlier: Oracle will allow you to use this reserved &#8220;hot spare&#8221; capacity.  This is very different from a traditional &#8220;hot spare&#8221; disk.  What happens if you use the space?  (1) The &#8220;usable free space&#8221; <a href="http://www.ardentperf.com/2009/03/17/asm-negative-free-space/">reports a negative number</a>!!!  (2) If a disk fails, then you will not lose any data &#8211; but ASM cannot automatically restore protection until you replace the disk or give ASM additional storage somewhere else.</p>
<p>That sound serious!  What&#8217;s worse, you can get into this situation without even realizing it.  If you create a datafile that&#8217;s bigger than the available space then ASM won&#8217;t warn you &#8211; it will just create the datafile and you lose your protection from double-failure.</p>
<p>You get alerts when your traditional filesystems are filling up.  (How many times has your inbox been flooded because of those stupid archivelogs?!)  If you deploy ASM, then MAKE SURE YOU HAVE ADEQUATE ALERTING.  Oracle&#8217;s management tools can help out, and there are other solutions too.  Don&#8217;t overlook it!</p>
<h4>Conclusion</h4>
<p>At this point, it should be evident that anyone with storage background needs to be careful around ASM.  It doesn&#8217;t work the same as a traditional volume manager or RAID controller.  Oracle Corp really does love SUPER EXCITING NEW WORDS (aka marketing buzz)&#8230; but this one isn&#8217;t just a matter of terminology. There is some real difference in the underlying concepts.</p>
<p>A few key takeaways:</p>
<ul>
<li>
<p>To automatically restore protection after a failure, ASM reserves spare capacity instead of a spare disk.</p>
</li>
<li>
<p>In V$ASM_DISKGROUP and asmcmd&#8217;s lsdg command, Total_MB and Free_MB report <strong>raw</strong> capacity while Usable_file_MB reports <strong>usable</strong> capacity based on the default mirroring level.*</p>
</li>
<li>
<p>ASM will allow you to use the spare capacity, after which it will report negative free space and won&#8217;t tolerate a double-failure.  Make sure you have adequate reporting so that this is always caught and addressed quickly.</p>
</li>
</ul>
<p><small>*Note: Various objects can have different mirroring levels in ASM.</small></p>
<p>Well I think that this should serve as a good primer on ASM and mirroring.  Let me know if I&#8217;ve left anything out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2010/07/15/asm-mirroring-no-hot-spare-disk/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Five Reasons to do RAC Attack at Collaborate</title>
		<link>http://www.ardentperf.com/2009/04/06/five-reasons-to-do-rac-attack-at-collaborate/</link>
		<comments>http://www.ardentperf.com/2009/04/06/five-reasons-to-do-rac-attack-at-collaborate/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:17:34 +0000</pubDate>
		<dc:creator>Jeremy Schneider</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://www.ardentperf.com/?p=738</guid>
		<description><![CDATA[Last week Dan broke the news that we&#8217;re bringing RAC Attack back to Collaborate! We&#8217;ve run this workshop several times now: it&#8217;s gotten better every time and we&#8217;ve always received overwhelmingly positive feedback. This is going to be a great workshop in Orlando that you don&#8217;t want to miss! A Short History We first ran [...]]]></description>
			<content:encoded><![CDATA[<p>Last week <a href="http://www.dannorris.com/2009/03/30/adv-rac-attack-hands-on-event-at-collaborate09/">Dan broke the news that we&#8217;re bringing RAC Attack back to Collaborate</a>! We&#8217;ve run this workshop several times now: it&#8217;s gotten better every time and we&#8217;ve always received overwhelmingly positive feedback. This is going to be a great workshop in Orlando that you don&#8217;t want to miss!</p>
<h4>A Short History</h4>
<p>We first ran the RAC Attack <a href="http://iougew.prod.web.sba.com/displaymod/SearchEvents.cfm?code=739&#038;detail=1&#038;conference_id=52&#038;searchType=8">last year at Collaborate in Denver</a>. On the first day of Collaborate we heard that one of the computer labs was going to be sitting empty for several hours on Wednesday. Being such a fervent believer in hands-on learning, this sounded like a terrible waste!  So at the last minute we arranged to deliver the RAC Attack hands-on lab <a href="http://iougew.prod.web.sba.com/displaymod/SearchEvents.cfm?code=739&#038;detail=1&#038;conference_id=52&#038;searchType=8">during the open slot</a>.  If I remember right, we had something like 20 people and everyone seemed to really come away having learned something new. The lab focused on getting a running system.</p>
<p>In August when we ran <a href="http://www.ioug.org/networking/SIGs/RACAttackInformation.cfm">RAC Attack as a standalone workshop in Chicago</a>. In addition to having several excellent speakers, we dramatically expanded the scope of the lab to include topics like backup &#038; recovery, services, and clusterware. During the full day allocated, only a few people completed every possible exercise.</p>
<h4>Five Reasons To Sign Up</h4>
<p>This year <a href="http://www.ioug.org/collaborate09/attending/university.cfm#u18">at Collaborate we&#8217;re doing it again</a>. The lab will again be expanded and improved when we bring it to Orlando. Furthermore, <strong>I&#8217;m taking requests</strong> &#8211; if there&#8217;s a topic you&#8217;d like to learn about then leave a comment and I&#8217;ll try to get it included!  I&#8217;m not sure how quickly the session will fill, but I know that there are a limited number of seats &#8211; so you should sign up soon.</p>
<p>Here are five reasons I think you should come:</p>
<ol>
<li>
<p>Get exposure to and practice on all of the latest software, including VMware Server 2.0.1, Oracle Enterprise Linux (same as RedHat) 5.3, and Oracle RAC 11.1.0.7</p>
</li>
<li>
<p>There are hands-on challenges for every experience level. Meticulous step-by-step guide for beginners (with the choice to skip difficult steps), start-from-scratch or instant running environment for masters.</p>
</li>
<li>
<p>Learn from professionals with years of RAC experience. Several of us will be on-hand to answer questions and assist with the labs. If you have never touched a cluster database then we are here to help you complete the labs and understand what you&#8217;re doing!</p>
</li>
<li>
<p>Choose your own adventure. ASM or OCFS2. Parallel SQL or clusterware callouts. Got something specific you want to learn about? Leave a comment and I&#8217;ll try to get it included.</p>
</li>
<li>
<p>Walk out with a lab binder that tells you how to do it all on your own laptop after you get home. It won&#8217;t be possible to finish all the labs during the timeslot we have at Collaborate, but you can finish them later!</p>
</li>
</ol>
<p>Finances are tight and many companies are cutting training budgets &#8211; but remember that generally speaking, Collaborate is one of the best value opportunities for Oracle training that&#8217;s available in the United States. You have world-class educational sessions and networking opportunities, complimented by top notch deep-dive university seminars such as RAC Attack.  (Well&#8230; I&#8217;m a little biased about this session!)  And with a slightly greater degree of independence you won&#8217;t just hear the corporate messages &#8211; it&#8217;ll be a little easier to find real-life users telling the great, the good, the bad and the ugly.</p>
<p>Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ardentperf.com/2009/04/06/five-reasons-to-do-rac-attack-at-collaborate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
