Entries tagged as ASH
Oct 3: Network Events in ASH
This post was prompted by yet another performance problem identified using pretty pictures and Active Session History data. Although, as you'll see, some pretty old-fashioned tools played their part too!
ASH entries only exist for certain SQL*Net events. As usual, I think the design is very successful as long as you have a basic understanding of how ASH works.
The events all fall into one of three wait classes - Application, Network and Idle.
SQL> select wait_class, name from v$event_name where name like 'SQL*Net%' order by 1, 2; WAIT_CLASS NAME -------------------- ---------------------------------------- Application SQL*Net break/reset to client Application SQL*Net break/reset to dblink Idle SQL*Net message from client Idle SQL*Net vector message from client Idle SQL*Net vector message from dblink Network SQL*Net message from dblink Network SQL*Net message to client Network SQL*Net message to dblink Network SQL*Net more data from client Network SQL*Net more data from dblink Network SQL*Net more data to client Network SQL*Net more data to dblink Network SQL*Net vector data from client Network SQL*Net vector data from dblink Network SQL*Net vector data to client Network SQL*Net vector data to dblink 16 rows selected.
Hopefully that immediately dismisses the suggestion I've heard a few times that ASH/Top Activity ignores SQL*Net events. However, there are some events that are classed as Idle here that will not be captured in ASH data and will therefore not appear in the Top Activity screen. (In fact, even if you were to set the _ash_sample_all parameter you would not see these events in the Top Activity screen, even though ASH would contain entries for them. There is an additional filter applied to the data before it's displayed. In any case, I would *not* recommend setting _ash_sample_all except for fun.)
The most contentious of these is probably SQL*Net message from client. This event indicates that the Oracle server is waiting for the client to do something. If the client is a user session, Oracle is waiting for the user to do something - perhaps someone has a sql*plus session open that they're doing nothing with or they are filling in an application screen with data? From an Oracle perspective that session is Idle and there isn't much we can do to tune it, including the waits would heavily skew the data we're using for our analysis and, because events in the Idle class are specifically excluded from both ASH data and the OEM performance pages, such activity won't appear. That seems sensible to me.
However, if the client is actually an application server, those supposedly idle events can tell us something about end-to-end system performance. This blog post describes one real life situation where that event helped me identify the performance problem.
Back to the problem at hand. Sadly, in the midst of a a very chaotic work situation, I didn't manage to grab any of the graphs in question but we had a persistent problem with our critical batch processes spending time waiting on 'SQL*Net more data from client', which showed up very clearly as network class waits.
Now there are a number of reasons why this might be happening. Just a couple off the top of my head
1) There is a performance problem with the application server so Oracle is expecting more data to arrive more quickly than the app server can deliver it.
2) A network problem is affecting the delivery speed.
Although the issue here turned out to be number 2, I suppose the true underlying issue is that this application is insanely 'chatty' and uses very frequent round trips to deliver data. Maybe the application design could be improved first?
Ultimately we enabled Extended Tracing on the relevant sessions and confirmed that, yes, the sessions were spending most of their time waiting for the next batch of data and also how long these waits were. In practise, I'm not sure how much value the trace files added in this particular case. In fact, I think this is an excellent example of the underlying beauty of the sampling approach. As an event became *slower* it appeared *more often* in the samples and we had plenty of examples of how long some of the waits were. (But only some - probably the longest ones.)
How did we solve this mysterious problem? With two very useful tools
- ping/tracert. I simply went on to the app server, pinged the db server and confirmed that the response time (from my memory) was in the range of 70-80 milliseconds - far higher than I would expect. One of the Java developers then ran a trace route to the server which highlighted that network performance was great until we hit the db server. It turned out that one of the network interface cards had auto-negotiated down to 100M/s and this was the root cause - easily fixed. Sometimes old-fashioned and simple tools are all that you need, once you know where you should focus your attention (and ASH is great at focussing attention in the right place).
- The next tool is one of the reasons I wanted to write this post. What made me try ping? Whilst I would have got there eventually, I thought I would try my performance optimisation secret weapon! One just for the database wizards! Something I've been keeping an eye on is Oracle Support's attempt to give people a methodical approach to solving performance issues via the Oracle Performance Diagnostic Guide on My Oracle Support - Note ID 390374.1. There are several guides on that landing page but here is the link to the Slow Performance PDF. (You'll need an account to be able to access this.) This is an example of the kind of advice there. (Note that this is for SQL*Net message from client, but you would tend to get most events together anyway and there's similar advice for more data from client.)
"Cause Identified: Slow network limiting the response time between client and database.
The network is saturated and this is limiting the ability of the client and database to communicate with each other.
Cause Justification
TKProf:
1. SQL*Net message from client waits are a large part of the overall time (see the overall summary
section)
2. Array operations are used. This is seen when there are more than 5 rows per execution on average (divide total rows by total execution calls for both recursive and non-recursive calls)
3. The average time for a ping is about equal to twice the average time for a SQL*Net message from client wait and this time is more than a few milliseconds. This indicates that most of the client time is spent in the network."
I've been loathe to mention this document until now because it looks like a work in progress (albeit not updated since the start of 2009), isn't perfect, has gaps and I can imagine a number of my peers taking issue with some of the content. But for something to aid learning if you're not naturally great at solving performance problems, I can think of much worse starting places.
In the end, what could have been a really tricky performance problem (and might have taken a while to notice) was apparent with a brief glance at OEM and we could then follow up by applying the right analysis tools to the problem.
To finish off, when I searched Google for any examples of 'SQL*Net more data from client', one of the first results that cropped up was a chapter from one of my favourite books - 'Optimising Oracle Performance' by Cary Millsap and Jeff Holt. Well worth a read ....
Sep 19: Alternative Pictures Demo
Not long after I'd finished the last post, I realised I could reinforce the points I was making with a quick post showing another one of the example tests supplied with Swingbench - the Calling Circle (CC) application. Like the Sales Order Entry application, CC is a mixed read/write test consisting of small transactions. As always, there's more information at Dominic's website.
One of the main differences to the SOE test is that the CC test consumes data so you need to generate a new set of data before each test using the supplied ccwizard utility. I won't show you the entire workflow here but enough to give you a flavour of the process. The utility is the same one used to create the necessary CC schema in the first place but the option I'm looking for here is "Generate Data for Benchmark Run".

