<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>Doug's Oracle Blog (Entries tagged as Locking)</title>
    <link>http://oracledoug.com/serendipity/</link>
    <description></description>
    <dc:language>en</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:doug@oracledoug.com" />
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    <managingEditor>Doug Burns</managingEditor>
<webMaster>Doug Burns</webMaster>
<pubDate>Thu, 11 Jun 2009 02:27:02 GMT</pubDate>

    <image>
        <url>http://oracledoug.com/serendipity/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Doug's Oracle Blog - </title>
        <link>http://oracledoug.com/serendipity/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Diagnosing Locking Problems using ASH/LogMiner – The End</title>
    <link>http://oracledoug.com/serendipity/index.php?/archives/1495-Diagnosing-Locking-Problems-using-ASHLogMiner-The-End.html</link>
    
    <comments>http://oracledoug.com/serendipity/index.php?/archives/1495-Diagnosing-Locking-Problems-using-ASHLogMiner-The-End.html#comments</comments>
    <wfw:comment>http://oracledoug.com/serendipity/wfwcomment.php?cid=1495</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://oracledoug.com/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=1495</wfw:commentRss>
    

    <author>dougburns@yahoo.com (Doug Burns)</author>
    <content:encoded>
    &lt;p&gt;Except&amp;#160;it&#039;s not the&amp;#160;end, of course. What I mean is&amp;#160;that I usually agree with&amp;#160;what Miladin Modrakovic said in &lt;a href=&quot;http://oraclue.com/2009/04/20/detecting-deadlock-source/#comment-176&quot;&gt;one of his comments&lt;/a&gt; on his first &lt;a href=&quot;http://oraclue.com/2009/04/20/detecting-deadlock-source/&quot;&gt;deadlock blog post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&amp;quot;&lt;em&gt;There is always way around.&lt;/em&gt;&amp;quot;&lt;br /&gt;&lt;br /&gt;As I keep saying, there are many different ways of diagnosing locking problems. Which one works best&amp;#160;depends on the situation you&#039;re faced with but I don&#039;t think there&#039;s an &#039;end&#039; here, a single solution that works well in all circumstances.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Currently occurring&amp;#160;problems&lt;/em&gt; are easy. There&#039;s locking information in V$SESSION, V$TRANSACTION, V$LOCK etc and you can &lt;em&gt;probably&lt;/em&gt; track down the SQL statement that&#039;s caused the problem.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Those in the past&lt;/em&gt; are more difficult but, even in difficult cases, you&#039;ll often be able to get close enough to work out what&#039;s going on, particularly if you combine data from multiple sources - redo entries, ASH samples and AWR showing you what SQL was running when and so on. It becomes more difficult with a SELECT FOR UPDATE and no subsequent UPDATE, though, because the various tools available (e.g. Logminer) don&#039;t always return what you&#039;d expect when the data doesn&#039;t actually change.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;If you can recreate the problem or it&#039;s an ongoing problem that you expect to reoccur&lt;/em&gt;, then you can enable various traces and&amp;#160;have lots of information that will help you solve most real world problems.&lt;br /&gt;&lt;br /&gt;But the specific challenge here was to see which SQL statement was responsible for a locking problem, after the fact, when you weren&#039;t expecting the problem in the first place.&lt;br /&gt;&lt;br /&gt;I thought I&#039;d give &lt;a href=&quot;http://oraclue.com/2009/04/23/detecting-deadlock-source-part-2/&quot;&gt;Miladin&#039;s most recent post&lt;/a&gt;&amp;#160;a try because it&amp;#160;contains another interesting strategy - Flashback queries. Deadlock problems are different, not least because you have the resulting trace file. So his example isn&#039;t designed to address what I&#039;ve been looking at here, but I thought I should give it a try, as suggested by Vlado &lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1491-Diagnosing-Locking-Problems-using-ASHLogMiner-Part-8.html#c6997&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The example he uses is a deadlock situation caused by updates, but I&#039;ll apply it to the specific example I&#039;ve been using here. Three SELECT FOR UPDATE statements - which one was the blocker? This time I&#039;ve created TEST_TAB2 with fewer rows, but the rest of the test is the same.&lt;/p&gt;
&lt;pre&gt;SQL&amp;gt; create table test_tab2 
	as select object_id pk_id, object_name from all_objects where object_id &amp;lt; 400;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Table created.&lt;/p&gt;&lt;p&gt;SQL&amp;gt; select * from test_tab2;&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID OBJECT_NAME
