 

<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
         xmlns:content="http://purl.org/rss/1.0/modules/content/"
         xmlns="http://purl.org/rss/1.0/">


<channel rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot">

    <title>DBAzine.com - Chris Foot's Oracle10g Blog</title>
  <link>http://www.dbazine.com</link>
  <description></description>
  <image rdf:resource="logo.jpg"/>
  <sy:updatePeriod>daily</sy:updatePeriod>
  <sy:updateFrequency>1</sy:updateFrequency>
  <sy:updateBase>2005-01-27T09:49:01Z</sy:updateBase>
  <items>
    <rdf:Seq>
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-05-31.6959101573"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-28.5119185797"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-15.6658230898"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-06.2643727574"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-31.3616747160"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-17.4269055673"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-11.8660796218"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-04.1596857853"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-24.7493837565"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-14.3900730733"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-15.4209681965"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-03.3876734950"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-27.8134820403"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-19.1078911078"/>
          
          
              <rdf:li rdf:resource="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-13.9166686138"/>
          
   </rdf:Seq>
  </items>
</channel>

<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-05-31.6959101573">
<title>Oracle9I and 10G Virtual Indexes</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-05-31.6959101573</link>
<description>Let’s take a look at an Oracle feature that I used quite regularly in 9i OEM to perform “what if” index scenarios during optimization testing. Although 10G Grid Control doesn’t provide the same graphical interface as 9i OEM, we can still utilize this hidden feature in 10G to simplify and accelerate the SQL tuning process</description>
<content:encoded><![CDATA[<font face="Verdana, Arial, Helvetica, sans-serif" size="2"> </font>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Introduction</b><br>
  I would describe myself as a fairly good tuner. Not because tuning ever 
  came easy to me, I have just spent a lot of time working with the optimizer. 
  I still have troubles rewriting complex SQL statements from time to time but 
  I will admit that 20 years of experience makes it easier on me than it used 
  to be.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">One of the areas 
  I am strong at is using the proper indexes to influence SQL statement access 
  paths. We know that an index can influence the optimizer to change an access 
  path from a tablescan to a table lookup using an index ROWID. But indexes can 
  also influence the type of join used as well as the order of the tables being 
  joined. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Let's take a look 
  at the benefits virtual indexes have and we'll finish this blog by reviewing 
  how indexes can affect simple access paths, join methods and join orders.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Virtual Indexes</b><br>
  I use virtual indexes in both 9i and 10G. I like them because I can quickly 
  do &quot;what if&quot; scenarios. I can create the index and present it to the 
  optimizer without waiting for the index to become populated and stored on disk. 
  This feature allows me to reduce the amount of time I spend tuning, which is 
  always a good thing. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I also use virtual 
  indexes when I am training myself and others. Most production environments do 
  have test counterparts, but there are times when I need to teach many different 
  indexing concepts and waiting for indexes to build often becomes a detriment 
  to the learning process.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>9I OEM Virtual 
  Index Wizard</b><br>
  The Virtual Index Wizard feature is provided in the Tuning Pack option of 9I 
  OEM. Although there are a couple of ways to activate the wizard, let's take 
  a look at the one that I most often use. Since we are going to be naviating 
  through the SQL Analyze tool, we might as well review some of the other features 
  it provides.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>SQL Analyze</b><br>
  9I OEM provides the SQL Analyze tool to view access path information. SQL Analyze 
  is only available if you have purchased the tuning pack option for 9I OEM. This 
  <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/5_sql_analyze2.gif">screenshot</a> 
  shows me navigating through 9I OEM's menus to activate SQL Analyze.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">When you activate 
  SQL Analyze, the first step the utility performs is to <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/6_sql_analyze.gif">display 
  a listing</a> of all of the top resource consuming SQL statements that are contained 
  in the library cache. If the statement has been flushed from cache, you won't 
  find it in this display. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The tool lists 
  all of the databases on the left side of the panel that you worked with in the 
  past. As you can see, I am a pretty active user of SQL Analyze. I can double-click 
  on any statement in the top SQL listing to view its access path information. 
  I can also use the menu system at the top of the screen to create a blank worksheet 
  for new queries that I can enter manually. I found the statement I wanted from 
  the listing and double-clicked on it to <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/7_sql_analyze.gif">activate 
  the SQL tuning panel</a>. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The panel displays 
  the SQL statement, and like our other utilities, allows us to step through the 
  access path the query is taking. I can click on the <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/7_sql_analyze.gif">SQL 
  drop down menu</a> at the top of the screen to ask Oracle to explain the statement 
  using the various optimizer modes that are available.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>SQL Analyze 
  Tuning Tools</b><br>
  SQL Analyze provide us with tools that facilitate the SQL tuning process. The 
  <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/9_tools.gif">tools 
  menu</a> at the top of the screen allows me to choose from three different wizards. 
  We'll review the Virtual Index Wizard in just a moment.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> The Hint Wizard 
  allows us to choose hints from a drop-down menu system, while the SQL Tuning 
  Wizard activates an intelligent advisor that provides us with SQL tuning recommendations. 
  Once you have run the SQL Tuning Wizard a few times, it's pretty easy to see 
  that it was the precursor to some of the more advanced utilities that are now 
  available in Oracle 10G.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Virtual Index 
  Wizard</b><br>
  The Virtual Index Wizard allows me to create virtual indexes on tables that 
  my query is accessing. The key word in that last sentence is &quot;virtual&quot;. 
  Oracle does not permanently create the index. The intent of the wizard is to 
  allow users to determine the potential performance impact a new index would 
  have on the statement being analyzed. It is then up to the user to permanently 
  create the index.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If I click on the 
  Virtual Index Wizard menu selection, 9I OEM responds by displaying the <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/10_tuning_wizard.gif">Virtual 
  Index Wizard introduction panel</a>. When I click on next, the wizard displays 
  a panel that allows me to <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/11_tuning_wizard.gif">select 
  the columns for my virtual index</a>. Clicking next again <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/12_tuning_wizard.gif">displays 
  a panel</a> that allows me to attempt to force Oracle to use the new index or 
  allow it to choose the new index on its own. My personal preference is to allow 
  Oracle to choose the index on its own without providing any additional prodding. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Clicking Next again 
  displays the <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716/13_tuning_wizard.gif">projected 
  cost improvement</a> the new index will have on the statement being analyzed. 
  I used a full table scan on a rather large table as an example. Based on the 
  display, we can be pretty sure that the new index will have a positive affect 
  on our statement's performance. The last panel also displays a button that allows 
  us to view the before and after access paths.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The Virtual Index 
  Wizard does a fairly good job of estimating the impact that new indexes will 
  have on a SQL statement. It is an excellent tool to use when you are starting 
  your tuning education as well as evaluating access paths in Oracle 9I databases. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I was surprised 
  when I found that this feature was not contained in 10G Grid Control. I continue 
  to firmly believe that using a tool to quickly build a virtual index, determine 
  if the optimizer will use it and then display a prediction of the index's performance 
  boost (or degradation) is very beneficial to the tuning process. I used the 
  virtual index wizard dozens of times and will continue to use it when I tune 
  9I (and earlier) databases. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Virtual Indexes 
  in Oracle10G</b><br>
  Although Grid Control doesn't provide the same graphical interface to create 
  virtual indexes as it did in 9I OEM, all is not lost. We can revert to the tried-and-true 
  SQL*PLUS command line to build virtual indexes using the &quot;NOSEGMENT&quot; 
  option. The only feature it won't provide us is the forecast of the statement's 
  performance.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The format of this 
  blog page doesn't provide me with enough space to show you the output from my 
  SQL*PLUS demo. Not without a whole lot of editing anyway. So, I decided that 
  the best option would be to create a separate HTML page for the 10G virtual 
  index demo output. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The demo will show 
  you:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">How to create 
    virtual indexes in 10G</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">How to configure 
    your session to allow the optimizer to choose a virtual index as an access 
    path</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The affect the 
    &quot;_use_nosegment_indexes&quot; parameter has on access path selection</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The error messages 
    returned if you attempt to manipulate virtual indexes</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Information 
    stored in the data dictionary pertaining to virtual indexes</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's a <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-05-31.6959101573/10g_virtual_index_demo2.html">link 
  to the 10G SQL*PLUS Virtual Index demo</a>!</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Now that we understand 
  how to create virtual indexes, lets' take a look at how any index can influence 
  simple access paths, join methods and join orders.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Index Affects 
  on Access Paths</b><br>
  Let's use a nested loop join as a quick and somewhat easy example. In a nested 
  loop join, one of the tables in the join is known as the outer table while the other table (the table being probed) is known as the inner table. 
  Oracle reads a row from the outer table and uses the columns in the join condition 
  to probe the inner table. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Take a look at 
  the SQL statement and graphical access path display below:</font></p>
<blockquote>
  <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">select a.employee_id, 
    a.last_name, b.department_id, b.department_name,<br>
    c.street_address, c.postal_code, c.city, c.state_province<br>
    from hr.employees a, hr.departments b, hr.locations c<br>
    where a.department_id=b.department_id <br>
    and b.location_id=c.location_id<br>
    and a.employee_id = 174<br>
    order by a.last_name;</font></p>
</blockquote>
<p align="left"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"><img src="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-05-31.6959101573/pic.gif"><br>
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We are joining 
  three tables together HR.EMPLOYEES, HR.DEPARTMENTS and HR.LOCATIONS. Notice 
  that we have two different nested loop join operations. Oracle only joins two 
  tables together at a time. It then creates an intermediate result set and uses 
  that result set to join to the next table. It can use any type of join method 
  available for any of the join operations.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  The indexes we have available to us are:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">EMP_EMP_ID_PK 
    - index on the EMPLOYEE_ID column of the HR.EMPLOYEES table</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">DEPT_ID_PK - 
    index on the DEPARTMENT_ID column of the HR.DEPARTMENTS table</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">LOC_ID_PK - 
    index on the LOCATION_ID of the HR. LOCATIONS table</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The optimizer has 
  chosen to join the HR.EMPLOYEES AND HR.DEPARTMENTS tables first using the nested 
  loop join method. It is on this join condition - A.DEPARTMENT_ID = B.DEPARTMENT_ID. 
  HR.EMPLOYEES is known as the outer table and HR.DEPARTMENTS is classified as 
  the inner table of the join</font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The optimizer looked 
  at the local predicate &quot;A.EMPLOYEE_ID=174&quot; and checked to see if there 
  was an index that it could use to improve data access performance. It found 
  the EMP_EMP_ID_PK index that is defined on the EMPLOYEE_ID column. It will access 
  the index first and retrieve the ROWID for the row that has an EMPLOYEE_ID of 
  174. It will use the ROWID to probe the HR.EMPLOYEES table.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">As stated previously, 
  the optimizer has chosen the nested loop join operation. It will access the 
  HR.EMPLOYEES table using the EMP_EMPID_PK index, retrieve the value for DEPARTMENT_ID 
  and use it to probe the HR.DEPARTMENTS table looking for a match (A.DEPARTMENT_ID 
  = B.DEPARTMENT_ID). If it finds a DEPARTMENT_ID value in the HR.DEPARTMENTS table 
  that matches, Oracle will use that row in future operations. If it does not 
  match, Oracle will discard it.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Notice that the 
  optimizer has chosen to use the DEPT_ID_PK index that is built on the HR.DEPARTMENTS' 
  DEPARTMENT_ID column. Since we are probing this table using the values we found 
  for DEPARTMENT_ID from the HR.EMPLOYEES table, Oracle will use the index on the 
  HR.DEPARTMENTS' DEPARTMENT_ID column. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The B.LOCATION_ID 
  = C.LOCATION_ID is the join condition that is used in the second join operation. 
  The intermediate result set is used as the outer table and the HR.LOCATIONS 
  table is used as the inner table. The same type of probe occurs. Since we are 
  looking for matches using the LOCATION_ID contained in the intermediate result 
  set, the optimizer will choose the LOC_ID_PK index.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's how indexes 
  can influence the type of join used and the order of the tables being joined:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If we didn't 
    have indexes on either of the first two tables being joined, the optimizer 
    would most likely have used a hash operation instead of a nested loop join 
    to join the tables together. The optimizer knows that the hash join operation 
    is best used for joins that return larger result sets. It could also have 
    influenced the join order of the tables. In the example, the optimizer could 
    have chosen to join the HR.DEPARTMENTS table to the HR.LOCATIONS table first. 
    It would have then used the intermediate result set created to probe the HR.EMPLOYEES 
    table.</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The more indexed 
    columns we have on a table, the greater the chance that the optimizer will 
    use it as the outer table of the nested loop join. It can filter out more 
    rows before it sends it to the join operation. The earlier it can filter rows 
    out, the better.</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If we have an 
    index on both join columns (i.e. indexes on the DEPARTMENT_ID columns for 
    both the HR.DEPARTMENTS and HR.EMPLOYEES tables), Oracle will use the DEPARTMENT_ID 
    index on the inner table but not the outer. Why is that? Oracle doesn't know 
    if it has a DEPARTMENT_ID VALUE in the inner table that matches a DEPARTMENT_ID 
    value in the outer table unless it reads each and every row of the outer table 
    to do the match. Think about it. It knows that since it has to read every 
    row from the outer table to perform the match, the only indexes it can use 
    are the indexes built on local predicates (i.e. &quot;A.EMPLOYEE_ID=174&quot;).</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If we have an 
    index on the join column for one table and not the other, the optimizer will 
    often favor the table that has the index on the join column as the inner table 
    of the join. It knows it can't use an index on the join column if it is the 
    outer table but it can use the index if it is the inner.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">This is just one 
  quick example to show you the impact that indexes have on access path selection. 
  The key to success is to continuously experiment with the optimizer. One of 
  the features that can speed up your experimentation is to use virtual indexes. 
  Remember, this feature uses an &quot;undocumented&quot; parameter in 10G.<br><BR>
  I would like to thank super-DBA Mark Shore for re-igniting my interest in both 
  9I and 10G virtual indexes. Marks has a natural talent for this profession which I often wish I had.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Thanks for Reading,</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Chris Foot <br>
  Director of Operations<br>
  <a href="http://www.remotedbaexperts.com">Remote DBA Experts</a><br>
  Oracle Ace <img src="http://www.remotedbaexperts.com/ace_2.gif"></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  </font></p> ]]>