I'd already decided that my CC schema is populated with data for 1 million customers when I created it so I just need to specify the number of transactions the next test will be for. I happen to know that on my particular configuration, a 1000 transaction test will take around 5 minutes to run.

I ran the test twice. I've highlighted the first run here in the Top Activity page.

It should be clear that CC suffers significant log file sync waits on my particular test platform, just like the SOE test. Therefore I'll regenerate the test data set, enable asynchronous commits and re-run the test. Here I've highlighted the second test run.

As well as seeing a similar change in the activity profile according to the ASH samples (the log file sync activity has disappeared as has the LGWR System I/O), there's a significant difference to the SOE test. Because this test run is based on a specific workload volume, as defined by the size of the test data, rather than a fixed time period, the second test run completed more quickly than the first run. The activity only fills the 5 minute activity bar partially, rather than the first test which filled the whole bar.
If you test a specific and limited workload volume it is much clearer from the Top Activity page which test is processing transactions more quickly, based on the Time axis. That's why I didn't pick this example the first time - it's too obvious what's going on!
Sep 12: That Pictures demo in full
With so many potential technical posts in my pile, it was initially difficult to decide where to start again but I figured I should avoid the stats series until I'm back into the swing of things
When I gave the evening demo session in the Amis offices I think the 2 hours went pretty well but, as usual with the OEM presentations, I got a little carried away and didn't conclude the demo properly. (This is also the demo I *would* have done at Hotsos last year if the damn thing had worked first time
I began by running a 4 concurrent user Sales Order Entry (SOE) test using Dominic Giles' Swingbench utility. I won't got into the details of the SOE test because I don't think it's particularly relevant here but you can always download and/or read about Swingbench for yourself at Dominics website.
I ran the test for a fixed period of 5 minutes using no think-time delay.

Using the capability to look at ASH data in the recent past, the OEM Top Activity page looks like this.