---------- ------------------------------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 258 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 259 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 314 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 316 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 317 STMT_AUDIT_OPTION_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 319 STMT_AUDIT_OPTION_MAP&lt;/p&gt;&lt;p&gt;8 rows selected.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;SQL&amp;gt; @doug1
SQL&amp;gt; column xidusn format 999
SQL&amp;gt; column xidslot format 999
SQL&amp;gt; column xidsqn format 999999
SQL&amp;gt; select pk_id, object_name from test_tab2 order by pk_id desc for update;&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID OBJECT_NAME
---------- ------------------------------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 319 STMT_AUDIT_OPTION_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 317 STMT_AUDIT_OPTION_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 316 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 314 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 259 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 258 DUAL&lt;/p&gt;&lt;p&gt;8 rows selected.&lt;/p&gt;&lt;p&gt;SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;&lt;/p&gt;&lt;p&gt;START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
05/01/09 11:53:36&amp;#160;&amp;#160;&amp;#160; 0003001F000087AA&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 3&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 31&amp;#160;&amp;#160; 34730&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&lt;/p&gt;&lt;p&gt;SQL&amp;gt; rollback;&lt;/p&gt;&lt;p&gt;Rollback complete.&lt;/p&gt;&lt;p&gt;SQL&amp;gt; select pk_id from test_tab2 where object_name=&#039;SYSTEM_PRIVILEGE_MAP&#039; for update;&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID
----------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313&lt;/p&gt;&lt;p&gt;SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;&lt;/p&gt;&lt;p&gt;START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
05/01/09 11:53:37&amp;#160;&amp;#160;&amp;#160; 0006000500008EEE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 6&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5&amp;#160;&amp;#160; 36590&amp;#160;&amp;#160; 85744191&amp;#160;&amp;#160;&amp;#160;&amp;#160; 51C5A3F&lt;/p&gt;&lt;p&gt;SQL&amp;gt; rollback;&lt;/p&gt;&lt;p&gt;Rollback complete.&lt;/p&gt;&lt;p&gt;SQL&amp;gt; select pk_id from test_tab2 where pk_id=313 for update;&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID
----------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313&lt;/p&gt;&lt;p&gt;SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;&lt;/p&gt;&lt;p&gt;START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
05/01/09 11:53:37&amp;#160;&amp;#160;&amp;#160; 0002001900008F2E&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 25&amp;#160;&amp;#160; 36654&amp;#160;&amp;#160; 85744194&amp;#160;&amp;#160;&amp;#160;&amp;#160; 51C5A42&lt;/p&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;So Session 1 has one row locked and will block Session 2.&lt;/p&gt;
&lt;pre&gt;SQL&amp;gt; @doug2
SQL&amp;gt; column xidusn format 999
SQL&amp;gt; column xidslot format 999
SQL&amp;gt; column xidsqn format 999999
SQL&amp;gt;
SQL&amp;gt; select pk_id from test_tab2 where pk_id=313 for update;&lt;/pre&gt;&lt;br /&gt;I rollback Session 1&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;SQL&amp;gt; rollback;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Rollback complete.&lt;/p&gt;&lt;/pre&gt;&lt;br /&gt;and Session 2 acquires the lock, then rolls back.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID
----------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313&lt;p&gt;&lt;/p&gt;&lt;p&gt;SQL&amp;gt;
SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;&lt;/p&gt;&lt;p&gt;START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
05/01/09 11:53:39&amp;#160;&amp;#160;&amp;#160; 00040018000067E3&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 24&amp;#160;&amp;#160; 26595&amp;#160;&amp;#160; 85744197&amp;#160;&amp;#160;&amp;#160;&amp;#160; 51C5A45&lt;/p&gt;&lt;p&gt;SQL&amp;gt;
SQL&amp;gt; rollback;&lt;/p&gt;&lt;p&gt;Rollback complete.&lt;/p&gt;&lt;/pre&gt;&lt;br /&gt;This is what comes back from Flashback queries.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;SQL&amp;gt; @miladin
SQL&amp;gt; set echo on
SQL&amp;gt;
SQL&amp;gt; SELECT&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_XID
&amp;#160; 2&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_STARTTIME
&amp;#160; 3&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_ENDTIME
&amp;#160; 4&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_STARTSCN
&amp;#160; 5&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_ENDSCN
&amp;#160; 6&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_OPERATION
&amp;#160; 7&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; pk_id, object_name
&amp;#160; 8&amp;#160; FROM&amp;#160;&amp;#160; testuser.test_tab2 VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE
&amp;#160; 9&amp;#160; ORDER&amp;#160; BY VERSIONS_STARTTIME;&lt;p&gt;&lt;/p&gt;&lt;p&gt;VERSIONS_XID
----------------
VERSIONS_STARTTIME
---------------------------------------------------------------------------
VERSIONS_ENDTIME
---------------------------------------------------------------------------
VERSIONS_STARTSCN VERSIONS_ENDSCN V&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID OBJECT_NAME
----------------- --------------- - ---------- ------------------------------&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 258 DUAL&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 259 DUAL&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311 SYSTEM_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 319 STMT_AUDIT_OPTION_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 314 TABLE_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 316 TABLE_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 317 STMT_AUDIT_OPTION_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 SYSTEM_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;
8 rows selected.&lt;/p&gt;&lt;p&gt;SQL&amp;gt;
SQL&amp;gt; SELECT * FROM testuser.test_tab2
&amp;#160; 2&amp;#160; AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL &#039;1&#039; MINUTE);&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID OBJECT_NAME
---------- ------------------------------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 258 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 259 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 314 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 316 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 317 STMT_AUDIT_OPTION_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 319 STMT_AUDIT_OPTION_MAP&lt;/p&gt;&lt;p&gt;8 rows selected.&lt;/p&gt;&lt;p&gt;SQL&amp;gt;
SQL&amp;gt; -- Narrow to specific column
SQL&amp;gt;
SQL&amp;gt; SELECT versions_xid XID, versions_startscn START_SCN, versions_endscn END_SCN, 
	versions_operation OPERATION, object_name
&amp;#160; 2&amp;#160; FROM testuser.test_tab2
&amp;#160; 3&amp;#160; VERSIONS BETWEEN SCN MINVALUE AND MAXVALUE
&amp;#160; 4&amp;#160; WHERE pk_id=313;&lt;/p&gt;&lt;p&gt;XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; START_SCN&amp;#160;&amp;#160;&amp;#160; END_SCN O OBJECT_NAME
---------------- ---------- ---------- - ------------------------------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SYSTEM_PRIVILEGE_MAP&lt;/p&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Not much in other words. To check what I&#039;m doing, I COMMITed the final update from Session 1 (as opposed to rolling it back) and got what I&#039;d hope to see, because there&#039;s actually a different committed version of the data.&lt;/p&gt;
&lt;pre&gt;SQL&amp;gt; @miladin
SQL&amp;gt; set echo on
SQL&amp;gt;
SQL&amp;gt; SELECT&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_XID
&amp;#160; 2&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_STARTTIME
&amp;#160; 3&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_ENDTIME
&amp;#160; 4&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_STARTSCN
&amp;#160; 5&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_ENDSCN
&amp;#160; 6&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VERSIONS_OPERATION
&amp;#160; 7&amp;#160; ,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; pk_id, object_name
&amp;#160; 8&amp;#160; FROM&amp;#160;&amp;#160; testuser.test_tab2 VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE
&amp;#160; 9&amp;#160; ORDER&amp;#160; BY VERSIONS_STARTTIME;&lt;p&gt;&lt;/p&gt;&lt;p&gt;VERSIONS_XID
----------------
VERSIONS_STARTTIME
---------------------------------------------------------------------------
VERSIONS_ENDTIME
---------------------------------------------------------------------------
VERSIONS_STARTSCN VERSIONS_ENDSCN V&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID OBJECT_NAME
----------------- --------------- - ---------- ------------------------------
0002000A00008F4B
01-MAY-09 12.04.39&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 85744966&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; U&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 XID 3&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 259 DUAL&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311 SYSTEM_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 319 STMT_AUDIT_OPTION_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 314 TABLE_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 316 TABLE_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 317 STMT_AUDIT_OPTION_MAP&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 258 DUAL&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;01-MAY-09 12.04.39
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 85744966&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 SYSTEM_PRIVILEGE_MAP&lt;/p&gt;&lt;p&gt;
9 rows selected.&lt;/p&gt;&lt;p&gt;SQL&amp;gt;
SQL&amp;gt; SELECT * FROM testuser.test_tab2
&amp;#160; 2&amp;#160; AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL &#039;1&#039; MINUTE);&lt;/p&gt;&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID OBJECT_NAME
---------- ------------------------------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 258 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 259 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 314 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 316 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 317 STMT_AUDIT_OPTION_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 319 STMT_AUDIT_OPTION_MAP&lt;/p&gt;&lt;p&gt;8 rows selected.&lt;/p&gt;&lt;p&gt;SQL&amp;gt;
SQL&amp;gt; -- Narrow to specific column
SQL&amp;gt;
SQL&amp;gt; SELECT versions_xid XID, versions_startscn START_SCN, versions_endscn END_SCN, 
	versions_operation OPERATION, object_name