</content:encoded>
<dc:publisher>No publisher</dc:publisher>
<dc:creator>cfoot</dc:creator>
<dc:rights></dc:rights>
<dc:date>2007-05-31T20:18+00:00</dc:date>
</item>


<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-28.5119185797">
<title>10 Things I Like About 10G - Part 3</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-28.5119185797</link>
<description>This series covers a few of the features that you may often overlook when using 10G. There are so many features in each new release of Oracle's flagship database that the challenge is to leverage as many features as possible to make your day-to-day life easier. </description>
<content:encoded><![CDATA[<font face="Verdana, Arial, Helvetica, sans-serif" size="2"> </font>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The key to being 
  a successful Oracle DBA is that you must be willing to accept the fact that 
  with each new database release, you will have to adjust the way you administer 
  your environments. In my profession, I work with many DBAs from companies across 
  the globe. The most successful administrators I have met are the ones that intelligently 
  leverage the new features that are available in the releases of the database 
  they are administering. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Running Commands 
  and Scripts Against Multiple Targets</b><br>
  Being involved in an IT audit, like death and taxes, is inevitable. If you work 
  as a technician for any length of time, you will be working with an auditor 
  and some point. Since we provide remote database services, our organization 
  is audited numerous times per year. Sox audits, security audits, HIPPA audits 
  - you name the audit and we have been involved in it. We have an office that 
  is left open full-time for onsite auditors.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Auditors often 
  ask you to run scripts on the operating systems and databases your unit is responsible 
  for supporting. In the past, you would review the scripts and then distribute 
  them to team members to run on the environments they were responsible for supporting. 
  10G Grid Control makes this task a whole lot simpler. Grid provides you with 
  the capability of running host commands and scripts against multiple host targets 
  at the same time. Virtually any command or script that can be executed on a 
  single host can also be executed on multiple hosts using 10G Grid Control R2. 
  Here's <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-01-08.4154171355">a 
  blog</a> that shows you how to use 10G Grid Control R2 to run operating system 
  scripts against multiple targets.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">10G Grid Control 
  R2 also provides an easy-to-use panel that allows administrators to run SQL 
  scripts against multiple database targets simultaneously. Just like its host 
  command counterpart, all you need to do is code up a SQL statement, choose a 
  set of database targets, run the SQL against the multiple targets and review 
  the output. The benefits that this feature provides is only constrained by the 
  DBAs imagination. Here's a link to <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-01-14.3116717615">a 
  blog</a> that will show you how to run scripts against multiple database targets. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Restore Points</b><br>
  How many times have database recoveries been performed because of incorrect 
  changes made to database data? A user deletes or updates &quot;one too many 
  rows&quot; by mistake and the result is a time-consuming and error prone process 
  to restore and recover the database to a point-in-time before the error occurred. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Let's go back to 
  my days as an Oracle instructor&#133;. A common question in the Oracle DBA backup 
  and recovery class was &quot;why can't I just roll the database back to remove 
  unwanted changes instead of restoring the database from a backup and applying 
  the redo logs to roll forward to a point-in-time before the error occurred?&quot; 
  The question was invariably followed by &quot;don't you think that would be 
  easier?&quot; The answer was always the same &quot;yes, it would be easier, 
  but the Oracle database doesn't have that capability.&quot;</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">That was before 
  Flashback Database came along. Oracle's Flashback Database feature provided 
  a new tool in the DBA's recovery toolbox. Flashback Database allows the DBA 
  to &quot;roll back&quot; a table, set of tables or the entire database to a 
  previous point-in-time. Administrators often used a timestamp during the execution 
  of flashback operations.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">10G R2 enhances 
  Flashback Database by allowing administrators to associate a user-defined name 
  with a point-in-time. The user-defined name, called a restore point, can be 
  used in place of a SCN or timestamp when executing a FLASHBACK TABLE or FLASHBACK 
  DATABASE statement. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">A SQL statement 
  is used to create the restore point which means it can be embedded in application 
  programs as we as executed on an as-needed basis in SQL*PLUS. The example below 
  shows the creation of a restore point:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> CREATE RESTORE 
      POINT batch_daily_cycle_complete;</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Now if I execute 
  the following statement:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> UPDATE cti.employee_salary_table 
      SET<br>
      salary = 200000 WHERE empl_lname = 'FOOT';</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">My boss can execute 
  this statement to correct the 'mistake' (although I prefer to call it a fully 
  justifiable pay adjustment):</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> FLASHBACK 
      TABLE cti.employee_salary_table TO batch_daily_cycle_complete</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">10GR2 also provides 
  guaranteed restore points which ensure that the database can be flashed back 
  to the point-in-time they were created. Guaranteed restore points save disk 
  space because only the flashback logs required to meet the guaranteed restore 
  point need to be retained by the database. The statement below creates a guaranteed 
  restore point:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> CREATE RESTORE 
      POINT batch_daily_cycle_complete GUARANTEE FLASHBACK DATABASE;</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Automatic Undo 
  Retention</b><br>
  In Oracle9i, administrators had their choice of continuing to manage rollback 
  segments on their own (manual undo management) or configuring the database to 
  manage its own before image data (automatic undo management). Oracle refers 
  to system managed before image segments as undo segments. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You didn't have 
  to be an Oracle expert to know that manual rollback segments were &quot;somewhat 
  troublesome.&quot; Out of space conditions, contention, poor performance and 
  the perennial favorite &quot;snap shot too old&quot; errors had been plaguing 
  Oracle database administrators for over a decade. Oracle finally decided that 
  the database could probably do a better job of managing before images of data 
  than we could. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">But implementing 
  automatic undo retention didn't necessarily guarantee users a trouble free undo 
  environment. There really is only one parameter that administrators can tweak 
  in a system that uses automatic undo. The UNDO_RETENTION parameter specifies 
  the amount of time in seconds that Oracle attempts to keep undo data available. 
  Setting this parameter to the appropriate value could be described as more of 
  an art than a science. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Set it too low 
  and you are wasting disk space. In addition, you aren't taking advantage of 
  being able to flashback your data to as far back as the disk space allocated 
  to the undo tablespace allows. Set it too high and you are in danger of running 
  out of freespace in the undo tablespace. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">10G R2 comes to 
  the rescue! The database now collects undo usage statistics, identifies the 
  amount of disk space allocated to the undo tablespace and uses that information 
  to tune the undo retention period to provide maximum undo data retention. Administrators 
  can determine the current retention time period by querying the TUNED_UNDORETENTION 
  column of the V$UNDOSTAT view.</font></p>
<p><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">RMAN Automatically 
  Creates Temporary Datafiles During Restore</font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  Ever perform a restore and forget to recreate the temporary tablespace's data 
  files? I have. The database comes on-line but the first time a user's sort overflows 
  from memory to disk, an error code is returned. Recreating a database's temporary 
  files is one of those activities that are often overlooked. 10G R2 RMAN will 
  automatically recreate temporary datafiles belonging to locally managed temporary 
  tablespaces during the recovery operation.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Enterprise Manager 
  Statistics Management Support</b><br>
  A new link titled 'Manage Optimizer' statistics has been added to the database 
  administration home page in Enterprise Manager. Clicking on the link displays 
  the new Manage Optimizer Statistics home page. The new home page provides wizards 
  and templates that facilitate and automate optimizer statistics management. 
  In 10GR2 administrators are able to use Enterprise Manager to gather, restore, 
  delete, lock and unlock statistics </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Why would you want 
  to lock and unlock statistics? Let me describe one real-life example from a 
  recent project. We have a warehouse system that contains an extremely volatile 
  table. Describing it as volatile is like stating the Titanic sprung a small 
  leak. Hundreds of thousands of rows are added and removed around the clock.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The level of activity 
  is based on the particular business process taking place. At one particular 
  time, the table can contain hundreds of thousands of rows and at other times 
  it can contain dozens. OK, so when do you generate statistics? If you run DBMS_STATS 
  at the same time each day, in most cases you would think you would get a predictable 
  set of statistics generated. Not so in this table's case, sometimes you get 
  hundreds of rows and some times you get hundreds of thousands. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If you are unlucky 
  and generate statistics on the table when it has hundreds of rows, access paths 
  suffer when the table grows to hundreds of thousands. So, we ran DBMS_STATS 
  when we knew the table contained numerous rows and never generated statistics 
  on it again. Problem is that we can no longer easily use the SCHEMA option for 
  DBMS_STATS. Freezing statistics on this table will allow us to use the SCHEMA 
  option and not generate statistics for selected tables.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>DML Error Logging</b><br>
  What I like about SQL*LOADER is its ability to continue processing through load 
  errors. If the record being loaded is rejected because of a unique constraint 
  violation or discarded because it does not meet some user-defined criteria, 
  SQL*LOADER places the record into a discard or reject file and keeps on running 
  until it has reached a user-specified maximum number of rejects or discards.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The loader's log 
  file will show how many records were loaded, rejected or discarded. I can look 
  at the messages and review the discard or reject files, fix the problem and 
  attempt to reload them again.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">In 10G R2, this 
  same type of processing has been applied to bulk DML operations. Users are able 
  to specify whether they want to log errors or abort the entire DML statement, 
  set the amount of detail information logged and the maximum error threshold. 
  So instead of the entire DML statement blowing up and rolling back, Oracle will 
  log the errors to the error table and continue processing until it exceeds the 
  maximum number of errors. Just like SQL*Loader! </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Oracle 10G R2's 
  DBMS_ERRLOG package is used to create the error log output table and link it 
  to the table being updated. The package's specification is provided below:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">DBMS_ERRLOG.CREATE_ERROR_LOG 
      (<br>
      dml_table_name IN VARCHAR2,<br>
      err_log_table_name IN VARCHAR2 := NULL,<br>
      err_log_table_owner IN VARCHAR2 := NULL,<br>
      err_log_table_space IN VARCHAR2 := NULL,<br>
      skip_unsupported IN BOOLEAN := FALSE);</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Most of the columns 
  are pretty self explanatory: table name being updated, error log table name, 
  owner of error log table and the error log table's tablespace. If the SKIP_UNSIPPORTED 
  is set to TRUE, column types that are not supported by error logging will be 
  skipped over and not added to the error logging table. If it is set to FALSE, 
  an unsupported column type will cause the procedure to fail.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's a quick 
  example:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Let's create 
      or table that will be updated:<br>
      SQL&gt; r<br>
      1 CREATE TABLE foot.emp_table<br>
      2 (empno number(4), ename varchar2(10), job varchar2(8))<br>
      3* TABLESPACE users;</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Table created.</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Add a primary 
      key:<br>
      SQL&gt; ALTER TABLE foot. emp_table ADD PRIMARY KEY(empno) <br>
      2 USING INDEX TABLESPACE users;</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Table altered.;</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Load some rows:</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; INSERT 
      INTO foot.emp_table VALUES<br>
      2 (7499, 'ALLEN', 'SALESMAN');</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">1 row created.</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; INSERT 
      INTO foot.emp_table VALUES<br>
      2 (7521, 'WARD', 'SALESMAN');</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">1 row created.</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; INSERT 
      INTO foot.emp_table VALUES<br>
      2 (7566, 'JONES', 'MANAGER');</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Let's cause a unique 
  constraint violation:</font></p>
<blockquote> 
  <blockquote> 
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; insert 
      into foot.emp_table select * from foot.emp_table;<br>
      insert into foot.emp_table select * from foot.emp_table<br>
      *<br>
      ERROR at line 1:<br>
      ORA-00001: unique constraint (FOOT.SYS_C009069) violated</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Create the 10G 
  R2 error logging table:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">exec dbms_errlog.CREATE_ERROR_LOG 
      ('emp_table','dml_errors_emp_table')</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Let's create a 
  table that we can update and change one row to see if we can get one row to 
  load and 2 to fail and be placed into the DML_ERRORS_EMP_TABLE:</font></p>
<blockquote> 
  <blockquote> 
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; create 
      table foot.emp_load_table tablespace users as select * from foot.emp_table<br>
      Table created.</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Update one row 
  to change the EMPNO column's value to avoid the primary key violation:</font></p>
<blockquote> 
  <blockquote> 
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; update 
      foot.emp_load_table set empno=123 where empno=7499;<br>
      1 row updated.</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Rerun the statement 
  specifying the new 10G R2 error logging syntax. Use our new load input table 
  so that our one changed row will be loaded and two will be rejected and placed 
  into the DML_ERRORS_EMP_TABLE:</font></p>
<blockquote> 
  <blockquote> 
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; insert 
      into foot.emp_table select * from foot.emp_table<br>
      LOG ERRORS INTO dml_errors_emp_table('test_load_20050718')<br>
      REJECT LIMIT UNLIMITED;</font></p>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">1 row created.</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">OK, we loaded one. 
  What happened to our other two? Let's see what our DML_ERRORS_EMP_TABLE contains. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">First, let's describe 
  the DML_ERRORS_EMP_TABLE:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL&gt; DESC 
      foot.dml_errors_emp_table<br>
      <br>
      ORA_ERR_NUMBER$ NUMBER<br>
      ORA_ERR_MESG$ VARCHAR2(2000)<br>
      ORA_ERR_ROWID$ ROWID<br>
      ORA_ERR_OPTYP$ VARCHAR2(2)<br>
      ORA_ERR_TAG$ VARCHAR2(2000)<br>
      EMPNO VARCHAR2(4000)<br>
      ENAME VARCHAR2(4000)<br>
      JOB VARCHAR2(4000)</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Our error logging 
  table contains an incrementing error counter, the error message, ROWID, error 
  type, tag (contains our users specified name from above -'test_load_20050718') 
  and the three columns of our table.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Let's select from 
  the table. I have truncated the ORA_ERR_MESG$ table for readability sake:<br>
  <br>
  SQL&gt; SELECT ora_err_number$, ora_error_mesg$, emp_no FROM foot.dml_errors_emp_table;</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">ORA_ERR_NUMBER$ 
      ORA_ERR_MESG$ EMP_NO<br>
      --------------- -------------------------------------------------- ------<br>
      1 ORA-00001: unique constraint (FOOT.SYS_C009069) violated&#133;..7521<br>
      2 ORA-00001: unique constraint (FOOT.SYS_C009069) violated&#133;.7566</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We loaded one row 
  and rejected two rows due to primary key constraint violations.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  <b>Conclusion</b><br>
  I hope you enjoyed this series on 10G features.</font></p> ]]>