- There was a fairly consistent average of 4-5 active sessions over the 5 minutes period and, looking at the Top Sessions panel in the bottom right of the screen, these were four SOE sessions of similar activity levels and the LGWR process.
- The majority of time was spent on User I/O, System I/O and Commit Wait Class activity, with a little CPU.
- Three PL/SQL blocks were responsible for most of the Commit activity.
- The LGWR process was responsible for most of the System I/O activity.
I'll leave it there for now and won't drill down into any more detail.
In terms of optimising the performance of this test, what might I consider doing?
The most important aspect is to optimise the application to reduce the resource consumption to the minimum required to achieve our objectives. There's a whole bunch of User I/O activity that could perhaps be eliminated? But I'm going to ask you to accept the big assumption here that this application has been optimised and that I'm just using a Swingbench test as an illustration of the type of system-wide problem you could see. In that case, my eye is drawn to the Commit activity.
When I'm teaching this stuff, I'm usually deliberately simplistic (at least at the end of the process) and highlight that what I'm interested in 'tuning' is whatever most sessions are waiting on according to the ASH samples this screen uses. I used to explain how I'd look for the biggest areas of colour, drill down into those and identify what's going on. Sadly, I later heard that someone (I think it was JB at Oracle*) had already come up with a nifty acronym for this - COBS. Click on the Big Stuff! One day I will come up with a nifty acronym for something too, but you shouldn't hold your breath waiting.
So, if I click on the big stuff here, I can see that the Commit Class waits are log file sync.

How might I reduce the time that sessions are waiting for log file sync? Here are a few reasons why the test sessions might be waiting on log file sync more often or for longer than I'd like.
- Application design - committing too frequently
- CPU starvation
- Slow I/O to online redo log files
Whether waits are predominantly the result of CPU overload or slow I/O can be determined by looking at the underlying log file parallel write wait times on the LGWR process but that's a bigger subject for another time.
You can look into all of these in more depth - and should - but as this is designed to be a fun demo of the pretty pictures (it used to be 'the USB stick demo'), I'll simply try to eliminate that activity and re-run the same test. Here's how Top Activity looks now.

