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

<channel>
	<title>Striving for Optimal PerformanceStriving for Optimal Performance</title>
	<atom:link href="http://www.antognini.ch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.antognini.ch</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 05:14:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Named Notation and SEM_MATCH Table Function</title>
		<link>http://www.antognini.ch/2013/06/named-notation-and-sem_match-table-function/</link>
		<comments>http://www.antognini.ch/2013/06/named-notation-and-sem_match-table-function/#comments</comments>
		<pubDate>Thu, 13 Jun 2013 21:50:01 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[11gR2]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[RDF Semantic Graph]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2256</guid>
		<description><![CDATA[This is a short post about a strange behavior I discovered today&#8230; The fact is that it is not really possible to use the named notation with the SEM_MATCH table function. In fact, even though the parameter’s names can be specified, the order of the parameters overrides the specification done with the named notation!?! Here [...]]]></description>
			<content:encoded><![CDATA[<p>This is a short post about a strange behavior I discovered today&#8230;</p>
<p>The fact is that it is not really possible to use the named notation with the <a href="http://docs.oracle.com/cd/E11882_01/appdev.112/e25609/sdo_rdf_concepts.htm#autoId18" title="Oracle Database Semantic Technologies Developer’s Guide 11g Release 2 - Using the SEM_MATCH Table Function to Query Semantic Data" target="_blank">SEM_MATCH</a> table function. In fact, even though the parameter’s names can be specified, the order of the parameters overrides the specification done with the named notation!?! </p>
<p>Here is an example:</p>
<ul>
<li>With positional notation everything works as expected</li>
</ul>
<pre>SQL> SELECT count(*)
  2  FROM table(
  3    sem_match('SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              sem_models('SEMDEMO_WORK'),
  5              NULL,
  6              sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  7              NULL
  8    )
  9  );

  COUNT(*)
----------
       601
</pre>
<ul>
<li>The named notation seems to be supported&#8230; (notice that the parameters are specified in the same order as they are defined in the table function)</li>
</ul>
<pre>SQL> SELECT count(*)
  2  FROM table(
  3    sem_match(query     => 'SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              models    => sem_models('SEMDEMO_WORK'),
  5              rulebases => NULL,
  6              aliases   => sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  7              filter    => NULL
  8    )
  9  );

  COUNT(*)
----------
       601
</pre>
<ul>
<li>&#8230; but when the parameters are not specified in the same order as they are defined (the RULEBASES and ALIASES parameters were swapped), a PLS-00306 is raised!</li>
</ul>
<pre>SQL> SELECT count(*)
  2  FROM table(
  3    sem_match(query     => 'SELECT * WHERE { GRAPH :gCH { ?s ?p ?o } }',
  4              models    => sem_models('SEMDEMO_WORK'),
  5              aliases   => sem_aliases(sem_alias(NULL,'http://www.semwebtech.org/mondial/10/meta#')),
  6              rulebases => NULL,
  7              filter    => NULL
  8    )
  9  );

SELECT count(*)
*
ERROR at line 1:
ORA-06550: line 4, column 13:
PLS-00306: wrong number or types of arguments in call to 'ODCITABLEDESCRIBE'
ORA-06550: line 4, column 6:
PL/SQL: Statement ignored
</pre>
<p>As a result, even though using the named notation is better for readability, the order of the parameters cannot be changed! I&#8217;m puzzled.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2013/06/named-notation-and-sem_match-table-function/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ITL Deadlocks (script)</title>
		<link>http://www.antognini.ch/2013/05/itl-deadlocks-script/</link>
		<comments>http://www.antognini.ch/2013/05/itl-deadlocks-script/#comments</comments>
		<pubDate>Wed, 01 May 2013 06:07:18 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[10gR2]]></category>
		<category><![CDATA[11gR1]]></category>
		<category><![CDATA[11gR2]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2220</guid>
		<description><![CDATA[A reader of this blog, VijayS, asked me to share the script I use to demo ITL deadlocks that I mentioned in this comment. Since other readers might be interested, here is the script. SET TERMOUT ON FEEDBACK ON VERIFY OFF SCAN ON ECHO ON @connect SELECT * FROM v$version WHERE rownum = 1; REM [...]]]></description>
			<content:encoded><![CDATA[<p>A reader of this blog, VijayS, <a href="/2011/06/itl-waits-changes-in-recent-releases-script/#comment-1684">asked me</a> to share the script I use to demo ITL deadlocks that I mentioned in <a href="/2011/04/itl-waits-changes-in-recent-releases/#comment-486">this comment</a>. Since other readers might be interested, here is the script.</p>
<pre>SET TERMOUT ON FEEDBACK ON VERIFY OFF SCAN ON ECHO ON

@connect

SELECT * FROM v$version WHERE rownum = 1;

REM
REM cleanup
REM

DROP TABLE t PURGE;

PAUSE

REM
REM create a test table with three completely full data blocks
REM (default tablespace is expected to have 8KB blocks)
REM

CREATE TABLE t (n NUMBER, c VARCHAR2(4000)) PCTFREE 0;

INSERT INTO t SELECT rownum, rpad('*',2679,'*') FROM dual CONNECT BY level <= 9;
COMMIT;

SELECT dbms_rowid.rowid_block_number(rowid), n
FROM t
ORDER BY n;

PAUSE

REM
REM in this session modify two rows: one in the first block and one in the
REM third block
REM

SET SQLPROMPT " 1 > "

SELECT sid FROM v$session WHERE audsid = userenv('sessionid');

UPDATE t SET n=n*10 WHERE n IN (1,7);

PAUSE

REM
REM in another session (called session #2) modify two rows: one in the first
REM block and one in the second block
REM
REM @connect
REM SET SQLPROMPT " 2 > "
REM
REM SELECT sid FROM v$session WHERE audsid = userenv('sessionid');
REM UPDATE t SET n=n*10 WHERE n IN (2,5);
REM

PAUSE

REM
REM in another session (called session #3) try to modify one row per block;
REM since all ITL slots of the first block are taken, wait...
REM
REM @connect
REM SET SQLPROMPT " 3 > "
REM
REM SELECT sid FROM v$session WHERE audsid = userenv('sessionid');
REM UPDATE t SET n=n*10 WHERE n = 9;
REM UPDATE t SET n=n*10 WHERE n = 6;
REM UPDATE t SET n=n*10 WHERE n = 3;
REM

PAUSE

REM
REM in this session try to modify one row in the second block and, in addition,
REM in session #2, try to modify one row in the third block; since all ITL slots
REM of the second and third block are taken, wait..., deadlock...
REM

REM run "UPDATE t SET n=n*10 WHERE n = 8;" in session #2

UPDATE t SET n=n*10 WHERE n = 4;
</pre>
<p>Notice that:</p>
<ul>
<li>the remarks contained in the script provide important information for understanding what the script does and, as a result, for being able to produce a ITL deadlock</li>
<li>to run the script three sessions are required (when running the script I copy/paste the commands from the output of the terminal running the script to the other two terminals)</li>
</ul>
<p>To give you an example of what it looks like when you run it, here is a recording:</p>
<div>
<style type="text/css">
#movie
{
	width: 652px;
	height: 780px;
}
</style>
<p><object id="movie" type="application/x-shockwave-flash" data="/downloads/itl_deadlock.swf"><param name="movie" value="/downloads/itl_deadlock.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><p>You do not have the latest version of Flash installed. Please visit this link to download it: <a href="http://www.adobe.com/products/flashplayer/">http://www.adobe.com/products/flashplayer/</a></p>
<p></object>
</div>
<p>The deadlock graph generated by the run that I recorded is the following one. Notice that the rows waited on are set to &#8220;no row&#8221;.</p>
<pre>                       ---------Blocker(s)--------  ---------Waiter(s)---------
Resource Name          process session holds waits  process session holds waits
TX-00090013-00001b44        25     140     X             23     147           S
TX-0007001d-000019a9        23     147     X             25     140           S

session 140: DID 0001-0019-00000D23     session 147: DID 0001-0017-000004BC
session 147: DID 0001-0017-000004BC     session 140: DID 0001-0019-00000D23

Rows waited on:
  Session 140: no row
  Session 147: no row</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2013/05/itl-deadlocks-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Premature Optimization</title>
		<link>http://www.antognini.ch/2013/03/premature-optimization/</link>
		<comments>http://www.antognini.ch/2013/03/premature-optimization/#comments</comments>
		<pubDate>Thu, 14 Mar 2013 23:30:37 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[TOP]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2204</guid>
		<description><![CDATA[Premature optimization, (probably) because of Donald Knuth’s famous line “premature optimization is the root of all evil,” (see Structured Programming with go to Statements) is, at the very least, a controversial topic. The misconception based on that particular quote is that a programmer, while writing code, should ignore optimization altogether. In my opinion this is [...]]]></description>
			<content:encoded><![CDATA[<p>Premature optimization, (probably) because of Donald Knuth’s famous line “premature optimization is the root of all evil,” (see <a href="http://dl.acm.org/citation.cfm?id=356640">Structured Programming with go to Statements</a>) is, at the very least, a controversial topic. The misconception based on that particular quote is that a programmer, while writing code, should ignore optimization altogether. In my opinion this is wrong. To put the quote in context, let’s have a look to at the text that precedes and follows it:</p>
<blockquote><p>There is no doubt that the grail of efficiency leads to abuse. Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%. A good programmer will not be lulled into complacency by such reasoning, he will be wise to look carefully at the critical code; but only after that code has been identified. It is often a mistake to make a priori judgments about what parts of a program are really critical, since the universal experience of programmers who have been using measurement tools has been that their intuitive guesses fail.</p></blockquote>
<p>My take on Knuth’s paper is that programmers, when writing code, should not care about micro optimization that has local impact only. Instead, they should care about optimizations that have global impact, like the design of a system, the algorithms used to implement the required functionality, or in which layer (SQL, PL/SQL, application language) and with which features a specific processing should be performed. Local optimizations are deferred till a measurement tool points out that a specific part of the code is spending too much time executing. And, because the optimization is local, there is no impact on the overall design of the system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2013/03/premature-optimization/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Ad: CBO Days 2012 &#8211; Final Agenda</title>
		<link>http://www.antognini.ch/2012/11/ad-cbo-days-2012-final-agenda/</link>
		<comments>http://www.antognini.ch/2012/11/ad-cbo-days-2012-final-agenda/#comments</comments>
		<pubDate>Wed, 28 Nov 2012 10:58:12 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[Query Optimizer]]></category>
		<category><![CDATA[Speaking]]></category>
		<category><![CDATA[Trivadis]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2182</guid>
		<description><![CDATA[The 11th and 12th of December and, therefore, the CBO Days in Zurich are approaching. Given the high quality of the speakers that accepted my invitation and the number of people that decided to attend the event, in my opinion it will be a blast! By the way, if you are interested in attending the [...]]]></description>
			<content:encoded><![CDATA[<p>The 11th and 12th of December and, therefore, the CBO Days in Zurich are approaching. Given the high quality of the speakers that accepted my invitation and the number of people that decided to attend the event, in my opinion it will be a blast! By the way, if you are interested in attending the event, do not wait any longer. In fact, from the 80 available seats, 75 are taken. </p>
<p>Here is a preview of the agenda:</p>
<p><strong>Tuesday 11th December</strong></p>
<ul>
<li>09:00 – 09:10: Welcome and Introduction, Christian Antognini</li>
<li>09:10 – 10:30: The History of the Oracle Optimizer, Maria Colgan</li>
<li>10:30 – 11:00: Coffee break</li>
<li>11:00 – 12:20: Query Transformations, Joze Senegacnik</li>
<li>12:20 – 13:50: Lunch</li>
<li>13:50 – 15:10: New strategies for Statistics in 11g, Jonathan Lewis</li>
<li>15:10 – 15:40: Coffee break</li>
<li>15:40 – 17:00: Understanding Parallel Execution, Randolf Geist</li>
<li>17:00 – 19:00: Let&#8217;s meet over drinks</li>
</ul>
<p><strong>Wednesday 12th December</strong></p>
<ul>
<li>09:00 – 10:20: The Evolution of Histograms, Jonathan Lewis</li>
<li>10:20 – 10:50: Coffee break</li>
<li>10:50 – 11:20: The Oracle Optimizer: Behind The Curtain, Mohamed Zait</li>
<li>11:20 – 12.10: The Oracle Optimizer: An Insider Perspective (Part 1), Mohamed Zait</li>
<li>12:10 – 13:40: Lunch</li>
<li>13:40 – 15:00: The Oracle Optimizer: An Insider Perspective (Part 2), Mohamed Zait</li>
<li>15:00 – 15:30: Coffee break</li>
<li>15:30 – 16:50: How the Query Optimizer Learns from Its Mistakes, Christian Antognini</li>
</ul>
<p>For further information about the event click <a href="http://www.trivadis.com/cbo" title="Trivadis CBO Days 2012">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2012/11/ad-cbo-days-2012-final-agenda/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Does the Parse Time Increase Linearly with the Number Of Child Cursors?</title>
		<link>http://www.antognini.ch/2012/10/does-the-parse-time-increase-linearly-with-the-number-of-child-cursors/</link>
		<comments>http://www.antognini.ch/2012/10/does-the-parse-time-increase-linearly-with-the-number-of-child-cursors/#comments</comments>
		<pubDate>Wed, 24 Oct 2012 00:42:39 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[11gR2]]></category>
		<category><![CDATA[Library Cache]]></category>
		<category><![CDATA[Oracle Database]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2096</guid>
		<description><![CDATA[In the last post I discussed a test case generating lot of child cursors. Today I wanted to show you, for the very same test case, that in 11.2 the parse time might increases linearly with the number of child cursors per parent cursor. This is the expected behavior. In fact, to check whether an [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="/2012/10/how-many-children-can-a-parent-cursor-have-1000000/" title="How Many Children Can a Parent Cursor Have? 1,000,000?">the last post</a> I discussed a test case generating lot of child cursors. Today I wanted to show you, for the very same test case, that in 11.2 the parse time might increases linearly with the number of child cursors per parent cursor. This is the expected behavior. In fact, to check whether an already available child cursor can be reused, the list of child cursors must be scanned. And, in case no one of the already available child cursors is compatible, every entry needs to be probed.</p>
<p><a href="/images/parse_time_11202.png" rel="lightbox" title="Parse Time - 11.2.0.2" ><img src="/images/parse_time_11202.png" /></a></p>
<p>Note that to generate the previous chart I simply run, in 11.2.0.2, the PL/SQL block of <a href="/2012/10/how-many-children-can-a-parent-cursor-have-1000000/" title="How Many Children Can a Parent Cursor Have? 1,000,000?">the previous post</a> while SQL trace was enabled. Then I extracted from the trace file the elapsed time for every parse operation and loaded the values in Excel.</p>
<p>In 11.2.0.3, because of the artificial limitation of the number of child cursors per parent cursor, the parse time is almost constant. Notice, however, that in this case the number of child cursors is spread across a lot of parent cursors, not a single one as in 11.2.0.2.</p>
<p><a href="/images/parse_time_11203.png" rel="lightbox" title="Parse Time 11.2.0.3" ><img src="/images/parse_time_11203.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2012/10/does-the-parse-time-increase-linearly-with-the-number-of-child-cursors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How Many Children Can a Parent Cursor Have? 1,000,000?</title>
		<link>http://www.antognini.ch/2012/10/how-many-children-can-a-parent-cursor-have-1000000/</link>
		<comments>http://www.antognini.ch/2012/10/how-many-children-can-a-parent-cursor-have-1000000/#comments</comments>
		<pubDate>Fri, 19 Oct 2012 12:15:43 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[11gR2]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Library Cache]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2087</guid>
		<description><![CDATA[The patch set 11.2.0.3 includes a fix for bug# 10187168 which, in reality, is an enhancement request. Its purpose is to artificially limit the number of child cursors that a parent cursor can have. The concept is quite easy: when a parent cursor reaches _cursor_obsolete_threshold (default value is 100) child cursors the parent cursor is [...]]]></description>
			<content:encoded><![CDATA[<p>The patch set 11.2.0.3 includes a fix for <a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=10187168.8" title="Bug 10187168  Enhancement to obsolete parent cursors if VERSION_COUNT exceeds a threshold" target="_blank">bug# 10187168</a> which, in reality, is an enhancement request. Its purpose is to artificially limit the number of child cursors that a parent cursor can have. The concept is quite easy: when a parent cursor reaches _cursor_obsolete_threshold (default value is 100) child cursors the parent cursor is obsoleted and, as a result, a new one is created.</p>
<p>So, as of 11.2.0.3 (or with some PSUs and bundle patches), the answer to the question is: 100.</p>
<p>But how many child cursors are supported in previous 11.2 releases? This is a question that crossed my mind few weeks ago while preparing for the “Shareable Cursors” presentation that I gave at the <a href="http://oaktableworld.com/" title="OakTable World" target="_blank">OakTable World</a> in San Francisco. Is it for example possible to have a parent cursor with 1,000,000 child cursors? Not that something like that is sensible, but I would like to know whether it is technically possible. In other words, whether the database engine supports it.</p>
<p>To try answering the question, I wrote and run on 11.2.0.2 the following test case. Notice that the PL/SQL block is able, if there is enough memory, to create 1,000,000 child cursors. Hence, before running it, I increased the shared pool size to 10GB.</p>
<pre>SQL> CREATE TABLE t (n NUMBER);

Table created.

SQL> INSERT INTO t VALUES (1);

1 row created.

SQL> COMMIT;

Commit complete.

SQL> execute dbms_stats.gather_table_stats(user,'t')

PL/SQL procedure successfully completed.

SQL> DECLARE
  2    l_count PLS_INTEGER;
  3  BEGIN
  4    FOR oic IN 1..100
  5    LOOP
  6      EXECUTE IMMEDIATE 'ALTER SESSION SET optimizer_index_caching = '||oic;
  7      FOR oica IN 1..10000
  8      LOOP
  9        EXECUTE IMMEDIATE 'ALTER SESSION SET optimizer_index_cost_adj = '||oica;
 10        EXECUTE IMMEDIATE 'SELECT count(*) FROM t' into l_count;
 11      END LOOP;
 12    END LOOP;
 13  END;
 14  /
DECLARE
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 6809
Session ID: 7 Serial number: 9</pre>
<p>As you can see the result is interesting <img src='http://www.antognini.ch/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>In the alert.log I found the following information:</p>
<pre>Errors in file /u00/app/oracle/diag/rdbms/dbm11202/DBM11202/trace/DBM11202_ora_6809.trc  (incident=25425):
ORA-00600: internal error code, arguments: [15206], [], [], [], [], [], [], [], [], [], [], []
Incident details in: /u00/app/oracle/diag/rdbms/dbm11202/DBM11202/incident/incdir_25425/DBM11202_ora_6809_i25425.trc</pre>
<p>As always, when I see this kind of error, I check the <a href="https://support.oracle.com/epmos/faces/DocumentDisplay?id=153788.1" title="ORA-600/ORA-7445/ORA-700 Error Look-up Tool" target="_blank">ORA-600/ORA-7445/ORA-700 Error Look-up Tool</a>. Unfortunately, in this case, no information is provided. So I continued investigating the issued by looking at the trace file generated for the incident. As expected the SQL statement hitting the problem was the following:</p>
<pre>----- Current SQL Statement for this session (sql_id=5tjqf7sx5dzmj) -----
SELECT count(*) FROM t</pre>
<p>And the library cache content for the associated cursor was the following:</p>
<pre>      LibraryHandle:  Address=0x2c5e4d030 Hash=3a56fe71 LockMode=N PinMode=0 LoadLockMode=0 Status=VALD
        ObjectName:  Name=SELECT count(*) FROM t
          FullHashValue=6d0bd54734bada875cc6ce3e3a56fe71 Namespace=SQL AREA(00) Type=CURSOR(00) Identifier=978779761 OwnerIdn=36
        Statistics:  InvalidationCount=0 ExecutionCount=65535 LoadCount=65536 ActiveLocks=51 TotalLockCount=65536 TotalPinCount=1
        Counters:  BrokenCount=1 RevocablePointer=1 KeepDependency=65535 BucketInUse=0 HandleInUse=0 HandleReferenceCount=0
        Concurrency:  DependencyMutex=0x2c5e4d0e0(0, 4097, 0, 0) Mutex=0x2c5e4d160(0, 5120057, 12919, 0)
        Flags=RON/PIN/TIM/PN0/DBN/[10012841]
        WaitersLists:
          Lock=0x2c5e4d0c0[0x2c5e4d0c0,0x2c5e4d0c0]
          Pin=0x2c5e4d0a0[0x2c5e4d0a0,0x2c5e4d0a0]
        Timestamp:  Current=10-19-2012 07:02:48
        HandleReference:  Address=0x2c5e4d1e0 Handle=(nil) Flags=[00]
        LibraryObject:  Address=0x2c5e4bfc0 HeapMask=0000-0001-0001-0000 Flags=EXS[0000] Flags2=[0000] PublicFlags=[0000]
          ChildTable:  size='65536'
            Child:  id='0' Table=0x2c5e4ce70 Reference=0x2c5e4c898 Handle=0x2c5e4bbd0
            Child:  id='1' Table=0x2c5e4ce70 Reference=0x2c5e4cd58 Handle=0x2c5dd4338
            Child:  id='2' Table=0x2c5e4ce70 Reference=0x2c5dce0d0 Handle=0x2c5dcdae8
            Child:  id='3' Table=0x2c5e4ce70 Reference=0x2c5dce568 Handle=0x2c5dc8298
            Child:  id='4' Table=0x2c5e4ce70 Reference=0x2c5dcea00 Handle=0x2c5dc2a48
            …
            Child:  id='65530' Table=0x2846e56d8 Reference=0x2846b07e8 Handle=0x2846b03d8
            Child:  id='65531' Table=0x2846e56d8 Reference=0x2846b0c80 Handle=0x2846ad188
            Child:  id='65532' Table=0x2846e56d8 Reference=0x2846b1118 Handle=0x2846a9f38
            Child:  id='65533' Table=0x2846e56d8 Reference=0x2846a60f8 Handle=0x2846a5ce8
            Child:  id='65534' Table=0x2846e56d8 Reference=0x2846a6590 Handle=0x2846a2a98</pre>
<p>The most interesting part is the one providing the number of child cursors: 65536.</p>
<p>I might be wrong but to me that means that the child number is stored as an unsigned integer taking 16 bits. And, when the maximum is exceeded, an ORA-00600 is raised. </p>
<p>According to this test the maximum number of child cursors for a given parent cursor is 65536. But, as already written, the fix for bug# 10187168 artificially limits it to 100.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2012/10/how-many-children-can-a-parent-cursor-have-1000000/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ad: CBO Days 2012</title>
		<link>http://www.antognini.ch/2012/09/ad-cbo-days-2012/</link>
		<comments>http://www.antognini.ch/2012/09/ad-cbo-days-2012/#comments</comments>
		<pubDate>Thu, 27 Sep 2012 11:51:30 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[Query Optimizer]]></category>
		<category><![CDATA[Speaking]]></category>
		<category><![CDATA[Trivadis]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2076</guid>
		<description><![CDATA[The company I work for, Trivadis, is very pleased to organize, the 11th and 12th of December, an outstanding seminar with top guest speakers in Zurich. This year’s focus will be on the Oracle query optimizer, also known as a cost-based optimizer (CBO). The query optimizer is not only one of the most complex pieces [...]]]></description>
			<content:encoded><![CDATA[<p>The company I work for, Trivadis, is very pleased to organize, the 11th and 12th of December, an outstanding seminar with top guest speakers in Zurich. This year’s focus will be on the Oracle query optimizer, also known as a cost-based optimizer (CBO).</p>
<p>The query optimizer is not only one of the most complex pieces of software that constitutes the Oracle kernel; it is also one of the most unappreciated. Why? To make the best and most efficient use of the query optimizer, you definitely need to understand how it works. This is exactly what we are aiming for at the CBO Days.</p>
<p>Enjoy the two days with:<br />
- Jonathan Lewis, JL Computer Consultancy (GB)<br />
- Jože Senegačnik, DbProf (SI)<br />
- Maria Colgan, Optimizer product manager, Oracle Corporation (USA)<br />
- Mohamed Zait, Optimizer chief developer, Oracle Corporation (USA)<br />
- Randolf Geist, Freelance (DE)<br />
- Christian Antognini, Trivadis (CH)</p>
<p>For further information please click <a href="http://www.trivadis.com/cbo" title="Trivadis CBO Days 2012">here</a>.</p>
<p><strong>EARL BIRD BOOKINGS</strong>: 15% discount if you enroll until November 1st. I look forward to meet you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2012/09/ad-cbo-days-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event 10046 &#8211; Full List of Levels</title>
		<link>http://www.antognini.ch/2012/08/event-10046-full-list-of-levels/</link>
		<comments>http://www.antognini.ch/2012/08/event-10046-full-list-of-levels/#comments</comments>
		<pubDate>Fri, 10 Aug 2012 08:49:45 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[11gR1]]></category>
		<category><![CDATA[11gR2]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[SQL Trace]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2037</guid>
		<description><![CDATA[Extended SQL trace (a.k.a. debugging event 10046 at a level higher than 1) is one of the key features provided by Oracle to troubleshoot applications using Oracle Database. For many years the available levels were always the same (4, 8 and 12). In fact, since I wrote my first paper about it in May 2000 [...]]]></description>
			<content:encoded><![CDATA[<p>Extended SQL trace (a.k.a. debugging event 10046 at a level higher than 1) is one of the key features provided by Oracle to troubleshoot applications using Oracle Database. For many years the available levels were always the same (4, 8 and 12). In fact, since I wrote <a title="Tracing Bind Variables and Waits" href="/papers/Tracing_Bind_Variables_and_Waits_20000507.pdf" target="_blank">my first paper</a> about it in May 2000 and the release of 11g nothing changed.</p>
<p>With 11g, as I described in <a title="11g New Feature in DBMS_MONITOR" href="/2009/02/11g-new-feature-in-dbms_monitor/" target="_blank">this post</a>, new levels (16 and 32) were introduced.</p>
<p>More recently, with the introduction of the <a title="  Bug 8328200  Misleading or excessive STAT# lines for SQL_TRACE / 10046 " href="https://support.oracle.com/epmos/faces/ui/km/DocContentDisplay.jspx?id=8328200.8" target="_blank">fix for bug 8328200</a>, a new one was added to the list (64).</p>
<p>So, I thought it was time to publish the current list of available levels…</p>
<table>
<th><strong>Level</strong></th>
<th><strong>Description</strong></th>
<tr>
<td>0</td>
<td>The debugging event is disabled.</td>
</tr>
<tr>
<td>1</td>
<td>The debugging event is enabled. For each processed database call, the following information is given: SQL statement, response time, service time, number of processed rows, number of logical reads, number of physical reads and writes, execution plan, and little additional information.<br />
Up to 10.2 an execution plan is written to the trace file only when the cursor it is associated with is closed. The execution statistics associated to it are values aggregated over all executions.<br />
As of 11.1 an execution plan is written to the trace file only after the first execution of every cursor. The execution statistics associated to it are the ones of the first execution only.
</td>
</tr>
<tr>
<td>4</td>
<td>As in level 1, with additional information about bind variables. Mainly, the data type, its precision, and the value used for each execution.</td>
</tr>
<tr>
<td>8</td>
<td>As in level 1, plus detailed information about wait time. For each wait experienced during the processing, the following information is given: the name of the wait event, the duration, and a few additional parameters identifying the resource that has been waited for.</td>
</tr>
<tr>
<td>16</td>
<td>As in level 1, plus the execution plans information is written to the trace file for each execution. Available as of 11.1 only.</td>
</tr>
<tr>
<td>32</td>
<td>As in level 1, but without the execution plans information. Available as of 11.1 only.</td>
</tr>
<tr>
<td>64</td>
<td>As in level 1, plus the execution plans information might be written for executions following the first one. The condition is that, since the last write of execution plans information, a particular cursor consumed at least one additional minute of DB time. This level is interesting in two cases. First, when the information about the first execution is not enough for analysing a specific issue. Second, when the overhead of writing the information about every execution (level 16) is too high. Generally available as of 11.2.0.2  only.</td>
</tr>
</table>
<p>In addition to the levels described in the previous table, you can also combine the levels 4 and 8 with every other level greater than 1. For example:</p>
<ul>
<li>Level 12 (4 + 8): simultaneously enable level 4 and level 8.</li>
<li>Level 28 (4 + 8 + 16): simultaneously enable level 4, level 8 and level 16.</li>
<li>Level 68 (4 + 64): simultaneously enable level 4 and level 64.</li>
</ul>
<p>If you are using dbms_monitor or dbms_session for enabling extended SQL trace, here is the mapping between the levels and the parameters:</p>
<ul>
<li>Level 4: waits=FALSE, binds=TRUE, plan_stat=&#8217;first_execution&#8217;</li>
<li>Level 8: waits=TRUE, binds=FALSE, plan_stat=&#8217;first_execution&#8217;</li>
<li>Level 16: waits=FALSE, binds=FALSE, plan_stat=&#8217;all_executions&#8217;</li>
<li>Level 32: waits=FALSE, binds=FALSE, plan_stat=&#8217;never&#8217;</li>
<li>Level 64: not available yet</li>
</ul>
<p>As you can see from the previous list, it is not possible to enable level 64 through dbms_monitor and dbms_session. Hence, statements like the following ones or ORADEBUG have to be used:</p>
<p><code>alter session set events '10046 trace name context forever, level 64'</code></p>
<p><code>alter session set events 'sql_trace wait=false, bind=false, plan_stat=adaptive'</code></p>
<p>I really hope that this limitation will be removed very soon.</p>
<p><strong>UPDATE 2012-08-13</strong>: An Oracle employee informed me that about the limitation of dbms_monitor and dbms_session bug #14483308 has been opened. Thank you Ted!<br />
<strong>UPDATE 2012-08-16</strong>: Bug #14483308 was rejected <img src='http://www.antognini.ch/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> . As a result enhancement request #14499199 was created.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2012/08/event-10046-full-list-of-levels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ad: Mastering Oracle Trace Data</title>
		<link>http://www.antognini.ch/2012/06/mastering-oracle-trace-data/</link>
		<comments>http://www.antognini.ch/2012/06/mastering-oracle-trace-data/#comments</comments>
		<pubDate>Mon, 11 Jun 2012 09:12:13 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[Speaking]]></category>
		<category><![CDATA[SQL Trace]]></category>
		<category><![CDATA[Trivadis]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=2022</guid>
		<description><![CDATA[This is just a short post to point out that the company I work for, Trivadis, is organizing 3 classes with Cary Millsap. The topic, as the title suggests, is Cary’s 1-day class entitled “Mastering Oracle Trace Data”. The following dates and locations are planned: September 11, 2012 – Münich (DE) September 13, 2012 – [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a short post to point out that the company I work for, <a href="http://www.trivadis.com" title="Trivadis homepage">Trivadis</a>, is organizing 3 classes with <a href="http://carymillsap.blogspot.ch/" title="Cary Millsap blog">Cary Millsap</a>. The topic, as the title suggests, is Cary’s 1-day class entitled “Mastering Oracle Trace Data”.</p>
<p>The following dates and locations are planned:</p>
<ul>
<li>September 11, 2012 – Münich (DE)</li>
<li>September 13, 2012 – Zürich (CH)</li>
<li>September 18, 2012 – Vienna (AT)</li>
</ul>
<p>For detailed information have a look to <a href="http://www.trivadis.com/fileadmin/user_upload/PDFs/120605_Mastering_Oracle_Trace_Data.pdf" title="Mastering Oracle Trace Data flyer">the flyer</a>. Note that the early bird registration period, that entitles you a 15% discount, ends on August 1. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2012/06/mastering-oracle-trace-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display System Activity without Enterprise Manager</title>
		<link>http://www.antognini.ch/2012/06/display-system-activity-without-enterprise-manager/</link>
		<comments>http://www.antognini.ch/2012/06/display-system-activity-without-enterprise-manager/#comments</comments>
		<pubDate>Wed, 06 Jun 2012 12:35:32 +0000</pubDate>
		<dc:creator>Christian Antognini</dc:creator>
				<category><![CDATA[10gR1]]></category>
		<category><![CDATA[10gR2]]></category>
		<category><![CDATA[11gR1]]></category>
		<category><![CDATA[11gR2]]></category>

		<guid isPermaLink="false">http://www.antognini.ch/?p=1996</guid>
		<description><![CDATA[I regularly use the system-level activity chart available in Enterprise Manager. In my opinion it is a simple and effective way to know how much a specific database is loaded at a specific time. This is for example an interesting way for observing how a specific load is processed (see this post for an example). [...]]]></description>
			<content:encoded><![CDATA[<p>I regularly use the system-level activity chart available in Enterprise Manager. In my opinion it is a simple and effective way to know how much a specific database is loaded at a specific time. This is for example an interesting way for observing how a specific load is processed (see <a href="/2012/04/commit_wait-and-commit_logging/">this post</a> for an example).<br />
Unfortunately it also happens that this possibility is not available. The main reasons I faced in the past are the following:</p>
<ul>
<li>Standard Edition is used</li>
<li>Enterprise Edition is used but Diagnostic Pack is not licensed</li>
<li>Enterprise Manager is not available </li>
<li>GUI is not available</li>
</ul>
<p>The aim of this post is to present you a utility that I wrote to cope with these restrictions. It goes without saying that its main purpose is to display information similar to the one provided by the system-level activity chart when working in Standard Edition (or Enterprise without Diagnostic Pack) in a terminal. And that, with both 10g and 11g.</p>
<p>Several dynamic performance views externalize information that can be used for displaying the activity of a system. The two I chose are v$sys_time_model and v$system_wait_class. The challenge of using these views is that they provide only cumulative statistics that are incremented on a regular basis. It is therefore necessary to use a utility that samples the information they provide. In other words, to find out how much a specific statistic changes over a short period of time.</p>
<p>The utility is based on three scripts:</p>
<ul>
<li><a href="/downloads/system_activity_setup.sql">system_activity_setup.sql</a>: install the objects required by the system_activity.sql script</li>
<li><a href="/downloads/system_activity.sql">system_activity.sql</a>: show the database activity at system level</li>
<li><a href="/downloads/system_activity_teardown.sql">system_activity_teardown.sql</a>: remove the objects required by the system_activity.sql script</li>
</ul>
<p>To install the utility execute, as SYS, the system_activity_setup.sql script. It creates several object types, a function (the core of the utility) and a public synonym. In addition it grants the privilege to execute the function to public.</p>
<p>To use the utility you can directly call the system_activity function or, to have a decent output, execute the system_activity.sql script in SQL*Plus. As the following example shows the script requires two parameters:</p>
<ul>
<li>The first parameter, interval, specifies in seconds how much time to wait to compute the deltas. Since the database engine does not update the statistics in real-time, specifying less than 10-15 seconds is usually pointless.</li>
<li>The second parameter, count, specifies the number of samples.</li>
</ul>
<pre>SQL> @system_activity 15 50

                                       DBS112.ANTOGNINI.CH / 2011-02-28

Time     AvgActSess Other% Queue%   Net%   Adm%  Conf%  Comm%  Appl%  Conc% Clust% SysIO% UsrIO% Sched%   CPU%
-------- ---------- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------
06:30:19        1.1    0.0    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    1.6   89.9    0.0    7.7
06:30:34        1.5    0.0    0.0    0.0    0.0    0.0    0.9    0.0    0.3    0.0    2.2   87.5    0.0    9.2
06:30:49        1.2    0.0    0.0    0.1    0.0    0.0    0.7    0.0    0.0    0.0    1.4   91.3    0.0    6.5
06:31:04        1.2    0.7    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    1.7   89.6    0.0    7.3
06:31:19        1.1    0.0    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    1.6   86.1    0.0   11.5
06:31:34        1.4    0.0    0.0    0.0    0.0    0.0    0.6    0.0    0.2    0.0    1.3   91.8    0.0    6.0
06:31:49        1.0    0.0    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    1.7   89.6    0.0    7.9
06:32:04        1.1    0.0    0.0    0.0    0.0    0.0    0.7    0.0    0.0    0.0    1.6   90.2    0.0    7.5
06:32:19        1.1    0.0    0.0    0.1    0.0    0.0    0.8    0.0    0.0    0.0    1.7   89.1    0.0    8.4
06:32:34        1.1    0.1    0.0    0.0    0.0    0.0    0.7    0.0    0.2    0.0    1.7   89.9    0.0    7.4
06:32:49        1.0    0.0    0.0    0.0    0.0    0.0    0.6    0.0    0.0    0.0    1.7   90.3    0.0    7.3
06:33:04        1.1    0.0    0.0    0.0    0.0    0.0    0.7    0.0    0.0    0.0    1.7   90.5    0.0    7.0
06:33:19        1.1    0.0    0.0    0.0    0.0    0.0    1.2    0.0    0.0    0.0    1.9   89.4    0.0    7.4
06:33:34        1.1    0.0    0.0    0.1    0.0    0.1    0.7    0.0    0.2    0.0    1.8   88.8    0.0    8.4
06:33:49        1.3   17.3    0.0    0.0    0.0    0.0    0.6    0.0    0.0    0.0    1.5   74.7    0.0    5.9
06:34:04        1.4   22.6    0.0    0.0    0.0    0.0    0.6    0.0    0.0    0.0    1.2   69.3    0.0    6.3
06:34:19        1.1    0.0    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    1.7   89.6    0.0    8.0
06:34:34        1.0    0.0    0.0    0.0    0.0    0.0    0.7    0.0    0.2    0.0    2.2   89.3    0.0    7.7
06:34:49        1.1    0.1    0.0    0.0    0.0    0.0    0.6    0.0    0.0    0.0    1.4   91.0    0.0    6.9
06:35:04        1.2   -0.1    0.0    0.1    0.0    0.0    0.8    0.0    0.4    0.0    1.7   85.5    0.0   11.6
06:35:19        6.0    0.0    0.0    0.0    0.0    0.0    1.0    0.0    0.0    0.0    1.7   88.8    0.0    8.5
06:35:34        7.4    0.0    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    1.9   91.2    0.0    6.0
06:35:49        7.1    0.0    0.0    0.0    0.0    0.5    1.2    0.0    0.0    0.0    1.9   90.7    0.0    5.7
06:36:04        7.2    0.9    0.0    0.0    0.0    0.0    0.9    0.0    0.0    0.0    1.7   90.7    0.0    5.8
06:36:19        7.2    0.0    0.0    0.0    0.0    0.0    1.0    0.0    0.0    0.0    1.8   90.9    0.0    6.3
06:36:34        6.8    0.0    0.0    0.0    0.0    0.0    1.0    0.0    0.0    0.0    1.7   91.3    0.0    6.0
06:36:49        7.1    0.0    0.0    0.0    0.0    0.5    1.1    0.0    0.0    0.0    1.9   90.9    0.0    5.6
06:37:04        6.9    0.0    0.0    0.0    0.0    0.0    1.0    0.0    0.0    0.0    1.8   91.3    0.0    5.9
06:37:19        6.9    0.0    0.0    0.0    0.0    0.0    0.9    0.0    0.0    0.0    1.7   91.7    0.0    5.7
06:37:34        7.1    0.0    0.0    0.0    0.0    0.0    0.9    0.0    0.0    0.0    1.8   91.6    0.0    5.8
06:37:49        6.9    0.0    0.0    0.0    0.0    0.0    1.1    0.0    0.0    0.0    1.8   91.3    0.0    5.8
06:38:04        7.0    0.0    0.0    0.0    0.0    1.1    1.0    0.0    0.2    0.0    1.9   90.2    0.0    5.7
06:38:19        6.8    0.0    0.0    0.0    0.0    0.0    0.9    0.0    0.0    0.0    1.6   91.6    0.0    5.9
06:38:34        7.2    0.3    0.0    0.0    0.0    0.0    0.9    0.0    0.0    0.0    1.7   91.0    0.0    6.0
06:38:49        6.7    0.0    0.0    0.0    0.0    0.0    1.1    0.0    0.0    0.0    1.7   91.4    0.0    5.8
06:39:04        7.4    0.0    0.0    0.0    0.0    0.4    1.2    0.0    0.0    0.0    2.0   90.9    0.0    5.5
06:39:19        2.0   -0.3    0.0    0.0    0.0    0.0    1.6    0.0    0.1    0.0    2.0   86.5    0.0   10.1
06:39:34        1.1    0.0    0.0    0.1    0.0    0.0    0.7    0.0    0.2    0.0    1.7   89.2    0.0    8.1
06:39:49        1.1    0.0    0.0    0.0    0.0    0.0    0.9    0.0    0.0    0.0    1.8   89.6    0.0    7.6
06:40:04        1.1    0.0    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    2.1   89.6    0.0    7.6
06:40:19        1.5   14.4    0.0    0.0    0.0    0.0    0.7    0.0    1.1    0.0    1.3   74.3    0.0    8.3
06:40:34        1.6   -0.2    0.0    0.0    0.0    0.0    0.6    0.0    0.3    0.0    1.4   87.7    0.0   10.2
06:40:49        1.3    0.0    0.0    0.1    0.0    0.0    0.6    0.0    0.0    0.0    1.6   91.2    0.0    6.5
06:41:04        1.2    0.9    0.0    0.0    0.0    0.0    0.7    0.0    0.0    0.0    1.7   89.5    0.0    7.3
06:41:19        1.2    0.0    0.0    0.0    0.0    0.0    0.7    0.0    0.0    0.0    1.8   87.3    0.0   10.3
06:41:34        1.3    0.0    0.0    0.0    0.0    0.0    0.5    0.0    0.1    0.0    1.4   91.5    0.0    6.3
06:41:49        1.1    0.1    0.0    0.0    0.0    0.0    0.8    0.0    0.0    0.0    1.6   90.3    0.0    7.2
06:42:04        1.1    0.0    0.0    0.1    0.0    0.0    0.8    0.0    0.0    0.0    2.0   89.9    0.0    7.2
06:42:19        1.1    0.0    0.0    0.0    0.0    0.0    0.7    0.0    0.0    0.0    1.5   90.8    0.0    7.1
06:42:34        1.1    0.0    0.0    0.0    0.0    0.0    0.8    0.0    0.2    0.0    2.0   89.4    0.0    7.6</pre>
<p>The output provides:</p>
<ul>
<li>the timestamp of the end of the sampling period,</li>
<li>the number of average active sessions, and</li>
<li>the percentage of time spent for each wait class and CPU.</li>
</ul>
<p>For comparison purposes, here is the activity chart for the very same period of time. Even though the data is not exactly the same (the activity chart is based on ASH, a completely different source of information), it is good enough to know how much a database is loaded and which wait class is the major contributor.</p>
<p><img src="/images/system_activity.png" alt="System Activity Chart" /></p>
<p>Any feedback or suggestion to improve the scripts is highly welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antognini.ch/2012/06/display-system-activity-without-enterprise-manager/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