&amp;#160; 2&amp;#160; FROM testuser.test_tab2
&amp;#160; 3&amp;#160; VERSIONS BETWEEN SCN MINVALUE AND MAXVALUE
&amp;#160; 4&amp;#160; WHERE pk_id=313;&lt;/p&gt;&lt;p&gt;XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; START_SCN&amp;#160;&amp;#160;&amp;#160; END_SCN O OBJECT_NAME
---------------- ---------- ---------- - ------------------------------
0002000A00008F4B&amp;#160;&amp;#160; 85744966&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; U XID 3
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 85744966&amp;#160;&amp;#160; SYSTEM_PRIVILEGE_MAP&lt;/p&gt;&lt;/pre&gt;&lt;br /&gt;So the problem is that although there&#039;s some locking information for the SELECT FOR UPDATEs (see previous blog posts) they&#039;re difficult to diagnose because there were no changes to the data.&lt;br /&gt;&lt;br /&gt;Ultimately, I like the way Graham Wood put it in an email, so I asked him if I could quote it here.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&amp;quot;I may well have said that it was impossible to get from the V$ tables. The reason that it is impossible is that row locks exist only in the disk blocks, in the form of the ITL. This was a key part of the whole row level locking scheme as it meant that we did not have to maintain and configure a structure to contain lock information that could, at worse need one entry for every row in the database. The ITL cannot be extended to include a SQLID, or at least not without requiring a data migration to the new block structure.&lt;/em&gt;&lt;em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You may well say that tracing will give you the blocking SQL. Well if you happen to be tracing the blocking session from the start of the blocking txn, then it is true that the trace file contains the blocking statement. However there may be many hundreds or thousands of statements in the trace file and there is no method that can tell you which one, even though you might be able to reduce the &#039;possibles&#039; list by analysis of object access by the various statements.&lt;/em&gt;&lt;em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As for the use of the XID. The XID is useful because it gives a finite limit to which operation may have caused the lock i.e the lock must have been caused by a statement that was in the same txn that the blocking session is in at the time that the&amp;#160; waiter is blocked.&amp;quot;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;There&#039;s a gap in the data block and redo data describing the transaction - no SQLID. By using various strategies you might be able to make an educated guess as to the source of the problem, but there&#039;s no way to &lt;em&gt;guarantee&lt;/em&gt; that you have the correct statement. But with so many different possibilities to get you close to a diagnosis, I&#039;m not sure having the SQLID in there would be very useful&amp;#160;- certainly not worth&amp;#160;amending the ITL&amp;#160;structure.&lt;br /&gt;&lt;br /&gt;This series of posts is already way out of control, I&#039;ve got other things I want to post about&amp;#160;and I&#039;m sort of bored&amp;#160;by myself &lt;img src=&quot;http://oracledoug.com/serendipity/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; so, no matter what other approaches crop up, the most I&#039;ll be doing is linking to them! 
    </content:encoded>

    <pubDate>Fri, 01 May 2009 12:30:00 +0100</pubDate>
    <guid isPermaLink="false">http://oracledoug.com/serendipity/index.php?/archives/1495-guid.html</guid>
    <category>ASH</category>
<category>Locking</category>

</item>
<item>
    <title>Diagnosing Locking Problems using ASH/LogMiner – Part 9</title>
    <link>http://oracledoug.com/serendipity/index.php?/archives/1492-Diagnosing-Locking-Problems-using-ASHLogMiner-Part-9.html</link>
    
    <comments>http://oracledoug.com/serendipity/index.php?/archives/1492-Diagnosing-Locking-Problems-using-ASHLogMiner-Part-9.html#comments</comments>
    <wfw:comment>http://oracledoug.com/serendipity/wfwcomment.php?cid=1492</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://oracledoug.com/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=1492</wfw:commentRss>
    

    <author>dougburns@yahoo.com (Doug Burns)</author>
    <content:encoded>
    &lt;p&gt;This time, instead of dumping the contents of the log file for a specific Data Block Address (DBA), as in the last part, I’m going to dump it for a specific operation type – Lock Rows (SELECT FOR UPDATE in this case) – which is part of the Row Operations layer (11) and is the LKR operation (4). This will allow me to eliminate less interesting activity and will include information for blocks other than the specific block that contains the PK_ID=313 row. &lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;SQL&amp;gt; alter system dump logfile &#039;&amp;amp;&amp;amp;my_member&#039;