Oh. Maybe that wasn't what you expected? OK, the LGWR activity has disappeared, but it seems the system is almost as busy as it was before but that the main bottleneck is now User I/O activity. That's often the way, though - you eliminate one bottleneck in a system and it just shows up somewhere else. It must be good to get rid of log file sync waits though, right? User I/O seems like more productive work and I've managed to make the LGWR activity disappear completely.
But then if you were to look at this graph in terms of Average Active Sessions or DB Time or (as it's more likely to be expressed) how big that spike looks, the two tests would look similarly busy from a system-wide perspective. They were but the real question is - busy doing *what*? There's some important information missing here and Swingbench is able to provide it.

TotalCompletedTransactions 22,868
Mmmm, so I wonder what that value was for the first run?

TotalCompletedTransactions 12,232
Woo-hoo! *That's* what I call tuning a benchmark - processing almost twice the number of transactions in the same 5 minute period.
So it turns out that the sessions in the database *were* just as busy during the second run (not too surprising seeing as the test has no user think time so keeps hammering the database with as many requests as it can handle) but that they were busy doing the more productive work of reading and processing data rather than just waiting for COMMITs to complete.
I raised this issue of DB Time not showing activity details with Graham Wood* at Oracle in relation to a previous blog post. I think he made the point to me that that's why the OEM Performance Home Page is *not* the Top Activity page. If I take a look at that home page, it shows me the same information as the Swingbench results output did, albeit not as clearly

Looking at the Throughput graph, I can see that the second test processesd around double the number of Transactions per second for the same test running on the same system.
To wrap up (and be a little defensive) ...
- Yes, I could have traced one or more sessions and generated a complete and detailed response time profile that should have lead me to the same conclusion.
- Yes, as this is a controlled test environment and I'm the only 'user', AWR/Statspack would have been an even more powerful analysis tool in the right hands.
- The Top Activity page is not the most appropriate tool for this job but it is handy for illustrating concepts.
- Lest I seem a slavish pictures fan, I'm showing how people might misuse or misundersand ASH/Top Activity. In this case, the Home Performance Page is a much better tool because we're looking at system-wide data and not drilling into session or SQL details.
Oh, and what is my Top Secret Magic Silver Bullet Tuning Tip for OLTP-type applications? (only to be used by Advanced Oracle Performance Wizards)
alter system set commit_write='BATCH, NOWAIT';
Done! In fact, why not just use this on all of your systems, just in case people are waiting on log file sync?
(Leaves space below for angry responses and my withering humorous retorts)
* This is not name-dropping, this is giving due credit to the people who really know what they're talking about
May 1: Diagnosing Locking Problems using ASH/LogMiner – The End
Except it's not the end, of course. What I mean is that I usually agree with what Miladin Modrakovic said in one of his comments on his first deadlock blog post.
"There is always way around."
As I keep saying, there are many different ways of diagnosing locking problems. Which one works best depends on the situation you're faced with but I don't think there's an 'end' here, a single solution that works well in all circumstances.
Currently occurring problems are easy. There's locking information in V$SESSION, V$TRANSACTION, V$LOCK etc and you can probably track down the SQL statement that's caused the problem.
Those in the past are more difficult but, even in difficult cases, you'll often be able to get close enough to work out what'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't always return what you'd expect when the data doesn't actually change.
If you can recreate the problem or it's an ongoing problem that you expect to reoccur, then you can enable various traces and have lots of information that will help you solve most real world problems.
But the specific challenge here was to see which SQL statement was responsible for a locking problem, after the fact, when you weren't expecting the problem in the first place.
I thought I'd give Miladin's most recent post a try because it contains another interesting strategy - Flashback queries. Deadlock problems are different, not least because you have the resulting trace file. So his example isn't designed to address what I've been looking at here, but I thought I should give it a try, as suggested by Vlado here.
The example he uses is a deadlock situation caused by updates, but I'll apply it to the specific example I've been using here. Three SELECT FOR UPDATE statements - which one was the blocker? This time I've created TEST_TAB2 with fewer rows, but the rest of the test is the same.
SQL> create table test_tab2 as select object_id pk_id, object_name from all_objects where object_id < 400;Table created.
SQL> select * from test_tab2;
PK_ID OBJECT_NAME ---------- ------------------------------ 258 DUAL 259 DUAL 311 SYSTEM_PRIVILEGE_MAP 313 SYSTEM_PRIVILEGE_MAP 314 TABLE_PRIVILEGE_MAP 316 TABLE_PRIVILEGE_MAP 317 STMT_AUDIT_OPTION_MAP 319 STMT_AUDIT_OPTION_MAP
8 rows selected.
SQL> @doug1 SQL> column xidusn format 999 SQL> column xidslot format 999 SQL> column xidsqn format 999999 SQL> select pk_id, object_name from test_tab2 order by pk_id desc for update;
PK_ID OBJECT_NAME ---------- ------------------------------ 319 STMT_AUDIT_OPTION_MAP 317 STMT_AUDIT_OPTION_MAP 316 TABLE_PRIVILEGE_MAP 314 TABLE_PRIVILEGE_MAP 313 SYSTEM_PRIVILEGE_MAP 311 SYSTEM_PRIVILEGE_MAP 259 DUAL 258 DUAL
8 rows selected.
SQL> select start_time, xid, xidusn, xidslot, 2 xidsqn, start_scn, to_char(start_scn, 'XXXXXXXXXX') 3 from v$transaction 4 order by start_time;
START_TIME XID XIDUSN XIDSLOT XIDSQN START_SCN TO_CHAR(STA -------------------- ---------------- ------ ------- ------- ---------- ----------- 05/01/09 11:53:36 0003001F000087AA 3 31 34730 0 0
SQL> rollback;
Rollback complete.
SQL> select pk_id from test_tab2 where object_name='SYSTEM_PRIVILEGE_MAP' for update;
PK_ID ---------- 311 313
SQL> select start_time, xid, xidusn, xidslot, 2 xidsqn, start_scn, to_char(start_scn, 'XXXXXXXXXX') 3 from v$transaction 4 order by start_time;
START_TIME XID XIDUSN XIDSLOT XIDSQN START_SCN TO_CHAR(STA -------------------- ---------------- ------ ------- ------- ---------- ----------- 05/01/09 11:53:37 0006000500008EEE 6 5 36590 85744191 51C5A3F
SQL> rollback;
Rollback complete.
SQL> select pk_id from test_tab2 where pk_id=313 for update;
PK_ID ---------- 313
SQL> select start_time, xid, xidusn, xidslot, 2 xidsqn, start_scn, to_char(start_scn, 'XXXXXXXXXX') 3 from v$transaction 4 order by start_time;
START_TIME XID XIDUSN XIDSLOT XIDSQN START_SCN TO_CHAR(STA -------------------- ---------------- ------ ------- ------- ---------- ----------- 05/01/09 11:53:37 0002001900008F2E 2 25 36654 85744194 51C5A42
So Session 1 has one row locked and will block Session 2.
SQL> @doug2 SQL> column xidusn format 999 SQL> column xidslot format 999 SQL> column xidsqn format 999999 SQL> SQL> select pk_id from test_tab2 where pk_id=313 for update;
I rollback Session 1
SQL> rollback;Rollback complete.
and Session 2 acquires the lock, then rolls back.
PK_ID ---------- 313SQL> SQL> select start_time, xid, xidusn, xidslot, 2 xidsqn, start_scn, to_char(start_scn, 'XXXXXXXXXX') 3 from v$transaction 4 order by start_time;
START_TIME XID XIDUSN XIDSLOT XIDSQN START_SCN TO_CHAR(STA -------------------- ---------------- ------ ------- ------- ---------- ----------- 05/01/09 11:53:39 00040018000067E3 4 24 26595 85744197 51C5A45
SQL> SQL> rollback;
Rollback complete.
This is what comes back from Flashback queries.
SQL> @miladin SQL> set echo on SQL> SQL> SELECT VERSIONS_XID 2 , VERSIONS_STARTTIME 3 , VERSIONS_ENDTIME 4 , VERSIONS_STARTSCN 5 , VERSIONS_ENDSCN 6 , VERSIONS_OPERATION 7 , pk_id, object_name 8 FROM testuser.test_tab2 VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE 9 ORDER BY VERSIONS_STARTTIME;VERSIONS_XID ---------------- VERSIONS_STARTTIME --------------------------------------------------------------------------- VERSIONS_ENDTIME --------------------------------------------------------------------------- VERSIONS_STARTSCN VERSIONS_ENDSCN V PK_ID OBJECT_NAME ----------------- --------------- - ---------- ------------------------------
258 DUAL
259 DUAL
311 SYSTEM_PRIVILEGE_MAP
319 STMT_AUDIT_OPTION_MAP
314 TABLE_PRIVILEGE_MAP
316 TABLE_PRIVILEGE_MAP
317 STMT_AUDIT_OPTION_MAP
313 SYSTEM_PRIVILEGE_MAP
8 rows selected.
SQL> SQL> SELECT * FROM testuser.test_tab2 2 AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' MINUTE);
PK_ID OBJECT_NAME ---------- ------------------------------ 258 DUAL 259 DUAL 311 SYSTEM_PRIVILEGE_MAP 313 SYSTEM_PRIVILEGE_MAP 314 TABLE_PRIVILEGE_MAP 316 TABLE_PRIVILEGE_MAP 317 STMT_AUDIT_OPTION_MAP 319 STMT_AUDIT_OPTION_MAP
8 rows selected.
SQL> SQL> -- Narrow to specific column SQL> SQL> SELECT versions_xid XID, versions_startscn START_SCN, versions_endscn END_SCN, versions_operation OPERATION, object_name 2 FROM testuser.test_tab2 3 VERSIONS BETWEEN SCN MINVALUE AND MAXVALUE 4 WHERE pk_id=313;
XID START_SCN END_SCN O OBJECT_NAME ---------------- ---------- ---------- - ------------------------------ SYSTEM_PRIVILEGE_MAP
Not much in other words. To check what I'm doing, I COMMITed the final update from Session 1 (as opposed to rolling it back) and got what I'd hope to see, because there's actually a different committed version of the data.
SQL> @miladin SQL> set echo on SQL> SQL> SELECT VERSIONS_XID 2 , VERSIONS_STARTTIME 3 , VERSIONS_ENDTIME 4 , VERSIONS_STARTSCN 5 , VERSIONS_ENDSCN 6 , VERSIONS_OPERATION 7 , pk_id, object_name 8 FROM testuser.test_tab2 VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE 9 ORDER BY VERSIONS_STARTTIME;VERSIONS_XID ---------------- VERSIONS_STARTTIME --------------------------------------------------------------------------- VERSIONS_ENDTIME --------------------------------------------------------------------------- VERSIONS_STARTSCN VERSIONS_ENDSCN V PK_ID OBJECT_NAME ----------------- --------------- - ---------- ------------------------------ 0002000A00008F4B 01-MAY-09 12.04.39
85744966 U 313 XID 3
259 DUAL
311 SYSTEM_PRIVILEGE_MAP
319 STMT_AUDIT_OPTION_MAP
314 TABLE_PRIVILEGE_MAP
316 TABLE_PRIVILEGE_MAP
317 STMT_AUDIT_OPTION_MAP
258 DUAL
01-MAY-09 12.04.39 85744966 313 SYSTEM_PRIVILEGE_MAP
9 rows selected.
SQL> SQL> SELECT * FROM testuser.test_tab2 2 AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' MINUTE);
PK_ID OBJECT_NAME ---------- ------------------------------ 258 DUAL 259 DUAL 311 SYSTEM_PRIVILEGE_MAP 313 SYSTEM_PRIVILEGE_MAP 314 TABLE_PRIVILEGE_MAP 316 TABLE_PRIVILEGE_MAP 317 STMT_AUDIT_OPTION_MAP 319 STMT_AUDIT_OPTION_MAP
8 rows selected.
SQL> SQL> -- Narrow to specific column SQL> SQL> SELECT versions_xid XID, versions_startscn START_SCN, versions_endscn END_SCN, versions_operation OPERATION, object_name 2 FROM testuser.test_tab2 3 VERSIONS BETWEEN SCN MINVALUE AND MAXVALUE 4 WHERE pk_id=313;
XID START_SCN END_SCN O OBJECT_NAME ---------------- ---------- ---------- - ------------------------------ 0002000A00008F4B 85744966 U XID 3 85744966 SYSTEM_PRIVILEGE_MAP
So the problem is that although there's some locking information for the SELECT FOR UPDATEs (see previous blog posts) they're difficult to diagnose because there were no changes to the data.
Ultimately, I like the way Graham Wood put it in an email, so I asked him if I could quote it here.
"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.
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 'possibles' list by analysis of object access by the various statements.
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 waiter is blocked."
There'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's no way to guarantee that you have the correct statement. But with so many different possibilities to get you close to a diagnosis, I'm not sure having the SQLID in there would be very useful - certainly not worth amending the ITL structure.
This series of posts is already way out of control, I've got other things I want to post about and I'm sort of bored by myself
Apr 30: Diagnosing Locking Problems using ASH/LogMiner – Part 9
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.
SQL> alter system dump logfile '&&my_member' 2 layer 11 opcode 4; old 1: alter system dump logfile '&&my_member' new 1: alter system dump logfile '/data/oradata/PPL/redo03.log'System altered.
Next, a quick reminder of the transaction history from the previous tests, that this log file covers.
Transaction ID Session 1 Activity Transaction ID Session 2 Activity
0003001100008615 Whole Table Locked
Locks Released
0002000100008DAA Two Rows Locked
Locks Released
000900110000891B PK_ID=313 Locked Waiting to lock PK_ID=313
Lock Released 00080005000081D3 PK_ID=313 Locked
Looking at the header (line numbers added by vi), I can see that the dump is restricted to Opcode 11.4.
19 DUMP OF REDO FROM FILE '/data/oradata/PPL/redo03.log' 20 Opcode 11.4 only 21 RBAs: 0x000000.00000000.0000 thru 0xffffffff.ffffffff.ffff 22 SCNs: scn: 0x0000.00000000 thru scn: 0xffff.ffffffff 23 Times: creation thru eternity
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.
50 REDO RECORD - Thread:1 RBA: 0x002304.00000002.0010 LEN: 0x45b0 VLD: 0x0d 51 SCN: 0x0000.050dc3e9 SUBSCN: 1 04/23/2009 09:40:19 52 CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06125 OBJ:144543 SCN:0x0000.050dc005 SEQ:185 OP:11.4 53 KTB Redo 54 op: 0x01 ver: 0x01 55 op: F xid: 0x0003.011.00008615 uba: 0x00803aaa.0f30.01 56 KDO Op code: LKR row dependencies Disabled 57 xtype: XA flags: 0x00000000 bdba: 0x00c06125 hdba: 0x00c06103 58 itli: 2 ispac: 0 maxfr: 4858 59 tabn: 0 slot: 183 to: 2
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)
60 CHANGE #2 TYP:0 CLS:21 AFN:2 DBA:0x00800029 OBJ:4294967295 SCN:0x0000.050dc3c0 SEQ: 1 OP:5.2 61 ktudh redo: slt: 0x0011 sqn: 0x00008615 flg: 0x000a siz: 108 fbi: 0 62 uba: 0x00803aaa.0f30.01 pxid: 0x0000.000.00000000
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: 0x0002’ (two spaces in that string).
192358 REDO RECORD - Thread:1 RBA: 0x002304.00000ce8.0010 LEN: 0x0238 VLD: 0x0d 192359 SCN: 0x0000.050dc41f SUBSCN: 1 04/23/2009 09:40:20 192360 CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06104 OBJ:144543 SCN:0x0000.050dc411 SEQ:102 OP:11.4 192361 KTB Redo 192362 op: 0x01 ver: 0x01 192363 op: F xid: 0x0002.001.00008daa uba: 0x00808827.124c.31 192364 KDO Op code: LKR row dependencies Disabled 192365 xtype: XA flags: 0x00000000 bdba: 0x00c06104 hdba: 0x00c06103 192366 itli: 3 ispac: 0 maxfr: 4858 192367 tabn: 0 slot: 2 to: 3
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:
192447 REDO RECORD - Thread:1 RBA: 0x002304.00000cea.0010 LEN: 0x0180 VLD: 0x0d 192448 SCN: 0x0000.050dc423 SUBSCN: 1 04/23/2009 09:40:25 192449 CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06104 OBJ:144543 SCN:0x0000.050dc41f SEQ: 4 OP:11.4 192450 KTB Redo 192451 op: 0x01 ver: 0x01 192452 op: F xid: 0x0009.011.0000891b uba: 0x0081e118.14ee.05 192453 KDO Op code: LKR row dependencies Disabled 192454 xtype: XA flags: 0x00000000 bdba: 0x00c06104 hdba: 0x00c06103 192455 itli: 3 ispac: 0 maxfr: 4858 192456 tabn: 0 slot: 3 to: 3192496 REDO RECORD - Thread:1 RBA: 0x002304.00000cec.0010 LEN: 0x0180 VLD: 0x0d 192497 SCN: 0x0000.050dc428 SUBSCN: 1 04/23/2009 09:40:34 192498 CHANGE #1 TYP:0 CLS: 1 AFN:3 DBA:0x00c06104 OBJ:144543 SCN:0x0000.050dc426 SEQ: 1 OP:11.4 192499 KTB Redo 192500 op: 0x01 ver: 0x01 192501 op: F xid: 0x0008.005.000081d3 uba: 0x0081eda9.1058.20 192502 KDO Op code: LKR row dependencies Disabled 192503 xtype: XA flags: 0x00000000 bdba: 0x00c06104 hdba: 0x00c06103 192504 itli: 3 ispac: 0 maxfr: 4858 192505 tabn: 0 slot: 3 to: 3
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.
In the next and absolutely definitely last part, I'll have a brief overview of some other suggestions such as Miladin Modrakivic's.


Comments