</content:encoded>
<dc:publisher>No publisher</dc:publisher>
<dc:creator>cfoot</dc:creator>
<dc:rights></dc:rights>
<dc:date>2007-04-30T09:56+00:00</dc:date>
</item>


<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-15.6658230898">
<title>10 Things I like about Oracle 10G Part 2 (and other stuff)</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-15.6658230898</link>
<description>I thought I would combine two different topics of conversation. We'll review of some of the 10G features that we take for granted or are easily overlooked. The discussion also continues its lighthearted review of day-to-day DBA life and provides a few helpful hints and tips to make that life easier. Weird combination but it may make for an interesting and informative read.</description>
<content:encoded><![CDATA[<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's a couple 
  of my favorite DBA discussions&#133;.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Favorite DBA 
  Conversation #1</b><br>
  Any discussion that ends in &quot;I hope you're not too busy because we need it now.&quot; 
I really dislike the conversation that ends in "we needed it yesterday."  If you needed it yesterday you should have stopped in to discuss this request a week before yesterday.  We all know these types of requests because we have all gotten them. One of your 
  customers pops in and states:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">&quot;We need a 
  complete refresh of XYZ database from production. Oh, and its an ERP application 
  database and we don't have enough disk space in test to hold everything so you'll 
  need to figure out how to reduce its disk size requirements AND make sure the 
  application still works. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I know the box 
  only has 1 CPU and 250 MEG of memory, but can you make sure we still get good 
  performance? We're testing some application coding changes and we need to get 
  performance benchmarks. We'll compare the stats from the test box to the ones 
  we get from our 22 CPU production box. It may not be an &quot;apples to apples&quot; 
  but I think the boxes are close enough to compare the performance stats. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I know its Friday afternoon at 3:00 and even though we knew about this 
  refresh 14 weeks ago, we didn't think we needed to tell you until 1 day before 
  we wanted it. So, we would like to have the system ready by Monday.&quot; </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Over the last 20 
  years I have received dozens of these last minute requests. Requests that have 
  made me cancel plans, postpone trips and generate numerous apologies to friends 
  and family. The work never bothered me, but the timing of the requests sometimes 
  did. It also reduced the quality of service I provided to my other customers. 
  When you have DBAs jumping from one non-planned request to another, it affects 
  their ability to work on planned requests as well as perform proactive administrative 
  duties.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Fix #1</b>: 
  You minimize these requests by creating, advertising and enforcing DBA work 
  request SLA agreements. Agreements that clearly state lead times per type of 
  request. The more widespread the problem is at your organization, the more advertising 
  you must do. It really becomes a sales pitch on the importance of a DBA unit 
  being able to forecast workloads. The unit can't provide quality service to 
  their customers if they are being affected by work requests that could have 
  been planned for - but weren't.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The mantra should 
  be &quot;all of our customers suffer when we receive un-planned work requests.&quot; 
  I'm not afraid of telling application manager A that she can't get her 
  planned requests done because application manager B just gave us 32 emergency 
  requests. Kind of like putting them both in a jar and shaking it up a bit.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Fix #2: </b>10G 
  Grid Control allows you to clone both the Oracle Home software installation 
  as well as the Oracle database. Grid will automatically adjust the specific 
  home properties (IP address, host name, listener settings) during the cloning 
  process. 10G DBCA templates allow you to clone a new database from existing 
  databases. In addition, DBCA allows you to clone just the source database file structures 
  or the structures and the data. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You can also use 
  some of the 10G Data Pump features to tailor the new database to your user's 
  specifications. 10G Data Pump provides numerous options that:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Specifiy what 
    objects you want to transfer from one database to another</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Transfer a subset 
    of data from those objects using various filtering options</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Remap objects 
    during the migration process. You can remap schema objects from one user to 
    another, from one tablespace to another </font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You already know 
  I'm a huge fan of 10G Data Pump. You need to leverage the features this tool 
  provides to customize schema and data transfers from one database to another. 
  You shouldn't be writing scripts when you don't need to. The only way you will 
  realize the full potential of 10G Data Pump is to READ THE UTILITIES manual 
  and see how powerful 10G Data Pump really is. It will make your life easier.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Favorite DBA 
  Conversation #2</b><br>
  You come in to a meeting and you're confronted by an application manager who tells you that you need to tune your database because his ace developer 
  &quot;Sir Lawrence of LongSQL&quot; can't get his 32 page SQL statement to achieve 
  sub-second response times.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You know the SQL 
  statement that I'm talking about. It's the one that contains 15 inner and outer 
  joins, 12 subselects, and&#133;&#133;.(feel free to add any other type of complex 
  SQL Syntax here). </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Note from database 
  administrators to application developers:</b><br>
  Just because you can code a 32 page SQL statement, it doesn't mean you should. 
  We all understand how powerful the SQL language is, but do you really need to 
  try and use every feature available in a single statement? There's a difference 
  between leveraging the power of the SQL language and attempting to perform too 
  much work in a single SQL statement. Generating long, complex SQL statements 
  that no one can debug does NOT classify you as a supercoder. It does classify 
  you as something else, but I can't say that publicly.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Favorite DBA 
  Conversation #3</b><br>
  Favorite DBA Conversation #3 combines components of conversations #1 and #2. 
  It occurs when you are approached by a customer who says they have developed 
  this &quot;small&quot; application that goes live in two weeks and it isn't 
  performing &quot;as well as we think it should.&quot; This means that you have 
  to review the SQL from 23 new application programs in those two weeks.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Fix #1</b>: 
  Reinforce the need for the DBA team to be involved in all application development 
  projects. This can be done by creating a series of application design review 
  meetings. A dedicated an <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-08-09.0916922652">entire 
  blog</a> on this subject. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Fix#2</b>: You 
  will need to start a top down performance analysis project that focuses on tuning 
  the most poorly performing queries first. If you don't have access to the 10G 
  Grid Control sissy GUI tools, you can use the V$ views to retrieve the top resource 
  consuming statements. You can use the V$SQLAREA view for Oracle9I and below. 
  10G offers the V$SQLSTATS view that provides some distinct advantages over its 
  previous counterparts.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>10G V$SQLSTATS 
  Performance View</b><br>
  Before we discuss the new V$SQLSTATS view, let me deviate for a minute to provide 
  you with some quick SQL tuning advice. V$SQLAREA is one of my favorite SQL tuning 
  views. Until V$SQLSTATS came along&#133;</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If I want to perform 
  a traditional &quot;top down&quot; tuning approach and tune the highest resource 
  consuming SQL, I'll use the statements below to identify the top resource consuming 
  queries. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The following query 
  identifies the SQL responsible for the most disk reads:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SELECT disk_reads, 
      executions, disk_reads/executions, address, sql_text FROM v$sqlarea WHERE 
      disk_reads &gt; 5000 ORDER BY disk_reads;</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The following query 
  identifies the SQL responsible for the most buffer hits:</font></p>
<blockquote> 
  <blockquote> 
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SELECT buffer_gets, 
      executions, buffer_gets/executions, address, sql_text FROM v$sqlarea WHERE 
      buffer_gets &gt; 10000 ORDER BY buffer_gets;</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  You can create a more readable report in SQLPLUS by inserting report breaks 
  between the output lines. To generate the report breaks in SQLPLUS, issue the 
  following statement before running the query:</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">BREAK ON disk_reads 
      SKIP 2 --- for the disk read report and<br>
      BREAK ON buffer_gets SKIP 2 --- for the buffer get report</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  The first query returns SQL statements responsible for generating disk reads 
  greater than 5,000 while the second query returns SQL statements responsible 
  for generating buffer reads greater than 10,000. I used these numbers just as 
  an example but I sometimes use them as a starting point. I'll then adjust 
  them up or down accordingly, based on their output. The numbers also depend 
  on the system I'm reviewing. I'll use different numbers for OLTP environments 
  than I would for data warehouses.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You'll notice that 
  I divide the number of disk and buffer reads by the number of statement executions. If a statement is generating 1,000,000 disk reads but is executed 500,000 times, it probably doesn't need tuning. <br><br>
  Heavy disk reads per statement execution usually means a lack of proper indexing, 
  poor selection criteria, etc.. Heavy buffer reads sometimes means the exact 
  opposite - indexes are being used when they shouldn't be.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> But I'm personally 
  most interested in workload, that's why I most often use the buffer cache hits 
  in my initial queries.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">But the SQLTEXT 
  column in V$SQLAREA does not provide the entire text of the SQL statement. That's 
  why I include the address column in the report. I can use that value to dump 
  the entire SQL statement from V$SQLTEXT using the statement below (where xxxxxxxx 
  is the value in the address column from the V$SQLAREA reports above):</font></p>
<blockquote> 
  <blockquote>
    <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">select sql_text 
      from v$sqltext where address = 'xxxxxxxxx' order by piece;</font></p>
  </blockquote>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Oracle 10G R2 provides 
  a new view called V$SQLSTATS that contains a combination of columns that appear 
  in V$SQL and V$SQLAREA. The benefits that V$SQLSTATS provides are as follows:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Since V$SQLSTATS 
    contains the entire text of the SQL statement AND its associated performance 
    statistics, we are no longer required to access both the V$SQLTEXT and V$SQLAREA 
    to obtain the information we need.</font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Oracle states 
    that V$SQLSTATS is faster and more scalable.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The data in V$SQLAREA 
  has a tendency to get its contents flushed out just when you need to get additional 
  information from it. The V$SQLSTATS view provides users with a longer access 
  window. That's one of the key benefits to this view. <br>
  <br>
  <b>Next Up</b><br>
  The series continues.<br>
  </font></p> ]]>