&amp;#160; 2&amp;#160; layer 11 opcode 4;
old&amp;#160;&amp;#160; 1: alter system dump logfile &#039;&amp;amp;&amp;amp;my_member&#039;
new&amp;#160;&amp;#160; 1: alter system dump logfile &#039;/data/oradata/PPL/redo03.log&#039;&lt;p&gt;&lt;/p&gt;&lt;p&gt;System altered.&lt;/p&gt;&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;Next, a quick reminder of the transaction history from the previous tests, that this log file covers.&lt;/p&gt;
&lt;p&gt;Transaction ID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Session 1 Activity&amp;#160; Transaction ID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Session 2 Activity&lt;/p&gt;
&lt;p&gt;0003001100008615&amp;#160; Whole Table Locked&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Locks Released&lt;br /&gt;0002000100008DAA&amp;#160; Two Rows Locked&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Locks Released&lt;br /&gt;000900110000891B&amp;#160; PK_ID=313 Locked&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Waiting to lock PK_ID=313&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Lock Released&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 00080005000081D3&amp;#160;&amp;#160;&amp;#160; PK_ID=313 Locked&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;
&lt;p&gt;Looking at the header (line numbers added by vi), I can see that the dump is restricted to Opcode 11.4.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;&amp;#160;&amp;#160;&amp;#160; 19&amp;#160; DUMP OF REDO FROM FILE &#039;/data/oradata/PPL/redo03.log&#039;
&amp;#160;&amp;#160;&amp;#160; 20&amp;#160;&amp;#160; Opcode 11.4 only
&amp;#160;&amp;#160;&amp;#160; 21&amp;#160;&amp;#160; RBAs: 0x000000.00000000.0000 thru 0xffffffff.ffffffff.ffff
&amp;#160;&amp;#160;&amp;#160; 22&amp;#160;&amp;#160; SCNs: scn: 0x0000.00000000 thru scn: 0xffff.ffffffff
&amp;#160;&amp;#160;&amp;#160; 23&amp;#160;&amp;#160; Times: creation thru eternity&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;Next I search for ‘xid: ‘ to find the first transaction ID, which brings up the first redo record, all 2214 lines of it! Relax, I’m not going to list it all here, just focus on the first CHANGE record.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;&amp;#160;&amp;#160;&amp;#160; 50&amp;#160; REDO RECORD - Thread:1 RBA: 0x002304.00000002.0010 LEN: 0x45b0 VLD: 0x0d
&amp;#160;&amp;#160;&amp;#160; 51&amp;#160; SCN: 0x0000.050dc3e9 SUBSCN:&amp;#160; 1 04/23/2009 09:40:19
&amp;#160;&amp;#160;&amp;#160; 52&amp;#160; CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06125 OBJ:144543 SCN:0x0000.050dc005 SEQ:185 OP:11.4
&amp;#160;&amp;#160;&amp;#160; 53&amp;#160; KTB Redo
&amp;#160;&amp;#160;&amp;#160; 54&amp;#160; op: 0x01&amp;#160; ver: 0x01
&amp;#160;&amp;#160;&amp;#160; 55&amp;#160; op: F&amp;#160; xid:&amp;#160; 0x0003.011.00008615&amp;#160;&amp;#160;&amp;#160; uba: 0x00803aaa.0f30.01
&amp;#160;&amp;#160;&amp;#160; 56&amp;#160; KDO Op code: LKR row dependencies Disabled
&amp;#160;&amp;#160;&amp;#160; 57&amp;#160;&amp;#160;&amp;#160; xtype: XA flags: 0x00000000&amp;#160; bdba: 0x00c06125&amp;#160; hdba: 0x00c06103
&amp;#160;&amp;#160;&amp;#160; 58&amp;#160; itli: 2&amp;#160; ispac: 0&amp;#160; maxfr: 4858
&amp;#160;&amp;#160;&amp;#160; 59&amp;#160; tabn: 0 slot: 183 to: 2&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;I can see this is a change to a Data Block (Class 1), the Trancation ID is 0x0003.011.00008615 which matches the XID 0003001100008615 from V$TRANSACTION and that it’s a row lock operation. Next up is a 5.2 operation that starts off the new transaction)&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;&amp;#160;&amp;#160;&amp;#160; 60&amp;#160; CHANGE #2 TYP:0 CLS:21 AFN:2 DBA:0x00800029 OBJ:4294967295 SCN:0x0000.050dc3c0 SEQ:&amp;#160; 1 OP:5.2
&amp;#160;&amp;#160;&amp;#160; 61&amp;#160; ktudh redo: slt: 0x0011 sqn: 0x00008615 flg: 0x000a siz: 108 fbi: 0
&amp;#160;&amp;#160;&amp;#160; 62&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; uba: 0x00803aaa.0f30.01&amp;#160;&amp;#160;&amp;#160; pxid:&amp;#160; 0x0000.000.00000000&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;After that you’ll see tons more 11.4 entries as the various locks are acquired. Next I’ll search for the transaction ID for the second transaction (that locked two rows) by searching for ‘xid:&amp;#160; 0x0002’ (two spaces in that string).&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;192358&amp;#160; REDO RECORD - Thread:1 RBA: 0x002304.00000ce8.0010 LEN: 0x0238 VLD: 0x0d
192359&amp;#160; SCN: 0x0000.050dc41f SUBSCN:&amp;#160; 1 04/23/2009 09:40:20
192360&amp;#160; CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06104 OBJ:144543 SCN:0x0000.050dc411 SEQ:102 OP:11.4
192361&amp;#160; KTB Redo
192362&amp;#160; op: 0x01&amp;#160; ver: 0x01
192363&amp;#160; op: F&amp;#160; xid:&amp;#160; 0x0002.001.00008daa&amp;#160;&amp;#160;&amp;#160; uba: 0x00808827.124c.31
192364&amp;#160; KDO Op code: LKR row dependencies Disabled
192365&amp;#160;&amp;#160;&amp;#160; xtype: XA flags: 0x00000000&amp;#160; bdba: 0x00c06104&amp;#160; hdba: 0x00c06103
192366&amp;#160; itli: 3&amp;#160; ispac: 0&amp;#160; maxfr: 4858
192367&amp;#160; tabn: 0 slot: 2 to: 3&lt;/pre&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;Looking at the line numbers, you can probably see why I didn’t want to show you all of the REDO RECORDs for the first transaction! Checking the transaction ID, that’s the one we’re looking for. While I’m at it, I might as well track down the last two transactions by searching for their xid: &lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;192447&amp;#160; REDO RECORD - Thread:1 RBA: 0x002304.00000cea.0010 LEN: 0x0180 VLD: 0x0d
192448&amp;#160; SCN: 0x0000.050dc423 SUBSCN:&amp;#160; 1 04/23/2009 09:40:25
192449&amp;#160; CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06104 OBJ:144543 SCN:0x0000.050dc41f SEQ:&amp;#160; 4 OP:11.4
192450&amp;#160; KTB Redo
192451&amp;#160; op: 0x01&amp;#160; ver: 0x01
192452&amp;#160; op: F&amp;#160; xid:&amp;#160; 0x0009.011.0000891b&amp;#160;&amp;#160;&amp;#160; uba: 0x0081e118.14ee.05
192453&amp;#160; KDO Op code: LKR row dependencies Disabled
192454&amp;#160;&amp;#160;&amp;#160; xtype: XA flags: 0x00000000&amp;#160; bdba: 0x00c06104&amp;#160; hdba: 0x00c06103
192455&amp;#160; itli: 3&amp;#160; ispac: 0&amp;#160; maxfr: 4858
192456&amp;#160; tabn: 0 slot: 3 to: 3&lt;p&gt;&lt;/p&gt;&lt;p&gt;192496&amp;#160; REDO RECORD - Thread:1 RBA: 0x002304.00000cec.0010 LEN: 0x0180 VLD: 0x0d
192497&amp;#160; SCN: 0x0000.050dc428 SUBSCN:&amp;#160; 1 04/23/2009 09:40:34
192498&amp;#160; CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06104 OBJ:144543 SCN:0x0000.050dc426 SEQ:&amp;#160; 1 OP:11.4
192499&amp;#160; KTB Redo
192500&amp;#160; op: 0x01&amp;#160; ver: 0x01
192501&amp;#160; op: F&amp;#160; xid:&amp;#160; 0x0008.005.000081d3&amp;#160;&amp;#160;&amp;#160; uba: 0x0081eda9.1058.20
192502&amp;#160; KDO Op code: LKR row dependencies Disabled
192503&amp;#160;&amp;#160;&amp;#160; xtype: XA flags: 0x00000000&amp;#160; bdba: 0x00c06104&amp;#160; hdba: 0x00c06103
192504&amp;#160; itli: 3&amp;#160; ispac: 0&amp;#160; maxfr: 4858
192505&amp;#160; tabn: 0 slot: 3 to: 3&lt;/p&gt;&lt;/pre&gt;&lt;br /&gt;Yep, they both look right (which is more than can be said for Log Miner’s output!). The fact is that you could probably work out which transaction had locked the rows and the type of work it was doing, but still no nearer finding the offending SQL statement, really.&lt;br /&gt;&lt;br /&gt;In the next and absolutely definitely last part, I&#039;ll have a brief overview of some other suggestions such as &lt;a href=&quot;http://oraclue.com/2009/04/23/detecting-deadlock-source-part-2/&quot;&gt;Miladin Modrakivic&#039;s&lt;/a&gt;. 
    </content:encoded>

    <pubDate>Thu, 30 Apr 2009 14:35:00 +0100</pubDate>
    <guid isPermaLink="false">http://oracledoug.com/serendipity/index.php?/archives/1492-guid.html</guid>
    <category>ASH</category>
