<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Internet SQL</title>
	<atom:link href="http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/</link>
	<description>Just another Oracle weblog</description>
	<lastBuildDate>Thu, 23 May 2013 12:47:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Deadlock detection - unindexed foreign keys &#171; OraStory</title>
		<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-18332</link>
		<dc:creator><![CDATA[Deadlock detection - unindexed foreign keys &#171; OraStory]]></dc:creator>
		<pubDate>Tue, 14 Aug 2007 09:00:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-18332</guid>
		<description><![CDATA[[...] of SQL to identify unindexed foreign keys, I was lazy and did a search on google, albeit with this caveat in mind. Interestingly I found a script on experts-exchange that I wrote to do exactly the same [...]]]></description>
		<content:encoded><![CDATA[<p>[...] of SQL to identify unindexed foreign keys, I was lazy and did a search on google, albeit with this caveat in mind. Interestingly I found a script on experts-exchange that I wrote to do exactly the same [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Log buffer 52 - a carnival of the vanities for dbas &#171; OraStory</title>
		<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14415</link>
		<dc:creator><![CDATA[Log buffer 52 - a carnival of the vanities for dbas &#171; OraStory]]></dc:creator>
		<pubDate>Fri, 06 Jul 2007 18:45:20 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14415</guid>
		<description><![CDATA[[...] another top quality post, Jonathan reiterates the need to be wary of downloaded SQL and highlights the importance of understanding what you&#8217;re about to run. Continuing on the vein of caution and wariness, Niall Litchfield says just be careful out [...]]]></description>
		<content:encoded><![CDATA[<p>[...] another top quality post, Jonathan reiterates the need to be wary of downloaded SQL and highlights the importance of understanding what you&#8217;re about to run. Continuing on the vein of caution and wariness, Niall Litchfield says just be careful out [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Lewis</title>
		<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14177</link>
		<dc:creator><![CDATA[Jonathan Lewis]]></dc:creator>
		<pubDate>Tue, 03 Jul 2007 17:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14177</guid>
		<description><![CDATA[Mathew, if you&#039;re thinking of the missing &quot;+&quot; from the /*+ materialize */ hint, I left that out to check that the view subquery would materialize without the hint (which it did) - then forgot to put it back in. (now corrected)

Steve, I doubt if the AWR snapshot can do anything about it, but I&#039;d have to walk through the snapshot SQL to check.]]></description>
		<content:encoded><![CDATA[<p>Mathew, if you&#8217;re thinking of the missing &#8220;+&#8221; from the /*+ materialize */ hint, I left that out to check that the view subquery would materialize without the hint (which it did) &#8211; then forgot to put it back in. (now corrected)</p>
<p>Steve, I doubt if the AWR snapshot can do anything about it, but I&#8217;d have to walk through the snapshot SQL to check.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Howard</title>
		<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14173</link>
		<dc:creator><![CDATA[Steve Howard]]></dc:creator>
		<pubDate>Tue, 03 Jul 2007 15:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14173</guid>
		<description><![CDATA[Hi Jonathan,

Thanks for this analysis.  Your comment about the read consistency of v$ views got me to thinking.  As you noted, some of these are very complex structures.  Does the AWR snapshot provided in 10G take care of this?  In other words, it may not pragmatically make a difference, but if the snapshot procedure selects from v$sql, and then later from v$sql_plan, the contents of the two views and their links may not correspond.  

As I noted, it probably isn&#039;t an issue, but I wondered if Oracle accounts for this somehow?

Thanks,

Steve]]></description>
		<content:encoded><![CDATA[<p>Hi Jonathan,</p>
<p>Thanks for this analysis.  Your comment about the read consistency of v$ views got me to thinking.  As you noted, some of these are very complex structures.  Does the AWR snapshot provided in 10G take care of this?  In other words, it may not pragmatically make a difference, but if the snapshot procedure selects from v$sql, and then later from v$sql_plan, the contents of the two views and their links may not correspond.  </p>
<p>As I noted, it probably isn&#8217;t an issue, but I wondered if Oracle accounts for this somehow?</p>
<p>Thanks,</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathew Butler</title>
		<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14154</link>
		<dc:creator><![CDATA[Mathew Butler]]></dc:creator>
		<pubDate>Tue, 03 Jul 2007 08:02:51 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14154</guid>
		<description><![CDATA[Excellent post! I would like to see more of these detailed query walk throughs. They give an interesting insight into some of the complexities of writing efficient queries.  

Possible display error - I think your query hints are in the incorrect format.

Best regards. 

mathew butler]]></description>
		<content:encoded><![CDATA[<p>Excellent post! I would like to see more of these detailed query walk throughs. They give an interesting insight into some of the complexities of writing efficient queries.  </p>
<p>Possible display error &#8211; I think your query hints are in the incorrect format.</p>
<p>Best regards. </p>
<p>mathew butler</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bstav</title>
		<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14089</link>
		<dc:creator><![CDATA[bstav]]></dc:creator>
		<pubDate>Mon, 02 Jul 2007 06:48:11 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14089</guid>
		<description><![CDATA[I recognize the performance problem on v$ and also v$lock views. Now I always use my rewrite of Oracle&#039;s ?/rdbms/admin/utllockt.sql, this shows a tree view of all blocking locks and their dependencies. Blockers &amp; waiters need to be installed (?/rdbms/admin/catblock.sql). It runs fast and I&#039;ve used it without trouble on 9i and 10g, but that&#039;s no guarantee it will be OK on your database ;-)

WITH locks_temp AS
     (SELECT /*+ MATERIALIZE */
             *
      FROM   dba_locks)
,    lock_holders1 AS
     (
        SELECT /*+ MATERIALIZE */
               w.session_id waiting_session
,              h.session_id holding_session
,              w.lock_type lock_type
,              h.mode_held mode_held
,              w.mode_requested mode_requested
,              w.lock_id1 lock_id1
,              w.lock_id2 lock_id2
        FROM   locks_temp w
,              locks_temp h
        WHERE  h.blocking_others = &#039;Blocking&#039;
        AND    h.mode_held != &#039;None&#039;
        AND    h.mode_held != &#039;Null&#039;
        AND    w.mode_requested != &#039;None&#039;
        AND    w.lock_type = h.lock_type
        AND    w.lock_id1 = h.lock_id1
        AND    w.lock_id2 = h.lock_id2)
,    lock_holders2 AS
     (
        SELECT /*+ MATERIALIZE */
               holding_session waiting_session
,              0 holding_session
,              &#039;None&#039; lock_type
,              &#039;&#039; mode_held
,              &#039;&#039; mode_requested
,              &#039;&#039; lock_id1
,              &#039;&#039; lock_id2
        FROM   lock_holders1
        MINUS
        SELECT waiting_session
,              0 waiting_session
,              &#039;None&#039; lock_type
,              &#039;&#039; mode_held
,              &#039;&#039; mode_requested
,              &#039;&#039; lock_id1
,              &#039;&#039; lock_id2
        FROM   lock_holders1)
,    lock_holders_all AS
     (SELECT *
      FROM   lock_holders1
      UNION ALL
      SELECT *
      FROM   lock_holders2)
SELECT     RPAD (&#039; &#039;, 3 * (LEVEL - 2), &#039; &#039;)&#124;&#124; decode(level,1,&#039;&#039;,&#039;&#124;--&#039;) &#124;&#124; l.waiting_session sid
,          l.lock_type
,          s.username username
,          s.machine machine
,          s.osuser osuser
,          NVL (s.module, s.program) program
,             &#039;alter system kill session &#039;&#124;&#124;&#039;&#039;&#039;&#039;&#124;&#124;s.sid&#124;&#124;&#039;,&#039;&#124;&#124;s.serial#&#124;&#124;&#039;&#039;&#039;&#039;&#124;&#124;&#039;;&#039; kill
FROM       lock_holders_all l
,          v$session s
WHERE      s.SID = l.waiting_session
CONNECT BY PRIOR l.waiting_session = l.holding_session
START WITH l.holding_session = 0
ORDER SIBLINGS by s.sid]]></description>
		<content:encoded><![CDATA[<p>I recognize the performance problem on v$ and also v$lock views. Now I always use my rewrite of Oracle&#8217;s ?/rdbms/admin/utllockt.sql, this shows a tree view of all blocking locks and their dependencies. Blockers &amp; waiters need to be installed (?/rdbms/admin/catblock.sql). It runs fast and I&#8217;ve used it without trouble on 9i and 10g, but that&#8217;s no guarantee it will be OK on your database ;-)</p>
<p>WITH locks_temp AS<br />
     (SELECT /*+ MATERIALIZE */<br />
             *<br />
      FROM   dba_locks)<br />
,    lock_holders1 AS<br />
     (<br />
        SELECT /*+ MATERIALIZE */<br />
               w.session_id waiting_session<br />
,              h.session_id holding_session<br />
,              w.lock_type lock_type<br />
,              h.mode_held mode_held<br />
,              w.mode_requested mode_requested<br />
,              w.lock_id1 lock_id1<br />
,              w.lock_id2 lock_id2<br />
        FROM   locks_temp w<br />
,              locks_temp h<br />
        WHERE  h.blocking_others = &#8216;Blocking&#8217;<br />
        AND    h.mode_held != &#8216;None&#8217;<br />
        AND    h.mode_held != &#8216;Null&#8217;<br />
        AND    w.mode_requested != &#8216;None&#8217;<br />
        AND    w.lock_type = h.lock_type<br />
        AND    w.lock_id1 = h.lock_id1<br />
        AND    w.lock_id2 = h.lock_id2)<br />
,    lock_holders2 AS<br />
     (<br />
        SELECT /*+ MATERIALIZE */<br />
               holding_session waiting_session<br />
,              0 holding_session<br />
,              &#8216;None&#8217; lock_type<br />
,              &#8221; mode_held<br />
,              &#8221; mode_requested<br />
,              &#8221; lock_id1<br />
,              &#8221; lock_id2<br />
        FROM   lock_holders1<br />
        MINUS<br />
        SELECT waiting_session<br />
,              0 waiting_session<br />
,              &#8216;None&#8217; lock_type<br />
,              &#8221; mode_held<br />
,              &#8221; mode_requested<br />
,              &#8221; lock_id1<br />
,              &#8221; lock_id2<br />
        FROM   lock_holders1)<br />
,    lock_holders_all AS<br />
     (SELECT *<br />
      FROM   lock_holders1<br />
      UNION ALL<br />
      SELECT *<br />
      FROM   lock_holders2)<br />
SELECT     RPAD (&#8216; &#8216;, 3 * (LEVEL &#8211; 2), &#8216; &#8216;)|| decode(level,1,&#8221;,&#8217;|&#8211;&#8217;) || l.waiting_session sid<br />
,          l.lock_type<br />
,          s.username username<br />
,          s.machine machine<br />
,          s.osuser osuser<br />
,          NVL (s.module, s.program) program<br />
,             &#8216;alter system kill session &#8216;||&#8221;&#8221;||s.sid||&#8217;,'||s.serial#||&#8221;&#8221;||&#8217;;&#8217; kill<br />
FROM       lock_holders_all l<br />
,          v$session s<br />
WHERE      s.SID = l.waiting_session<br />
CONNECT BY PRIOR l.waiting_session = l.holding_session<br />
START WITH l.holding_session = 0<br />
ORDER SIBLINGS by s.sid</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Moss</title>
		<link>http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14088</link>
		<dc:creator><![CDATA[Jeff Moss]]></dc:creator>
		<pubDate>Mon, 02 Jul 2007 06:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://jonathanlewis.wordpress.com/2007/07/01/internet-sql/#comment-14088</guid>
		<description><![CDATA[I imagine Asimov would be proud of your Zeroth law!]]></description>
		<content:encoded><![CDATA[<p>I imagine Asimov would be proud of your Zeroth law!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