</content:encoded>
<dc:publisher>No publisher</dc:publisher>
<dc:creator>cfoot</dc:creator>
<dc:rights></dc:rights>
<dc:date>2007-04-16T14:36+00:00</dc:date>
</item>


<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-06.2643727574">
<title>10 Things I like about Oracle 10G Part 1</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-04-06.2643727574</link>
<description>I review some of the 10G features that we take for granted or often overlook.  The discussion, although somewhat whimsical at times, does provide some very useful information.</description>
<content:encoded><![CDATA[<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Let's consider 
  this blog to be a review of sorts. Oracle 10G has been Oracle's flagship release 
  for some time now. I thought it might be beneficial to focus on some of the 
  benefits that 10G has to offer. They aren't in order of importance. Its just 
  a general list that may help readers remember that there are some pretty cool 
  features in Oracle 10G. Hopefully you will find it to be both informational 
  and an interesting read.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Ease of Installation</b><br>
  I remember the good old days. When I began my career, the Oracle installers 
  were just screen painters that forced you to use the TAB key to navigate back 
  and forth between selections and screens. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Installations used 
  to take hours and experiencing problem after problem was commonplace. Successfully 
  installing Oracle became a rite of passage as a DBA. Four hours after you started 
  the installation (and fighting through errors, warnings and placing a half dozen 
  CDs in the reader), you would finish up and think to yourself &quot;I am an 
  installation GENIUS!&quot;. You next thought would be &quot;I hope I don't have 
  to go through this again for a while.&quot;</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">With each new release, 
  the installer became easier to use, installation speeds increased and the number 
  of installation problems decreased. In a few years, I'll be telling new DBAs 
  &quot;You don't know how good you have it. I remember when installations used 
  to take three days... We were real DBAs back then. We even had to log in at 
  NIGHT TIME and take the data OFFLINE to do work.&quot; Darn kids don't know 
  how good they have it nowadays&#133;.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We do DOZENS of 
  Oracle installations a month here at Remote DBA Experts. One of the benefits 
  of working here is the sheer thrill of working on virtually every operating 
  system that Oracle makes a product on. Name the O/S and hardware combination 
  and we can truthfully say &quot;been there and installed an Oracle product on 
  it.&quot; </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">When our first 
  set of 10G CDs arrived a couple of years ago, the DBA opened up the package 
  and said &quot;Hey, where's the rest of them? I think they forgot to send me 
  all of the CDs I need to do the install.&quot; We checked MetaLink and found 
  that Oracle10G only needs a couple of CDs. One main CD and another called &quot;The 
  Companion CD&quot; which really should be called &quot;The Companion CD that 
  is required for all installs&quot; since it pretty much has to be installed 
  when you install Oracle.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The team here really 
  likes the fact that the installer now performs pre-installation requirement 
  checks before laying down the software. The installer itself now determines 
  if the O/S environment is configured to correctly run the Oracle software. Having 
  the installer verify that you have performed &quot;your pre-installation&quot; 
  duties is very beneficial. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
  <b>10G Data Pump</b><br>
  I'm a big fan of 10G Data Pump. Once you become accustomed to the new environment, 
  it's a pretty good utility. There is a learning curve - like the first time 
  you try to restart a Data Pump job by just rerunning the script again. You'll 
  quickly find out that Data Pump has a command for that. At least it provides 
  you with the &quot;Master table exists&quot; error message to point you to your 
  mistake.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's a quick 
  list of some of the features I like:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The utility 
    IS faster than Export and Import. Maybe not as much faster as Oracle says 
    it is - but it is faster. I have personally seen Exports and Imports run for 
    hours - and days.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I like being 
    able to use parallelism to improve performance.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> You can stop 
    and restart jobs. How great is that? The master table knows where you left 
    off so you don't have to spend all of that time trying to code a new Import 
    statement that won't duplicate rows in tables that were successfully loaded. 
    This is really helpful.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">How many times 
    did you have to &quot;pick a number, any number&quot; when you had to determine 
    how much space you would need for your Export Dump file? Data Pump provides 
    an option that estimates the output dump file size that would be created by 
    a Data Pump Export. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">One of my favorite 
    features is the network transfer option that allows administrators to attach 
    to any source database that can be accessed from the network, transfer the 
    data and write it to the target database. No dumpfile required! Administrators 
    use the NETWORK_LINK parameter to specify a pre-created database link that 
    points to the source database.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You can use 
    the Data Pump Flashback feature to go back in time and export data how it 
    looked in the past. This helps when you get a visit from one of your developers 
    stating &quot;I think I might have updated 47 production tables by mistake, 
    but I won't know until I see the data.&quot; Use the flashback feature during 
    the Data Pump Export and use the Data Pump Import utility to pump the data 
    into a new schema for the developer to review. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> You can use 
    the EXCLUDE parameter to exclude specific objects using custom syntax. For 
    example, EXCLUDE=INDEX:&quot;LIKE 'DEPT%'&quot; would exclude indexes that 
    start with the name &quot;DEPT&quot;.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The more I thought 
  about the Data Pump features I liked, the longer I thought this blog would be. 
  So here are links to three blogs I wrote on Data Pump.</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-05-19.6918984141">Data 
    Pump Part 1 Features and Benefits</a> - A general overview of the 10G Data 
    Pump Utility.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-05-26.3042156388">Data 
    Pump Design and Architecture</a> - We dig deeper into inner-workings of the 
    Data Pump utility. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-06-02.2786242018">Data 
    Pump Export</a> - We continue the Data Pump discussion by learning how to 
    use 10G Data Pump Export to &quot;pump&quot; data out of an Oracle database.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-06-08.1893574515">Data 
    Pump Import</a> - The series finale on Data Pump Import.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>10G Automatic 
  Alerting</b><br>
  Oracle10G provides early warning mechanisms to alert administrators of possible 
  error conditions. The database itself collects numerous metrics that were previously 
  collected by 9i's Oracle Enterprise Manager. Administrators are able to select 
  from dozens of server-generated alerts. </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Server 
  generated alerts are activated by a new background process called MMON. MMON 
  is able to access the SGA directly and perform the metrics calculations and 
  threshold monitoring. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">10G Grid Control 
  enhances these capabilities by providing administrators with a GUI interface 
  to administer alerts and configure notification mechanisms. Administrators are 
  able to use Grid Control or the standalone version, Database Control to set 
  up e-mail and pager notifications. In addition, all server-generated alerts 
  are displayed on the Database Control/Grid Control home pages.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">As readers of this 
  blog know, I'm a huge fan of 10G Grid Control. Although the database alerts 
  can be set up in the database using the archaic command line interface, if I 
  can do it using Grid Control with a few clicks of the mouse, that's the tool 
  I will use. And to think I used to call 9i OEM &quot;a Sissy GUI Tool&quot;.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Setting up 10G's 
  &quot;early warning system&quot; places you in the proactive DBA category as 
  opposed to reactive. The term we us to describe a pure reactive DBA is &quot;firefighter&quot;. 
  That's the DBA or DBA team that runs from one fire to the next. I will acknowledge 
  that we are ALL firefighters from time to time. At one of my previous jobs, 
  I spent six months working with another DBA trying to beat an absolutely atrocious 
  third-party vendor package into submission. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You all know the 
  type of third-party vendor package I'm talking about. Someone from your management 
  food chain shows up in your cube and states &quot;Hey, even though you rated 
  this vendor an absolute 0 in all technical categories, and flatly stated that 
  we should not consider them as a viable alternative, we chose them anyway. The 
  Senior VP from the business unit liked the color of their screens. I'm sure 
  you'll be able to get it working.&quot; </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You then get on 
  72 conference calls with the vendor after the package crushes a 6 CPU box with 
  10 concurrent users. Most of the conversations are with the vendor's lead technical 
  experts who are as arrogant as they are inexperienced. Their continued mantra 
  is &quot;you don't understand how Oracle works, it's your fault, you don't understand 
  how Oracle works, it's your fault&#133;.&quot;. This mantra never stops even 
  though you show them poor SQL coding, transaction looping problems, etc&#133;</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">But I digress... 
  During my career as an Oracle instructor, one of the most common recommendations 
  I used to provide to my Oracle students was the benefits of database monitoring. 
  My catch phrase was &quot;We monitor by day so we don't get called at night.&quot; 
  By the end of the DBA I class, all I would have to say is &quot;We monitor by 
  day&#133;&quot; and the class would respond accordingly. I would then award 
  them with a set of scripts that allowed them to do database connect checks and 
  track datafile free space. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">10G Grid Control 
  does all that (and more) for you automatically. The set of checks range the 
  spectrum, from agent unable to connect to target (that means either the database, 
  server or agent broke), to tablespace freespace and alert log errors. As I stated 
  previously, 10G provides dozens of alert choices and is your one-stop-shop for 
  proactive database monitoring. That's a good thing. I would rather wade through 
  dozens of alerts I don't want to activate than spend ANY time coding an alert 
  that wasn't provided by the toolset.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">One of my previous 
  blogs titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-05-14.9418191992">&quot;Configuring 
  10G OEM Grid Control's Automatic Alert Notification System&quot;</a> will help 
  you set up proactive performance monitoring in 10G. The title says it all. It 
  provides everything you need to activate 10G Grid Control's early warning system.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Next Up</b><br>
  The 10 Thinks I like About 10G Continues. Could be more than 10 maybe...</font></p> ]]>