<category>Locking</category>

</item>
<item>
    <title>Diagnosing Locking Problems using ASH/LogMiner – Part 8</title>
    <link>http://oracledoug.com/serendipity/index.php?/archives/1491-Diagnosing-Locking-Problems-using-ASHLogMiner-Part-8.html</link>
    
    <comments>http://oracledoug.com/serendipity/index.php?/archives/1491-Diagnosing-Locking-Problems-using-ASHLogMiner-Part-8.html#comments</comments>
    <wfw:comment>http://oracledoug.com/serendipity/wfwcomment.php?cid=1491</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://oracledoug.com/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=1491</wfw:commentRss>
    

    <author>dougburns@yahoo.com (Doug Burns)</author>
    <content:encoded>
    So what about those SELECT FOR UPDATEs?&lt;br /&gt;&lt;br /&gt;I know that they’ll generate redo entries and so something should appear in both log file dumps and the LogMiner output, but what exactly will appear? (This is all on Oracle 10.2.0.4)&lt;br /&gt;&lt;br /&gt;For this post I’ll go back to the example from &lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1481-Diagnosing-Locking-Problems-using-ASH-Part-4.html&quot;&gt;Part 4&lt;/a&gt;, where Session 1 performs three different SELECT FOR UPDATE statements against the same table, TEST_TAB1, and rolls the first two back before leaving the third as the statement that’s blocking Session 2. i.e. Three possible guilty parties in very quick succession, which makes the exact source harder to find. This time, I granted select privileges on V$TRANSACTION to TESTUSER, so that we could take a quick peek at the contents after each SELECT FOR UPDATE. I&#039;ve also set up LogMiner access in the SYS session, as in the last couple of posts.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Session 1 – Connected as TESTUSER&lt;/strong&gt;&lt;br /&gt;
&lt;pre&gt;SQL&amp;gt; select pk_id, object_name from test_tab1 order by pk_id desc for update;

Trimmed ...
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 319 STMT_AUDIT_OPTION_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 317 STMT_AUDIT_OPTION_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 316 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 314 TABLE_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311 SYSTEM_PRIVILEGE_MAP
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 259 DUAL
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 258 DUAL

4477 rows selected.

SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;

START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
04/23/09 09:40:16&amp;#160;&amp;#160;&amp;#160; 0003001100008615&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 3&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 17&amp;#160;&amp;#160; 34325&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0

SQL&amp;gt; rollback

Rollback complete.

SQL&amp;gt; select pk_id from test_tab1 where object_name=&#039;SYSTEM_PRIVILEGE_MAP&#039; for update;

&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID
----------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 311
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313

SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;

START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
04/23/09 09:40:20&amp;#160;&amp;#160;&amp;#160; 0002000100008DAA&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1&amp;#160;&amp;#160; 36266&amp;#160;&amp;#160; 84788253&amp;#160;&amp;#160;&amp;#160;&amp;#160; 50DC41D

SQL&amp;gt; rollback;

Rollback complete.

SQL&amp;gt; select pk_id from test_tab1 where pk_id=313 for update;

&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID
----------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313

SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;

START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
04/23/09 09:40:20&amp;#160;&amp;#160;&amp;#160; 000900110000891B&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 9&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 17&amp;#160;&amp;#160; 35099&amp;#160;&amp;#160; 84788256&amp;#160;&amp;#160;&amp;#160;&amp;#160; 50DC420&lt;/pre&gt;&lt;br /&gt;So Session 1 has executed three different queries, all of which lock one or more rows including the row with PK_ID=313, has rolled back the first two (releasing the locks) and has just PK_ID=313 locked now.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Session 2 – Connected as TESTUSER&lt;/strong&gt;&lt;br /&gt;
&lt;pre&gt;SQL&amp;gt; select pk_id from test_tab1 where pk_id=313 for update;&lt;/pre&gt;&lt;br /&gt;Session 2 hangs, waiting for the lock&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Session 1 - Connected as TESTUSER&lt;/strong&gt;&lt;br /&gt;
&lt;pre&gt;SQL&amp;gt; rollback;

Rollback complete.&lt;/pre&gt;&lt;br /&gt;The lock is released and Session 2 acquires the lock and then releases it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Session 2 - Connected as TESTUSER&lt;/strong&gt;&lt;br /&gt;
&lt;pre&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; PK_ID
----------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 313