</content:encoded>
<dc:publisher>No publisher</dc:publisher>
<dc:creator>cfoot</dc:creator>
<dc:rights></dc:rights>
<dc:date>2007-04-09T05:44+00:00</dc:date>
</item>


<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-31.3616747160">
<title>My Top 10G Tuning Tools</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-31.3616747160</link>
<description>This blog contains a listing of my top 10G Tuning Tools.   These are the tools that I most often turn to when I am faced with a “database performance challenge.”  In upcoming blogs, we’ll discuss tools that are available in Oracle 9i as well as review some generic tuning utilities.</description>
<content:encoded><![CDATA[<font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <b> </b></font>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We've spent a lot 
  of time discussing SQL statement tuning. We started off this 15 blog series with a discussion on system triage and finished with Oracle access path identification and tuning. I also dedicated a dozen blogs or so to 10G Grid Control performance monitoring and analysis tools. With the abundance of long-winded information 
I have made available on this blog, I thought it might be beneficial to condense some of it into a review  of some of my favorite tuning toolsets. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>My Number One 
  Tuning Tool of All Time - 10G Grid Control</b><br>
  If we are administering a 10G database, our administration tool of choice is 
  either 10G Database Control (non-grid, standalone version), or 10G Grid Control 
  to administer it. The advanced alerting, monitoring and administration features 
  make this tool our preferred method of administration. The advanced performance 
  monitoring and analysis features make it my number one tool for performance 
  problem determination.<br>
  <br>
  The future of Oracle database tuning will be administrators interpreting and 
  implementing the recommendations generated by the intelligent advisors and ADDM. 
  It is a foregone conclusion that Oracle will continue to improve upon its performance 
  monitoring and analysis toolsets. Self tuning features are no longer options 
  that are &quot;nice to have&quot;, they are requirements for Oracle's competitive 
  survival. SQL Server is continuing to scale, moving into areas that were once 
  dominated by UNIX big-iron machines running Oracle databases. Oracle must compete 
  with SQL Server's ease of use or it will undoubtedly lose market share.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">As the intelligence 
  of the advisors and ADDM increases, the need to possess an in-depth knowledge 
  of Oracle and the usage of detailed diagnostics to improve database performance 
  will decrease. And you heard it here first folks, I also think that reading 
  SQL traces and statistics dumps will be a thing of the past. My crystal ball 
  tells me that its just a matter of time until Oracle's SQL advisors make SQL 
  traces and statistics dumps less and less important until they become totally 
  unnecessary. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The new breed of 
  top tuners will be the administrators who focus on how to use the toolsets and 
  interpret their output. Not the tuners who spend the majority of time digging 
  down into the dark, inner workings of the Oracle software. I'm not saying that 
  knowing how the database works is immaterial. I am stating that this intimate 
  knowledge will become less and less important as the tools mature. It's only 
  a matter of time until tuning is relegated to a minor sub-task that can be scheduled 
  between other activities. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's a listing 
  of my favorite 10G Grid Control tools.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Host Performance 
  Home Page</b><br>
  If someone tells me &quot;the whole system is slow&quot;, the first thing I'm 
  going to do is review the host platform's key performance indicators. 10G Grid 
  Control's <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-04-19.3743394432/perf_home_page.gif">Host 
  Performance panel</a> provides me with exactly the information I'm looking for 
  - current CPU, memory and disk resource utilization. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Each resource's 
  graphical display contains links that allow me to view more detailed statistical 
  information. Each of the drill down panels for <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-04-19.3743394432/cpu_drilldown.gif">CPU</a>, 
  <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-04-19.3743394432/memory_drilldown.gif">Memory</a> 
  and <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-04-19.3743394432/disk_drilldown.gif">Disk</a> 
  contains a drop down menu list that I can use to view current as well as historical 
  performance statistics for the last 24 hours, 7 days and 31 days. The main performance 
  panel also displays information on the top resource consuming processes that 
  are currently running on the host. Once again, a drop down menu lets me switch 
  between top CPU and top memory consumption reports. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">For a more in-depth 
  discussion on host performance tuning, please refer to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-04-19.3743394432">&quot;Host 
  Performance Monitoring Using 10G Enterprise Manager Grid Control&quot;</a>. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>10G Grid Control 
  Database Performance Home Page</b><br>
  If I want to review database performance, I will access the <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-05-22.3884573887/db_perf_home.gif">10G 
  Grid Control Database Performance Home Page</a>, which is available in both 
  10G Database Control and Grid Control.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">The database performance 
  home page allows me to review performance historically, identify what sessions 
  are dominating &quot;finite system resources&quot;, activate advisors and drill 
  down into the top resource consumers.  I can then quickly review the SQL they are executing. 
  Does it get any better than that? </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I challenge anyone 
  to tell me that they would be able to monitor database performance more efficiently 
  using archaic command line toolsets. By the time you have identified the problem, 
  I'll have already contacted the user running the SQL and created a profile to 
  improve its performance. If I have Grid Control's alerting system configured 
  (which I always do), Grid Control's database performance threshold alert would 
  have already notified me that a problem was occurring. By the time you got that 
  call from an irate user, I would have had it solved. If you want to learn how 
  to configure 10G Grid Control's performance alerting feature, please turn to 
  my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-05-14.9418191992">&quot;Configuring 
  10G OEM Grid Control's Automatic Alert Notification System&quot;.</a></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">To learn more about 
  10G Grid Control's database performance monitoring and analysis features, please 
  turn to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-05-22.3884573887">&quot;Database 
  Performance Monitoring Using 10G OEM Grid Control&quot;</a>.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>10G Grid Control 
  Advisors</b><br>
  OK, I'll admit it. I'm hooked on the advisors. At first I was very wary of their 
  recommendations, but the longer I worked with them, the better I liked them. 
  I have lots of experience tuning Oracle, but if an advisor is going to make 
  my job easier (and let me spend less time debugging a performance problem), 
  I'm all for it.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">For an overview 
  of 10G Grid Control's advisory features, please refer to my blog that is aptly 
  titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-06-10.8609363343">&quot;An 
  Overview of 10G Advisors&quot;</a>. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's a listing 
  of blogs that provide more specific information on the individual advisors. 
  Please note that each title below also links to a blog on that advisor.</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-07-06.5201081269">10G 
    SQL Access Advisor</a> - The SQL Access Advisor recommends a set of materialized 
    views and indexes based on a supplied workload input. The tool can also help 
    administrators optimize materialized views to take advantage of fast refresh 
    and query rewrite capabilities. In addition, the SQL Access Advisor may recommend 
    dropping indexes and materialized views that aren't being used. The SQL Advisor 
    ranks and groups the recommendations based on the positive impact they will 
    have if implemented. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-08-11.0227938704">SQL 
    Tuning Advisor</a> - The SQL Tuning Advisor, as its name implies, provides 
    SQL tuning recommendations and includes information justifying why it generated 
    those recommendations. The recommendations may include collecting statistics 
    on objects, new index creation, restructuring the SQL statement or the creation 
    of a SQL profile to create a more optimal access path. I have a more detailed 
    blog the SQL Tuning Advisor titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-05-05.3335525140">&quot;SQL 
    Access Advisor Revisited&quot;</a>.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-08-25.8847176467">Segment 
    Advisor</a> - Although I don't use this advisor as much as the SQL Tuning 
    and SQL Access advisors, I do use it on a regular basis. The 10G segment advisor 
    identifies segments that have become fragmented as a result of update and 
    delete operations. The <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-07-16.1165649869">10G 
    R2 Segment Advisor</a> has been enhanced to identify tables that suffer from 
    excessive row chaining and row migrations. Oracle describes these objects 
    as being sparsely populated. Not only do sparsely populated objects waste 
    space but they can also contribute to SQL performance problems. </font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Automatic Database 
  Diagnostic Monitor (ADDM)</b><br>
  ADDM is a &quot;recommendation engine&quot; that uses performance information 
  stored in the Automatic Workload Repository (AWR) as input. Here's <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-06-30.3614041361">a 
  blog</a> that provides a detailed description of the Automatic Database Diagnostic 
  Monitor. By default, AWR snapshots occur every 60 minutes. For more 
  information on the AWR snapshots, please turn to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-10-29.7417919231">&quot;Working 
  with Automatic Workload Repository Performance Snapshots&quot;</a>. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">To learn how to 
  tailor the 10G AWR snapshot environment to meet your specific needs, please 
  refer to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-11-06.0481421080">&quot;Configuring 
  and Administering Automatic Workload Repository Performance Snapshots&quot;</a>. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">After the AWR information 
  snapshot is executed, the Automatic Database Diagnostic Monitor is triggered 
  to analyze the information contained in the AWR for the period pertaining to 
  the last two Snapshots.  ADDM's output includes a plethora of reports, charts, 
  graphs, heartbeats and related visual aids. In general, ADDM provides users 
  with a top-down analysis of performance bottlenecks and their associated resolutions. 
  But you can also <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-11-24.2858305991/04a_addm_task_output_page.gif">execute 
  ADDM manually</a> to generate recommendations for current, as well as historical, 
  time periods. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Statistical information, 
  by itself, is often useless. If you have nothing to compare a measurement to, 
  how will you know if its good or not so good? 10G Grid Control allows two sets 
  of snapshots to be compared to one another. The results of the comparison are 
  displayed graphically using horizontal bars to indicate differences between 
  the two measurements. To learn how to perform snapshot comparison, please refer 
  to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2005-12-03.3566409131">&quot;You 
  Can't Improve What You Can't Compare&quot;</a>.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Conclusion</b><br>
  Take some advice from your friendly ex-Oracle instructor. LEARN HOW TO USE THESE 
  TOOLS. I can't emphasis that statement strongly enough. As I stated, ADDM and 
  the intelligent advisors may not currently be a total replacement for DBA experience 
  and expertise, but sooner or later, they most definitely will be. Don't get 
  left behind - because its only a matter of time.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  </font></p> ]]>
</content:encoded>
<dc:publisher>No publisher</dc:publisher>
<dc:creator>cfoot</dc:creator>
<dc:rights></dc:rights>
<dc:date>2007-04-02T14:56+00:00</dc:date>
</item>


<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-17.4269055673">
<title>Access Path Scientific Analysis</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-17.4269055673</link>
<description>We combine all of the knowledge we learned in previous blogs of this series to begin our scientific analysis on Oracle optimization.  We’ll review some of tools we can use to display access path information and look at some graphical displays that will assist us during the analysis process.  I’ll also provide you with some examples to jump-start your testing.</description>
<content:encoded><![CDATA[<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  <b>Introduction</b><br>
  This information is intended to help you begin your quest to become a database 
  performance scientist. There's a difference between tuning and learning how 
  to tune. Tuning is what happens when you get that call at 3:00 on a Friday afternoon. 
  You have a concerned customer stating that something is running longer (usually 
  way longer) than they would like. Your first response is to consider your choice 
  of career paths, dreaming how nice it would be to sell wood carvings at a roadside 
  stand in Montana. You then perform your diagnostic analysis, come to some sort 
  of conclusion and implement your solution. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Learning how to 
  tune requires that you spend time with the optimizer experimenting with different 
  environmental settings and database objects that affect access paths. It also 
  requires that you have a general understanding of the basics of optimization. 
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I dedicated <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-19.1078911078">an 
  entire blog</a> on educational resources that will help you build a firm foundation 
  of Oracle optimization knowledge. </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">It's 
  critical that we understand as much as we can about optimization before we begin 
  our experimentation. But the key to success is to spend dedicated time experimenting. 
  I'm not professing that you spend the rest of your career becoming &quot;at 
  one&quot; with the optimizer. But if you don't want to be at a total loss each 
  time something runs long, you need to experiment to learn how to tune.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Environmental 
  Documentation and SQL Statement Selection </b><br>
  Before we begin, we'll need to document some of the key parameters that affect 
  optimization and gather some information on the data objects we will be using 
  in our experimentation. Please refer to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-15.4209681965%20">&quot;Access 
  Path Scientific Analysis Part I&quot;</a> for more information on the importance 
  of documentation as well as the documentation process itself. In a <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-11.8660796218">previous 
  blog</a>, I provided a few hints and tips on identifying what types of statements 
  and access paths would be most beneficial to analyze. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Access Path 
  Identification Tools</b><br>
  Here are the tools that I most often use to review Oracle access paths:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL Scratchpad 
    - I like to see graphical representations of access paths. Even though I have 
    lots of experience reading SQL Trace output and the multitude of variations 
    of access path displays, I like seeing a graphical representation. The problem 
    is that Scratchpad must be installed on your client (comes embedded with 9I 
    OEM) and it doesn't like accessing 10G databases. If I am tuning a 9I database 
    and I have access to SQL Scratchpad, that is the tool I am going to use to 
    display access path information. For more information on SQL Scratchpad and 
    other 9I OEM tools, please turn to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716">&quot;Access 
    Path Identification Part V&quot;</a>.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL*PLUS Autotrace 
    - If I want to quickly display the statement's access path and associated 
    run-time performance statistics, I will use SQL*PLUS Autotrace. Here's <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-16.1691009429">a 
    blog</a> containing a few hints and tips on Autotrace. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Explain Plan 
    - If I don't want to run the query, and I am not concerned about the access 
    path changing during SQL statement execution (read next bullet), I will used 
    the tried and true &quot;explain plan into&quot; clause to ask Oracle to dump 
    the access path information into a table. I'll run a statement to retrieve 
    the data from the plan table and format the output. Please read my blogs titled 
    <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-01.4894880310">&quot;Access 
    Path Identification Part II&quot;</a> and <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-09.4712027033">&quot;Access 
    Path Identification Part III&quot;</a> for more information. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL Trace - 
    If I want to be absolutely sure that the access path the other tools are predicting 
    the statement will take matches what access path is chosen during runtime, 
    I'll run SQL Trace. It is one of the only tools you can use to determine the 
    path chosen during execution. How can the access path change during execution? 
    Read <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-11-18.7319544765">this 
    blog</a> to find out! The blog contains an example of a production problem 
    that was caused by an access path changing during runtime. For lots of information 
    on activating SQL Trace, please turn to my blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-16.1691009429">&quot;Access 
    Path Identification Part IV&quot;</a>. SQL Trace is the tool I will turn to 
    if I want to analyze a set of statements that belong to a specific online 
    transaction or batch job. The output quickly tells me what the top resource 
    consuming statements are.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">V$SQLPLAN - 
    V$SQLPLAN contains access path information the SQL statement takes during 
    execution. I'll run the statement, review the access path taken during execution, 
    make my tuning change, alter the text of the statement look different to the 
    optimizer, retrieve the access path information again and compare the before 
    and after results. My blog titled <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-01.4894880310">&quot;Access 
    Path Identification Part II&quot;</a> provides all of the information you 
    need when you are using the V$SQLPLAN table to retrieve information on access 
    paths taken during execution.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Regardless of 
    which tool I select, I will use the output to graphically display the statement's 
    access path. Although it is time consuming, graphically displaying a statement's 
    access path allows me to more clearly understand the access path and simplifies 
    the tuning process. <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-09.4712027033">This 
    blog</a> will show you how to graphically display a statement's access path. 
    </font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Another Graphical 
  Display I find Useful</b><br>
  During my career as an Oracle instructor, I was often asked in the SQL tuning 
  classes how I personally documented a query I was attempting to tune. This is 
  <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-17.4269055673/worksheet.gif/">the 
  display</a> that I showed them. Let's take a look at the contents, starting 
  from the top of the page:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL statement 
    text - the full text of the SQL statement.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Columns in the 
    SELECT clause - a listing of the columns that are in the SELECT clause are 
    displayed under the table they belong to.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Columns in the 
    WHERE clause - a listing of the columns used in the WHERE clause are displayed 
    under the table they belong to. If the columns are tables used in a join operation, 
    an arrow is used to designate which of the other table's columns they are 
    joined to. If I am interested in cardinality and data skew, I would document 
    that information directly below the column name. For more information on determining 
    column cardinality and data skew, please turn to <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-15.4209681965%20">this 
    blog</a>. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> I</font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">ndexed 
    columns - The bottom of the page contains all of the indexes that are on columns 
    in the WHERE and SELECT clauses. This allows me to easily determine if I need 
    to create additional indexes are begin analyzing why an index isn't being 
    used.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Performing the 
  Scientific Analysis</b><br>
  Before we begin, we need to understand the effect that preloading the buffers 
  has on SQL statement performance. If you run the query and return the results, 
  you will be loading the buffer cache with data. As a result, subsequent runs 
  of the same statement could be faster. This is because your statement is retrieving 
  data from memory while the initial runs were forced to retrieve the data from 
  disk. You'll need to run the statement twice, make your change and run the statement 
  twice again to ensure that buffers don't impact your timings. You can then compare 
  the output of the second execution of each test. 10G provides a SQL statement 
  to flush the buffer cache. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If you are building 
  indexes during your testing, don't forget to generate statistics on the new 
  objects. You don't want the lack of object information to affect the optimization 
  process.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">In the discussion 
  that follows, I'll be providing you with some examples of changes to make during 
  your scientific analysis. You will run the SQL statement, record the execution 
  time and statistics and document the access path. You will then make the suggested 
  alteration, review the access path to see if it has changed and run the statement 
  again to record the new performance statistics and execution time. Please note 
  that in the examples below, I'm not going to remind you each time to run the 
  query to evaluate the performance statistics and execution times. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Index Testing</b><br>
  Let's use the same sample query I used in my graphical display in this discussion:</font></p>
<blockquote>
  <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">select a.employee_id, 
    a.last_name, b.department_id, b.department_name,<br>
    c.street_address, c.postal_code, c.city, c.state_province<br>
    from hr.employees a, hr.departments b, hr.locations c<br>
    where a.department_id=b.department_id <br>
    and b.location_id=c.location_id<br>
    and a.employee_id = 174<br>
    order by a.last_name;</font></p>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">There is a myriad 
  of different changes we can make. Here's a couple of examples to get you started:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Drop all of 
    the indexes on the tables and review the access path. We know it will use 
    table scans, but what join method did it choose, how about the join order?<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Build an index 
    on one of the join columns (i.e. dept.department_id) and review the access 
    path. Determine if it chose the index, what join method was used and the order 
    in which the tables were joined.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Drop that index 
    and build an index on the other column in the join. Identify if it used the 
    index, join method and join order.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Build an index 
    on employee_id, department_id and last_name. Identify if it used the index, 
    join method and join order. Did you get an index only access path? <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Drop the index 
    you just created and change the order putting employee_id between department_id 
    and last_name. What was the access path?<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Change the 
    WHERE clause to look for rows based on the last_name and first_name columns. 
    Remove the a.employee_id = 174 clause. Build an index on the first_name and 
    last_name columns. What happened? <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Drop the index 
    built on the first_name and last_name columns and build two indexes, one on 
    first_name and the other on last_name. Did the optimizer use both indexes? 
    Which one did it choose?<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Add local predicates 
    to the other tables and identify the access path changes.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Identify a 
    column in one of the tables that has low cardinality. Change the WHERE clause 
    to access that low cardinality column. If you don't have a low cardinality 
    column available, its pretty simple to add a column and update it with a few 
    repeating values to create a low cardinality column. Build a bitmap index 
    on the low cardinality column. Did the optimizer choose the bitmap index? 
    What happens if you use a hint?<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Build a bitmap 
    index on a column that has high cardinality (i.e. employee_id). If it doesn't 
    use the bitmap index, use a hint to influence the optimizer to choose it. 
    Drop the bitmap index and build a B-tree index. Does the optimizer use that 
    index without the hint? Compare before and after execution performance statistics 
    and timing.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Identify columns 
    that have skewed data. Build an index on the skewed column. Change the query 
    to search for a value that occurs many times. Compare that execution to a 
    search on a value that appears few times. Analyze the table and build a histogram. 
    Re-execute the tests and compare the results.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Parameters that 
  Affect Optimization</b><br>
  We also need to learn how different parameter settings affect optimization. 
  We can start by adjusting a few of the basic parameters that have the best chance 
  of changing the access path for a given statement. Most of the parameters can 
  be changed in your session by using the ALTER SESSION statement. Using the ALTER 
  SESSION statement will allow you to change the parameter for your session only. 
  You won't have to worry about affecting other folks executing statements in 
  the same database that you are using for your testing. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Here's <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-24.7493837565">a 
  blog </a>that provides a listing of parameters we can use during our initial 
  testing. Please note that this is not an all inclusive list. It is a listing 
  of parameters that I feel have the greatest chance to influence the optimizer 
  to choose a different access path.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">You need to execute 
  the statement, change a parameter and note its affects on the statement's access 
  path, performance statistics and runtimes. If you are going to test changing 
  values for different parameters, don't forget to change the one you just tested 
  back to its original setting. That way you won't have multiple changes impacting 
  your test results. You can also test combinations of changes. Just be aware 
  of the changes you are making.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Hints</b><br>
  Administrators embed hints in a SQL statement to influence the optimizer to 
  choose a particular access path. Using hints will allow us to evaluate the affect 
  that different access paths have on SQL statement performance. We will run the 
  statement without any modification, review the access path and performance statistics, 
  use a hint to (hopefully) change the access path, run the statement again and 
  compare the before and after results. Since hints can be embedded in virtually 
  any SQL statement, they will provide us with an easy mechanism to learn more 
  about access paths. I have devoted <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-14.3900730733">a 
  previous blog</a> to hints. The blog also contains a demo document that will 
  show you how to embed hints and the affects the hints have on access paths. 
  One of the key tests is to determine the impact that operation cardinality has 
  on SQL statement performance. You can test this by using the ORDERED hint to 
  ask the optimizer to change the join order for statements that join more than 
  two tables together.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Conclusion</b><br>
  The tests above will hopefully stimulate your creativity and allow you to generate 
  your own test cases. As we become more experienced we'll need to review subselects, 
  views, complex selectivity issues (and the list goes on and on&#133;) Oracle 
  performance tuning is truly a wonderfully complex subject. The important thing 
  is that we start the process. That's the only way we'll become database performance 
  scientists!<br>
  </font></p><p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Thanks for Reading,</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Chris Foot <br>
  Oracle Ace <img src="http://www.remotedbaexperts.com/ace_2.gif"></font></p> ]]>
</content:encoded>
<dc:publisher>No publisher</dc:publisher>
<dc:creator>cfoot</dc:creator>
<dc:rights></dc:rights>
<dc:date>2007-03-20T12:13+00:00</dc:date>
</item>


<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-11.8660796218">
<title>Acces Path Scientific Analysis Part IV</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-11.8660796218</link>
<description>We continue our series on Oracle access path scientific analysis.  In this latest installment, we’ll do a quick review of some of the blogs that led us to this point.  We’ll also learn how to select a set of SQL statements that we will use in our test cases.</description>
<content:encoded><![CDATA[<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <B>Introduction</B><br>
  The latest installment in a series of blogs on Oracle access paths. Before we 
  begin,it is important for us to do a quick review of my previous blogs on SQL 
  performance. We'll be using this information </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">during 
  our scientific analysis phase. </font> </p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-10-28.8698342650">Let's 
    Get Technical! - Using Deductive Reasoning and Communication Skills to Identify 
    and Solve Performance Problems<br>
    </a>The first blog of this series provides some helpful hints on what questions 
    to ask during the initial stages of application performance problem analysis.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-11-04.1538832230">System 
    Triage Part II - Host Performance Analysis Using Grid Control and Host Commands<br>
    </a>Using operating system commands and 10G Grid Control to monitor database 
    server performance.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-11-10.6780804300">System 
    Triage Part III - Finding the Top Resource Consumers<br>
    </a>We learned how to use 10G Grid Standalone to identify the top resource 
    consumers for a given instance.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-11-18.7319544765">System 
    Triage IV - Access Path Identification Part I</a> <br>
    A high-level overview of Oracle query optimization. Also discussed the difference 
    between estimated and runtime access paths.<br>
    <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-01.4894880310"><br>
    </a></font></li>
  <li><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-01.4894880310"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">System 
    Triage V - Access Path Identification Part II</font></a><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
    <br>
    We reviewed the two data objects that contain access path raw data - plan_table 
    and v$sql_plan. In addition, we discussed a few of the V$ dynamic performance 
    views that provide information pertaining to SQL statements executing in our 
    Oracle database environment.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-09.4712027033">Access 
    Path Identification - Part III</a> <br>
    A discussion on the tools we can use to display graphical and text versions 
    of explain plan data including the DBMS_XPLAN package, UTLXPLS.SQL, UTLXPLP.SQL 
    and Oracle 9I Scratchpad (graphical). We also learned how to create our own 
    graphical displays of Oracle access paths.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-16.1691009429">Access 
    Path Identification - Part IV</a> <br>
    An investigation of everyone's favorite performance analysis tools - SQL*PLUS 
    Autotrace and SQL Trace.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716">Access 
    Path Identification - Part V<br>
    </a>A discussion on a couple of 9I Oracle Enterprise Manager tools that we 
    can use to identify Oracle access paths. We also learned how we can use 9I 
    OEM's SQL Analyze and the Virtual Index Wizard to help us better understand 
    access paths, monitor database performance and tune statements running in 
    an Oracle 9I database environment.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-13.9166686138">Access 
    Paths VI - 10G Grid Control SQL Details Panels</a> <br>
    We turned our attention to the 10G Grid Control's access path display panel 
    - the SQL Details Panel. It seems like no matter where you start your investigation 
    in 10G Grid Control, sooner or later, you'll end up with a panel that contains 
    a link to the SQL Details Panels. We took a look at a few of the more popular 
    ways of finding our way to them.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-19.1078911078">Access 
    Paths VII - Access Path Education</a> <br>
    Focuses on the importance of Oracle access path education. The blog contains 
    links to resources and numerous Metalink Notes that provide access path educational 
    information.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-15.4209681965">Access 
    Path Scientific Analysis Part I</a> <br>
    An introduction to Oracle Access Path Scientific Analysis. We learn why it 
    is important for us to become &quot;database performance scientists&quot; 
    if we want to fully understand Oracle access paths and the affect they have 
    on SQL statement performance. We also learned how to select a test system 
    to use as well as document the parameters and database objects that play key 
    roles in the optimization process.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-14.3900730733">Access 
    Path Scientific Analysis Part II</a> <br>
    We learn how to use hints to influence access paths for testing purposes. 
    Using hints allows us to evaluate the affect that different access paths have 
    on SQL statement performance. When we finally begin our access path scientific 
    analysis, we will run the statement without any modification, review the access 
    path and performance statistics, use a hint to change the access path, run 
    the statement again and compare the before and after results. Contains a document 
    that provides a demo on using hints to influence access paths. The demo document 
    also contains a description of some of the basic access paths that Oracle 
    can choose from.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-24.7493837565">Access 
    Path Scientific Analysis Part III</a> <br>
    An overview of the various types of indexes as well as indexing strategies 
    that affect Oracle access path selection. Also includes a list of parameter 
    that can influence the optimizer to favor index access.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Selecting SQL 
  Statements to Analyze</b><br>
  We need to select a few SQL statements that we can use as input to our scientific 
  analysis. Let's take a look at the various tools we can use to select the SQL 
  statements we can use for testing.</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Using 9I Oracle 
    Enterprise Manager - We can use the Session Details Panel to retrieve the 
    SQL text of statements that are currently executing in the database. The Session 
    Details Panel also provides the access path the statement is taking. The <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-06.1280259716">blog 
    on 9I OEM</a> will show you how to drill down to find the text of the SQL 
    statement and the access path it is taking.<br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">10G Grid Control 
    - Grid Control' s Execution Plan Panel allows administrators to display the 
    entire text of a SQL statement and the access path it is taking. This <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-01-13.9166686138">blog 
    on 10G Grid Control</a> will show you how to navigate through the various 
    panels to access the Execution Plan Panel. <br>
    <br>
    </font></li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">SQL Trace - 
    If we don't have access to the &quot;SGTs&quot; (Sissy GUI Tools), all is 
    not lost. We can also use the SQL Trace utility to capture the text of the 
    SQL statement as well as its access path. To use this method, we would contact 
    one of our friendly application developers and ask them to run a series of 
    batch jobs or online transactions in the environment we have selected as our 
    test bed. <br>
    <br>
    We can then activate SQL Trace, contact the developer to run the selected 
    workload, deactivate the trace and format the trace's output into an easily 
    readable format. SQL Trace provides the benefit of allowing us to capture 
    multiple SQL statement access paths in a single execution. The <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2006-12-16.1691009429">blog 
    on Autotrace and SQL Trace</a> provides instructions on how to activate the 
    SQL Trace utility.</font></li>
</ul>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>What Statements 
  Should I Choose?</b><br>
  We are looking for statements that utilize the different Oracle access paths. 
  Try and find statements that use:</font></p>
<ul>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Table scan and 
    index access paths: <br>
    <br>
    </font> 
    <ul>
      <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Index only 
        - Oracle is able to read all of the data required to satisfy the query's 
        data needs from the index structure alone. <br>
        <br>
        </font></li>
      <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Index to 
        table - Oracle uses a row identifier to probe the table to satisfy the 
        data request. <br>
        <br>
        </font></li>
      <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Full table 
        scan - Oracle reads all rows from the table. Oracle will scan the table 
        to the last block used (as opposed to the last block that actually contains 
        data).<br>
        <br>
        </font></li>
    </ul>
  </li>
  <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Join access 
    paths:<br>
    Used when the statement retrieves data based on matches between two tables 
    (i.e. retrieve all of the employees that have the department name of &quot;Welding&quot;). 
    The employee information is contained in the employee table and the department 
    information (including the department name) is in the department table.<br>
    <br>
    </font> 
    <ul>
      <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> Nested 
        loop join - Good path when the join is accessing a small subset of rows. 
        <br>
        <br>
        </font></li>
      <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Hash join 
        - Efficient access path for joins that access larger sets of data. <br>
        <br>
        </font></li>
      <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Sort merge 
        join - Sorts rows to allow quicker access during the join. </font><br>
        <br>
      </li>
      <li><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Outer joins 
        - An outer join returns all of the rows that satisfy the particular join 
        condition and returns additional rows from one table that do not satisfy 
        the join condition.</font></li>
    </ul>
  </li>
</ul>
<blockquote>
  <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We don't have 
    to find each and every access path I outlined above. In addition, each statement 
    that does a join will also contain table scan and/or index access paths. Try 
    to find statements that access a single table and statements that join two, 
    three and four tables together. It should be relatively easy to find the nested 
    loop and hash join access paths. Sort merge and outer joins may be a little 
    harder to find. Try and stay away from SQL statements that use parallel processing, 
    are 13 pages long or join 5 or more tables together. We want to start with 
    the basics. We also don't want to use statements that have exorbitantly long 
    execution times. We'll be executing them on a fairly regular basis during 
    testing and waiting hours for the results will lengthen the testing process.</font></p>
</blockquote>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Next Up</b><br>
  We devise our scientific analysis testing process.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Almost Forgot</b><br>
  How are the Daylight Savings Time changes treating you? I may break in one last 
  time to discuss their impact on our organization.<br>
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Thanks for Reading,</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Chris Foot <br>
  Oracle Ace <img src="http://www.remotedbaexperts.com/ace_2.gif"></font></p> ]]>
</content:encoded>
<dc:publisher>No publisher</dc:publisher>
<dc:creator>cfoot</dc:creator>
<dc:rights></dc:rights>
<dc:date>2007-03-12T06:18+00:00</dc:date>
</item>


<item rdf:about="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-04.1596857853">
<title>DST Deadline - One Week and Counting</title>
<link>http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-03-04.1596857853</link>
<description>Although I didn’t want to break the flow of our series on access path scientific analysis, it is important for us to review the upcoming DST changes one last time.   We’ll return to our original discussion on access paths in my next blog.</description>
<content:encoded><![CDATA[<font face="Verdana, Arial, Helvetica, sans-serif" size="2"> We should all know 
by now that the DST changes will impact many of this systems we are charged with 
supporting. Since we administer a LOT of different environments here, I thought 
it may be helpful to discuss some of our findings.</font> 
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>The Problem</b><br>
  Before we begin, we need to understand exactly what the problem is. If you haven't 
  read my previous blogs on this topic, I highly suggest you do so before continuing.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Metalink DST 
  Information</b><br>
  In my <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-03.3876734950">first 
  blog on DST</a>, I provided you with numerous links to Metalink Notes that focused 
  on Daylight Saving Time. In <a href="http://www.dbazine.com/blogs/blog-cf/chrisfoot/blogentry.2007-02-03.3876734950">my 
  second blog</a>, I provided a link to Oracle's new Metalink support category 
  on DST. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Updates</b><br>
  We have patched dozens of databases and operating systems since I wrote that 
  first blog on DST. I've compiled a a few notes on what we have found:</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Operating System 
  Patches</b><br>
  <br>
  <b>Windows<br>
  </b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We have 
  patched all of our customers database servers that we are responsible for providing 
  OS support for and have experienced no issues. But some of our customers have 
  notified us that they have experienced problems when they patched their mail 
  and application servers. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If one implementation 
  experiences a problem, you have a tendency to chalk that one up to that specific 
  environment. When multiple implementations experience problems, we decided to 
  inform our entire customer base of the potential for issues. Especially when 
  we know that several of the customers that reported problems have top-notch 
  Windows administrators on staff.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">All of the environments 
  had test and production operating systems that were configured to mirror each 
  other as closely as possible. The test patches worked as advertised but a few 
  of their production environments failed. Either the patch wasn't applied successfully 
  or the environment refused to work after the patch was applied. In one case, 
  Microsoft support had the administrator apply the patch again using the exact 
  same steps and it worked the second time. Go figure. Several of the other customers 
  were asked by Microsoft support to make various changes to their O/S configuration 
  and attempt the patch a second time. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">A few of our customers 
  experienced mail performance problems because the DST patch caused the mail 
  engine to generate dozens (upon dozens) of meeting time updates. The DST patch 
  forces the mail engine to change the meeting times for all meetings that were 
  sheduled between March 11 (new DST date) and April 1 (old DST date). </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I do apologize 
  that I don't have specifics on the the other issues. I do know that each fix 
  was specific to that environment. I know that this may seem not very helpful 
  at this time but I think a general warning was warranted. <br>
  </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Recommendations<br>
  </b> Just because all of your test patches worked, don't assume that the production 
  environment will also be successful. When you patch the production environment, 
  be prepared for issues that did not occur during the test patches. You can't 
  blame Microsoft either; test and production environments that are configured 
  &quot;as closely to each other as possible&quot; aren't mirror images of each 
  other. Close doesn't count when it comes to operating system/hardware configurations. 
  Visit Microsoft's website regularly to ensure that there is no additional information 
  you need to be aware of.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><br>
  UNIX, LINUX</b><br>
  Our O/S admins experienced a few minor issues with UNIX and Linux. Please remember 
  - if the server has its own Java engine (and you run Java programs on the O/S), 
  your best bet is to patch both the operating system and the Java engine. We 
  did find that several O/S vendors were updating their DST patching instructions 
  on a regular basis.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Recommendations</b><br>
  Don't forget to patch that Java engine too! Visit your O/S vendor's website 
  regularly to ensure that there is no additional information you need to be aware 
  of.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
  <b>Oracle Database Patches</b><br>
  The biggest issue we had was with Oracle's updates to the DST patching documentation. 
  Since we were required to do a LOT of patching, it was important for us to get 
  a head start. In the middle of January, we download all of the DST documentation 
  and studied the information. We then created our plan of attack and began implementing 
  it.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">We also checked 
  the DST area on Metalink every few days for updates. Here's where the problem 
  arose. Some of the database patching documentation (10G specifically) can be 
  described as &quot;somewhat fluid&quot; in nature. Our DST coordinator, Brian 
  &quot;Captain Patch&quot; Hays found that some of the changes forced him to 
  assemble his DST team to review their impact. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Although the updated 
  documentation did not force us to redo any patches, we did have to revisit several 
  of the environments that we already patched to ensure that we didn't have to 
  reapply them. In one case, the initial documentation did not provide a complete 
  listing of DST datatypes that could be used in table definitions. We reviewed 
  each of the environments looking for tables containing the additional DST datatypes 
  and were pleased to find that none were in use. I can state that when we did 
  apply the database patches (both for the database and the Oracle Java Engine), 
  they worked flawlessly. </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Recommendations<br>
  </b>We intend to check for updates to all Oracle DST documentation until March 
  11. I would highly suggest that you also do so.<br>
  <br>
  <br>
  <b>Oracle Application Server</b><br>
  Oracle's application server was the biggest challenge. Oracle recommended numerous 
  patches for the infrastructure database to ensure DST compliance. Many of the 
  patches required that the infrastructure database be at a specific release. 
  Oracle also recommended that we apply DST patches to all of the target databases 
  that could potentially be accessed by the application server. Once again, all 
  of the patches worked.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>Recommendations<br>
  </b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">If yo