SQL&amp;gt; select start_time, xid, xidusn, xidslot,
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; xidsqn, start_scn, to_char(start_scn, &#039;XXXXXXXXXX&#039;)
&amp;#160; 3&amp;#160; from v$transaction
&amp;#160; 4&amp;#160; order by start_time;

START_TIME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN XIDSLOT&amp;#160; XIDSQN&amp;#160; START_SCN TO_CHAR(STA
-------------------- ---------------- ------ ------- ------- ---------- -----------
04/23/09 09:40:22&amp;#160;&amp;#160;&amp;#160; 00080005000081D3&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 8&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5&amp;#160;&amp;#160; 33235&amp;#160;&amp;#160; 84788259&amp;#160;&amp;#160;&amp;#160;&amp;#160; 50DC423

SQL&amp;gt; rollback;

Rollback complete.&lt;/pre&gt;&lt;br /&gt;Taken as a whole, the time-line looks like this&lt;br /&gt;&lt;br /&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;&lt;font size=&quot;2&quot;&gt;&lt;strong&gt;Transaction ID&amp;#160;&amp;#160;&amp;#160; Session 1 Activity&amp;#160; Transaction ID&amp;#160;&amp;#160; Session 2 Activity&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;0003001100008615&amp;#160; Whole Table Locked&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Locks Released&lt;br /&gt;0002000100008DAA&amp;#160; Two Rows Locked&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Locks Released&lt;br /&gt;000900110000891B&amp;#160; PK_ID=313 Locked&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Waiting to lock PK_ID=313&lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Lock Released&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 00080005000081D3 PK_ID=313 Locked&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/font&gt;&lt;/font&gt;&lt;br /&gt;OK, let’s see what LogMiner makes of this. First, let’s look for any entries associated with the specific transaction that was the blocker.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;SQL&amp;gt; select username,session# sid,serial#,sql_redo from v$logmnr_contents 
     where&amp;#160;XID = &#039;&amp;amp;&amp;amp;blocking_xid&#039;;
Enter value for blocking_xid: 000900110000891B
old&amp;#160;&amp;#160; 1: select username,session# sid,serial#,sql_redo from v$logmnr_contents 
         where&amp;#160;XID = &#039;&amp;amp;&amp;amp;blocking_xid&#039;
new&amp;#160;&amp;#160; 1: select username,session# sid,serial#,sql_redo from v$logmnr_contents 
         where&amp;#160;XID = &#039;000900110000891B&#039;

USERNAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SID&amp;#160;&amp;#160;&amp;#160; SERIAL#
------------------------------ ---------- ----------
SQL_REDO
-----------------------------------------------------------------------------------------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0
rollback;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Mmmm … ‘rollback’. Not too helpful, is it? Maybe if I look at the undo segment and slot from another of Kyle&#039;s queries?&lt;/p&gt;
&lt;pre&gt;SQL&amp;gt; select distinct xid , xidusn, xidslt, xidsqn, 
     username, session# sid, serial# , sql_redo
&amp;#160; 2&amp;#160; from v$logmnr_contents
&amp;#160; 3&amp;#160; where timestamp &amp;gt; sysdate- &amp;amp;minutes/(60*24)
&amp;#160; 4&amp;#160; and xidusn=&amp;amp;my_usn
&amp;#160; 5&amp;#160; and xidslt=&amp;amp;my_slot;
Enter value for minutes: 5
old&amp;#160;&amp;#160; 3: where timestamp &amp;gt; sysdate- &amp;amp;minutes/(60*24)
new&amp;#160;&amp;#160; 3: where timestamp &amp;gt; sysdate- 5/(60*24)
Enter value for my_usn: 9
old&amp;#160;&amp;#160; 4: and xidusn=&amp;amp;my_usn
new&amp;#160;&amp;#160; 4: and xidusn=9
Enter value for my_slot: 17
old&amp;#160;&amp;#160; 5: and xidslt=&amp;amp;my_slot
new&amp;#160;&amp;#160; 5: and xidslt=17&lt;p&gt;&lt;/p&gt;&lt;p&gt;XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDUSN&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDSLT&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDSQN USERNAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SID&amp;#160;&amp;#160;&amp;#160; SERIAL#
---------------- ---------- ---------- ---------- ------------------- ---------- ----------
SQL_REDO
---------------------------------------------------------------------------------
000900110000891B&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 9&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 17&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 35099&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0
rollback;&lt;/p&gt;&lt;p&gt;00090011FFFFFFFF&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 9&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 17 4294967295&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0
Unsupported&lt;/p&gt;&lt;/pre&gt;&lt;br /&gt;Now that&#039;s a bit interesting because I think we&#039;ll find that &#039;Unsupported&#039; operation is the third SELECT FOR UPDATE (which blocks Session 2) but the Transaction ID looks wrong. Oh, and why is the SQL_REDO &#039;Unsupported&#039;? Well, would you really want to redo a SELECT FOR UPDATE that merely locks rows?&lt;br /&gt;&lt;br /&gt;Next I’ll try displaying all operations against TEST_TAB1 in the&amp;#160;past 5 minutes. I’ll group the results so we only see the discrete actions and how many entries there are for each.
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;pre&gt;SQL&amp;gt; select xid, xidusn, xidslt, xidsqn, session#, serial#, sql_redo, count(*)
&amp;#160; 2&amp;#160; from v$logmnr_contents
&amp;#160; 3&amp;#160; where timestamp &amp;gt; sysdate- &amp;amp;minutes/(60*24)
&amp;#160; 4&amp;#160; and table_name=&#039;TEST_TAB1&#039;
&amp;#160; 5* group by xid, xidusn, xidslt, xidsqn, session#, serial#, sql_redo
Enter value for minutes: 60
old&amp;#160;&amp;#160; 3: where timestamp &amp;gt; sysdate- &amp;amp;minutes/(60*24)
new&amp;#160;&amp;#160; 3: where timestamp &amp;gt; sysdate- 60/(60*24)

XID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;XIDUSN&amp;#160;&amp;#160;&amp;#160;XIDSLT&amp;#160;&amp;#160;&amp;#160;&amp;#160; XIDSQN&amp;#160;&amp;#160; SESSION#&amp;#160;&amp;#160;&amp;#160; SERIAL# SQL_REDO&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; COUNT(*)
---------------- -------- -------- ---------- ---------- ---------- ----------- ----------
00080005FFFFFFFF&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 8&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 5 4294967295&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0 Unsupported&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1
0003001100008615&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 3&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 17&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 34325&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0 Unsupported&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;8858
00020001FFFFFFFF&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1 4294967295&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0 Unsupported&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 2
00090011FFFFFFFF&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 9&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 17 4294967295&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0 Unsupported&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1&lt;/pre&gt;&lt;br /&gt;Good - that&#039;s starting to look more like it. I can see all 4 discrete SELECT FOR UPDATE transactions from the test (the rollback operation returned by the previous query isn&#039;t necessarily specific to TEST_TAB1 so I&#039;m not surprised it doesn&#039;t appear). The&amp;#160;XIDs still look a little screwy and you&#039;re trusting me at this stage that these are SELECT FOR UPDATEs. Notice the number of entries for the different transactions - two single row updates, one 2 row update and a multiple row update. &lt;br /&gt;&lt;br /&gt;However, the transaction IDs for three of the transactions have the wrong sequence number of FFFFFFFF and even this output is the best I&#039;ve seen. I&#039;ve run this several times and sometimes it&#039;s captured&amp;#160;by LogMiner, sometime it isn&#039;t. I appreciate that&#039;s a little vague, but I have very little confidence in some of the results I&#039;ve seen on different tests.&lt;br /&gt;&lt;br /&gt;I dumped the log file for this example, so I&#039;ll look at that in the next part. &lt;br /&gt;&lt;br /&gt;Believe me when I say I&#039;m aware of how far I&#039;ve strayed from identifying the blocking SQL statement (you won&#039;t be getting that from redo entries) but I suppose I might as well carry on for one more post, maybe two. 
    </content:encoded>

    <pubDate>Thu, 23 Apr 2009 07:30:00 +0100</pubDate>
    <guid isPermaLink="false">http://oracledoug.com/serendipity/index.php?/archives/1491-guid.html</guid>
    <category>ASH</category>
<category>Locking</category>

</item>
<item>
    <title>Diagnosing Locking Problems using ASH/LogMiner – Part 7</title>
    <link>http://oracledoug.com/serendipity/index.php?/archives/1488-Diagnosing-Locking-Problems-using-ASHLogMiner-Part-7.html</link>
    
    <comments>http://oracledoug.com/serendipity/index.php?/archives/1488-Diagnosing-Locking-Problems-using-ASHLogMiner-Part-7.html#comments</comments>
    <wfw:comment>http://oracledoug.com/serendipity/wfwcomment.php?cid=1488</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://oracledoug.com/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=1488</wfw:commentRss>
    

    <author>dougburns@yahoo.com (Doug Burns)</author>
    <content:encoded>
    Picking up from the end of the last example, I immediately generated a log file dump as follows. (You&#039;ll need to look back at &lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1484-Diagnosing-Locking-Problems-using-ASH-Part-5.html&quot;&gt;Part 5&lt;/a&gt; to see that the ROWID, log file name etc. match up or just trust me that these steps came from a continuation of the same SYS session used in that test.)&lt;br /&gt;&lt;br /&gt;First I&#039;m going to work out the file and block number for the block containing the locked row in the test. That&#039;s why I selected the ROWID before I locked it.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;SYS@TEST1020&amp;gt; select file_id, file_name, dbms_rowid.rowid_block_number(&#039;&amp;amp;&amp;amp;my_rowid&#039;)
&amp;#160; 2&amp;#160; from dba_data_files
&amp;#160; 3&amp;#160; where file_id = dbms_rowid.rowid_to_absolute_fno(&#039;&amp;amp;&amp;amp;my_rowid&#039;,&#039;TESTUSER&#039;,&#039;TEST_TAB1&#039;);
Enter value for my_rowid: AAAN2NAAKAAAaBLAEX
old&amp;#160;&amp;#160; 1: select file_id, file_name, dbms_rowid.rowid_block_number(&#039;&amp;amp;&amp;amp;my_rowid&#039;)
new&amp;#160;&amp;#160; 1: select file_id, file_name, dbms_rowid.rowid_block_number(&#039;AAAN2NAAKAAAaBLAEX&#039;)
old&amp;#160;&amp;#160; 3: where file_id = dbms_rowid.rowid_to_absolute_fno(&#039;&amp;amp;&amp;amp;my_rowid&#039;, &#039;TESTUSER&#039;, 
               &#039;TEST_TAB1&#039;)
new&amp;#160;&amp;#160; 3: where file_id = dbms_rowid.rowid_to_absolute_fno(&#039;AAAN2NAAKAAAaBLAEX&#039;,&#039;TESTUSER&#039;, 
               &#039;TEST_TAB1&#039;)

&amp;#160;&amp;#160; FILE_ID
----------
FILE_NAME
---------------------------------------------------
DBMS_ROWID.ROWID_BLOCK_NUMBER(&#039;AAAN2NAAKAAAABLAEX&#039;)
---------------------------------------------------
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 10
C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1020\TEST_DATA01.DBF
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 106571&lt;/pre&gt;&lt;br /&gt;Now that I have a file and block number, I&#039;ll dump the redo log file but restrict the dump to entries related to that block.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;SYS@TEST1020&amp;gt; alter session set max_dump_file_size=unlimited;

Session altered.

SYS@TEST1020&amp;gt; alter system dump logfile &#039;&amp;amp;&amp;amp;my_member&#039;
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;dba min 10 106571 dba max 10 106571&lt;/strong&gt;;
old&amp;#160;&amp;#160; 1: alter system dump logfile &#039;&amp;amp;&amp;amp;my_member&#039;
new&amp;#160;&amp;#160; 1: alter system dump logfile &#039;C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1020\REDO01.LOG&#039;

System altered.&lt;/pre&gt;&lt;br /&gt;The trace file is created in user_dump_dest and I&#039;ve uploaded it &lt;a href=&quot;/log_dump_blog.txt&quot;&gt;here&lt;/a&gt;. Near the start of the file, I can check that block range.&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;DUMP OF REDO FROM FILE &#039;C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1020\REDO01.LOG&#039;
&amp;#160;Opcodes *.*
&amp;#160;&lt;strong&gt;DBAs: (file # 10, block # 106571) thru (file # 10, block # 106571)&lt;/strong&gt;
&amp;#160;RBAs: 0x000000.00000000.0000 thru 0xffffffff.ffffffff.ffff
&amp;#160;SCNs: scn: 0x0000.00000000 thru scn: 0xffff.ffffffff&lt;/pre&gt;&lt;br /&gt;The first redo entry appears soon after&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;REDO RECORD - Thread:1 RBA: 0x0000b3.00000009.0010 LEN: 0x0210 VLD: 0x0d
SCN: 0x0000.008a42e6 SUBSCN:&amp;#160; 1 04/20/2009 20:46:57
CHANGE #1 TYP:2 &lt;strong&gt;CLS: 1&lt;/strong&gt; AFN:10 &lt;strong&gt;DBA:0x0281a04b&lt;/strong&gt; &lt;strong&gt;OBJ:56717&lt;/strong&gt; SCN:0x0000.008a4239 SEQ:&amp;#160; 2 &lt;strong&gt;OP:11.19&lt;/strong&gt;
KTB Redo 
op: 0x11&amp;#160; ver: 0x01&amp;#160; 
op: F&amp;#160; &lt;strong&gt;xid:&amp;#160; 0x000a.024.00001864&lt;/strong&gt;&amp;#160;&amp;#160;&amp;#160; uba: 0x0080009d.031a.27&lt;/pre&gt;&lt;br /&gt;CLS: 1 - Data Class Block&lt;br /&gt;OP:11.19 - Operation Update Multiple Rows.&lt;br /&gt;&lt;br /&gt;Verify OBJ:56717 is TEST_TAB1 -&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;TESTUSER@TEST1020&amp;gt; select object_name, object_type
&amp;#160; 2&amp;#160; from user_objects
&amp;#160; 3&amp;#160; where object_id=56717;

OBJECT_NAME
-------------------
OBJECT_TYPE
-------------------
TEST_TAB1
TABLE&lt;/pre&gt;&lt;br /&gt;Verify DBA: &lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;SYS@TEST1020&amp;gt; select to_char(dbms_utility.make_data_block_address(10,106571),
&amp;#160; 2&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &#039;XXXXXXXX&#039;) from dual;

TO_CHAR(D
---------
&amp;#160; 281A04B&lt;/pre&gt;&lt;br /&gt;Transaction ID 0x000a.024.00001864 matches XID 0A00240064180000 from V$TRANSACTION during the test, albeit in the rearranged format.&lt;br /&gt;&lt;br /&gt;So this is definitely the blocking transaction and I can see the new value for the OBJECT_NAME column below ...&lt;br /&gt;&lt;br /&gt;
&lt;pre&gt;col&amp;#160; 1: [ 9]&amp;#160; 53 45 53 53 49 4f 4e 20 31&lt;/pre&gt;&lt;br /&gt;Which is the hexadecimal version of the ASCII string &#039;&#039;SESSION 1&#039;. Further on still, we&#039;ll see it being updated to &#039;SESSION 2&#039;.&lt;br /&gt;&lt;br /&gt;I could wade through that dump all day (and it might be a subject for future posts) but a couple of things should be clear. &lt;br /&gt;&lt;br /&gt;1) The redo log file contains plenty of information about the row updates, so if Log Miner is returning a single COMMIT action, either it&#039;s not working properly or I&#039;m doing something wrong.&lt;br /&gt;&lt;br /&gt;2) The contents of the redo log file might be an &lt;em&gt;indicator&lt;/em&gt; of the SQL statement that caused the blocking problem, but it won&#039;t tell me what that statement was.&lt;br /&gt;&lt;br /&gt;At this stage, I would say that ASH is starting to look more effective (in those cases where it can be used) than the alternatives being proposed. Remember, the whole point with ASH is that I don&#039;t need to predict when these problems might occur, so any solution that needs me to switch on traces is limited.&lt;br /&gt;&lt;br /&gt;If you&#039;re interested in learning more about log file dumps, I recommend you read &lt;a href=&quot;http://orainternals.files.wordpress.com/2008/07/riyaj_redo_internals_and_tuning_by_redo_reduction_doc.pdf&quot;&gt;Riyaj Shamsudeen&#039;s Redo Internals paper&lt;/a&gt; and &lt;a href=&quot;http://www.juliandyke.com/Presentations/RedoInternals.ppt&quot;&gt;Julian Dyke&#039;s Redo Internals presentation&lt;/a&gt;. 
    </content:encoded>

    <pubDate>Wed, 22 Apr 2009 01:30:00 +0100</pubDate>
    <guid isPermaLink="false">http://oracledoug.com/serendipity/index.php?/archives/1488-guid.html</guid>
    <category>ASH</category>
<category>Locking</category>

</item>
<item>
    <title>Diagnosing Locking Problems using ASH – Part 6</title>
    <link>http://oracledoug.com/serendipity/index.php?/archives/1487-Diagnosing-Locking-Problems-using-ASH-Part-6.html</link>
    
    <comments>http://oracledoug.com/serendipity/index.php?/archives/1487-Diagnosing-Locking-Problems-using-ASH-Part-6.html#comments</comments>
    <wfw:comment>http://oracledoug.com/serendipity/wfwcomment.php?cid=1487</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://oracledoug.com/serendipity/rss.php?version=2.0&amp;type=comments&amp;cid=1487</wfw:commentRss>
    

    <author>dougburns@yahoo.com (Doug Burns)</author>
    <content:encoded>
    &amp;quot;&lt;a href=&quot;http://www.imdb.com/title/tt0032138/quotes&quot;&gt;Toto, I&#039;ve a feeling we&#039;re not in Kansas any more.&lt;/a&gt;&amp;quot;&lt;br /&gt;&lt;br /&gt;What started as a simple write-up of a course demo gone wrong (or right, depending the way you look at these things) has grown arms and legs and staggered away from the original intention to talk about ASH. so I thought it might be worth taking a breather and see where we’ve been so far, before pressing on with another couple of posts.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1477-Diagnosing-Locking-Problems-using-ASH-Part-1.html&quot;&gt;Part 1&lt;/a&gt; – Introduced a blocking lock problem and showed how it would look in the OEM DB/Grid Control GUI.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1478-Diagnosing-Locking-Problems-using-ASH-Part-2.html&quot;&gt;Part 2&lt;/a&gt; – Demonstrated that you might not see any ASH samples for the blocking session if it doesn’t generate enough activity to be captured.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1480-Diagnosing-Locking-Problems-using-ASH-Part-3.html&quot;&gt;Part 3&lt;/a&gt; – Demonstrated that even if the blocking session *has* been active enough to be sampled, you might not have the specific activity that caused the problem.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1481-Diagnosing-Locking-Problems-using-ASH-Part-4.html&quot;&gt;Part 4&lt;/a&gt; – Reinforced part 3 to show that you might *think* you’re looking at the SQL statement which was holding the blocking lock when you actually aren’t and highlighted JB’s point that there is no way of knowing the SQL statement that was holding a particular lock. I see that &lt;a href=&quot;http://jonathanlewis.wordpress.com/2009/04/19/locking-sql/&quot;&gt;Jonathan Lewis has posted an illustration of this&lt;/a&gt; although let’s wait to see if Tanel Poder comes up with something &lt;img src=&quot;http://oracledoug.com/serendipity/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;&lt;br /&gt;&lt;br /&gt;I decided at this point to draw some conclusions as to the limitations of ASH as a tool in diagnosing locking problems after they’ve cleared. In amongst the meandering detail, it&#039;s important to reiterate that objective. There are lots of ways of diagnosing locking problems that are happening right now or that you expect to happen in future.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1484-Diagnosing-Locking-Problems-using-ASH-Part-5.html&quot;&gt;Part 5&lt;/a&gt; – The same subject cropped up on the Oak Table list and in amongst the suggestions were a couple to use LogMiner. One was from Kyle Hailey and I posted his scripts and output verbatim, but there were a few cut and paste errors and so I was faffing around with the post for a while and eventually added a comment to say I’d fix it later. I’ve now done so, re-running the tests with the correct code and removed the comment from the post. Sadly, none of the corrections fixed the two central problems with this approach&lt;br /&gt;&lt;br /&gt;a) Kyle and I have both found LogMiner behaviour to be very flaky indeed and it doesn’t seem to return the results I’d expect, over multiple tests by two different ‘testers’. (See &lt;a href=&quot;http://oracledoug.com/serendipity/index.php?/archives/1484-Diagnosing-Locking-Problems-using-ASH-Part-5.html&quot;&gt;the last post&lt;/a&gt; for an example.)&lt;br /&gt;&lt;br /&gt;b) I had to change the examples to use UPDATE statements rather than SELECT FOR UPDATEs. &lt;br /&gt;&lt;br /&gt;I’ll be looking at these two issues in Parts 7 and 8 (I think) but who knows what turn these posts will take next! Here’s where I think I might be heading&lt;br /&gt;&lt;br /&gt;Part 6 – You’re reading it.&lt;br /&gt;&lt;br /&gt;Part 7 – Redo log dump confirmation that the LogMiner queries in Part 5 aren&#039;t showing what I&#039;d expect.&lt;br /&gt;&lt;br /&gt;Part 8 – Redo log dump confirmation that redo entries won’t help with the original SELECT FOR UPDATE example anyway.&lt;br /&gt;&lt;br /&gt;Part 9 – Can I stop now, or should I attempt to reach a double-digit part number for the first (and hopefully last) time?&lt;br /&gt; 
    </content:encoded>

    <pubDate>Mon, 20 Apr 2009 21:07:53 +0100</pubDate>
    <guid isPermaLink="false">http://oracledoug.com/serendipity/index.php?/archives/1487-guid.html</guid>
    <category>ASH</category>
<category>Locking</category>

</item>

</channel>
</rss>