Showing posts with label Research. Show all posts
Showing posts with label Research. Show all posts
Thursday, May 7, 2015
Getting to know issues with 'read by other session' wait event
Do you like adding tools to your toolbox? Have you been in a situation where you needed to research the wait even that a session is just sitting in? Then tonight the article "Resolving Issues Where 'read by other session' Waits Occur When I/O is NOT Slow and Cause is Unknown" from MOS note ID 1476081.1 is probably exactly what you are looking for to add a little something to your arsenal!
Wednesday, July 3, 2013
Slow database? Are you suuuuuure?
Very intriguing article from Gorjan Todorovski with Pythian about how we can start monitoring the health of our DB in some surprising ways. This really has my mind spinning about how to implement some monitoring for the Support group, even though the article was more geared towards a DBA, I think that this is something crucial for Support to be aware of. I'm thinking of a temp table, or several, so that we can record the information and have it available for our own historical purposes of tracking performance even when some of the tables Gorjan references (which were new to me, so yay!) get their information purged out by design or DB reboot.
Extending this idea further, I'd like to see what I can do to track not only a few metrics (obviously Gorjan picked just a couple of well known wait events to model his idea with) in the DB but go into the Exadata storage cells to gauge their performance as well! Additionally, I've never worked with the epsilon subquery so I've got a new tool that needs to be sharpened for my toolbox!
Extending this idea further, I'd like to see what I can do to track not only a few metrics (obviously Gorjan picked just a couple of well known wait events to model his idea with) in the DB but go into the Exadata storage cells to gauge their performance as well! Additionally, I've never worked with the epsilon subquery so I've got a new tool that needs to be sharpened for my toolbox!
Tuesday, June 25, 2013
Latency heat mapping
Reading a post from my blog roll, I was looking forward to reading the originating post about how to create a latency heat map/chart but thought it would be clunky and would involve some long and drawn out installation. Surprisingly, it is neither clunky or involved and I can't wait to run this at work tomorrow!
Of course since the original post, there is a new version of code online after feedback and the rubber meeting the road.
Of course since the original post, there is a new version of code online after feedback and the rubber meeting the road.
Labels:
Contention,
Data,
Latching,
Monitoring,
Research,
SQL
Wednesday, April 10, 2013
Batches? We don't need no stinking batches!
The error message of "Unable to create batch" was being presented to our users when they were either trying to manually create receipt batches or when the automated processes would run from their requests. Digging into the SQL of the package started taking me down a rabbit hole from one custom package to another, until I finally found that even though the error message being returned to the users was custom but it was being raised as a result to a call to ARP_RW_BATCHES_PKG.INSERT_MANUAL_BATCH which is a completely canned Oracle procedure. Tracing through this started making me suspect the call over to arp_rw_batches_check_pkg.check_unique_batch_name but that didn't make any sense since we're talking about receipt classes as defined in ar_batch_sources which are set to AUTOMATIC for their numbering scheme in the auto_batch_numbering field. So I wind up taking a look at this piece of code a bit closer because nothing else looked possible if I was in the right spot:
SELECT COUNT(*)
INTO l_count
FROM AR_BATCHES bat
WHERE bat.batch_source_id = p_batch_source_id
AND bat.name = p_batch_name
AND ( p_row_id IS NULL
OR bat.rowid <> p_row_id );
IF ( l_count <> 0 ) THEN
FND_MESSAGE.set_name( 'AR', 'AR_DUP_BATCH_NAME' );
APP_EXCEPTION.raise_exception;
when I decide to see what the data in ar_batches shows me. Sure enough, the last_batch_num in ar_batch_sources for the batch_source_id in question was currently 5792097 and we have a sequence of batches with a name defined in ar_batches ranging from 5791705 to 5792958 which is preventing the package from successfully getting an available batch name to use in the creation of the batch as shown in these pieces of ARP_RW_BATCHES_PKG.INSERT_MANUAL_BATCH:
IF ( l_auto_batch_numbering = 'AUTOMATIC' ) THEN
UPDATE ar_batch_sources
SET last_batch_num = NVL( LAST_BATCH_NUM, 0 ) + 1
WHERE batch_source_id = l_batch_rec.batch_source_id;
SELECT NVL( LAST_BATCH_NUM, 0 )
INTO l_batch_rec.name
FROM ar_batch_sources
WHERE batch_source_id = l_batch_rec.batch_source_id;
This meant that the application was continuing to increment the last_batch_num value every time the users were trying to do their work, even though the batch names were already taken and it would continue to do so until it encountered a data value which did not already exist for the name field in ar_batches. The only option I could see is that we would need to manually push out the last_batch_num to match the last item in the sequence, so that a unique value would be returned the next time it would try to get a batch name (see above UPDATE statement). I didn't want to change the batch names of the items which were created months ago because then we’re changing historical data, and I can’t be 100% sure that it’s not used for reporting or other audit type functions by the business. After the appropriate approvals, we ran the below script:
UPDATE ar_batch_sources_all
SET last_batch_num = 5792958
WHERE batch_source_id = &batch_source_id
and last_batch_num = 5792097
Service was restored to the batch source after this update was applied, and all was well with the world! Then we were asked how we could make sure this doesn't happen in the future. After thinking through the answer a bit, I've come up with the below script which needs to go into a daily alert for us:
select a.batch_source_id, a.last_batch_num, a.org_id from ar_batch_sources_all a, ar_batches_all b
where (a.status not in ('I') or a.status is null)
and a.end_date_active is null
and a.batch_source_id = b.batch_source_id
and a.org_id = b.org_id
and b.name > a.last_batch_num
This was one of those problems where it's incredibly challenging, but also rewarding when you get to the end of the day having solved a pretty big problem and learning a lot in the process. Years ago I would've ran a trace and handed it over to development to figure out, but I've gained some seasoning since then and decided that I'd do as much "dirty work" as possible before I had to escalate up so I ended up digging down through 7 layers of code to find the actual root cause!
SELECT COUNT(*)
INTO l_count
FROM AR_BATCHES bat
WHERE bat.batch_source_id = p_batch_source_id
AND bat.name = p_batch_name
AND ( p_row_id IS NULL
OR bat.rowid <> p_row_id );
IF ( l_count <> 0 ) THEN
FND_MESSAGE.set_name( 'AR', 'AR_DUP_BATCH_NAME' );
APP_EXCEPTION.raise_exception;
when I decide to see what the data in ar_batches shows me. Sure enough, the last_batch_num in ar_batch_sources for the batch_source_id in question was currently 5792097 and we have a sequence of batches with a name defined in ar_batches ranging from 5791705 to 5792958 which is preventing the package from successfully getting an available batch name to use in the creation of the batch as shown in these pieces of ARP_RW_BATCHES_PKG.INSERT_MANUAL_BATCH:
IF ( l_auto_batch_numbering = 'AUTOMATIC' ) THEN
UPDATE ar_batch_sources
SET last_batch_num = NVL( LAST_BATCH_NUM, 0 ) + 1
WHERE batch_source_id = l_batch_rec.batch_source_id;
SELECT NVL( LAST_BATCH_NUM, 0 )
INTO l_batch_rec.name
FROM ar_batch_sources
WHERE batch_source_id = l_batch_rec.batch_source_id;
This meant that the application was continuing to increment the last_batch_num value every time the users were trying to do their work, even though the batch names were already taken and it would continue to do so until it encountered a data value which did not already exist for the name field in ar_batches. The only option I could see is that we would need to manually push out the last_batch_num to match the last item in the sequence, so that a unique value would be returned the next time it would try to get a batch name (see above UPDATE statement). I didn't want to change the batch names of the items which were created months ago because then we’re changing historical data, and I can’t be 100% sure that it’s not used for reporting or other audit type functions by the business. After the appropriate approvals, we ran the below script:
UPDATE ar_batch_sources_all
SET last_batch_num = 5792958
WHERE batch_source_id = &batch_source_id
and last_batch_num = 5792097
Service was restored to the batch source after this update was applied, and all was well with the world! Then we were asked how we could make sure this doesn't happen in the future. After thinking through the answer a bit, I've come up with the below script which needs to go into a daily alert for us:
select a.batch_source_id, a.last_batch_num, a.org_id from ar_batch_sources_all a, ar_batches_all b
where (a.status not in ('I') or a.status is null)
and a.end_date_active is null
and a.batch_source_id = b.batch_source_id
and a.org_id = b.org_id
and b.name > a.last_batch_num
This was one of those problems where it's incredibly challenging, but also rewarding when you get to the end of the day having solved a pretty big problem and learning a lot in the process. Years ago I would've ran a trace and handed it over to development to figure out, but I've gained some seasoning since then and decided that I'd do as much "dirty work" as possible before I had to escalate up so I ended up digging down through 7 layers of code to find the actual root cause!
Thursday, March 7, 2013
Journal Import: Suspended!
Off of our wait event alert, there was a session that just sitting in "statement suspended, wait error to be cleared" which was a new wait event I had not seen before. Doing some research I found it to be a Journal Import report which was in the process of deleting rows per this statement:
delete from GL_INTERFACE
where (user_je_source_name, nvl(group_id, -1)) in (listing of ledgers) and status = 'PROCESSED'
and request_id = user request
and rownum <= 5000
and (user_je_source_name, nvl(group_id, -1)) IN (SELECT src.user_je_source_name, nvl(group_id,-1) FROM gl_interface_control ic, gl_je_sources src WHERE ic.je_source_name = src.je_source_name
AND ic.interface_run_id = run id
AND ic.set_of_books_id = set of books id
AND ic.status = 'I'
AND nvl(ic.processed_table_code,'D') != 'S')
I can see in the table dba_outstanding_alerts information about this session as such:
Operation on resumable session Session 1579, Instance 1 session id 1579 suspended because of errors in rollback segment _SYSSMU1260_2942144267$. Error message is ORA-01628: max # extents (32765) reached for rollback segment _SYSSMU1260_2942144267$
Now the error message seems to be straightforward, and My Oracle Support notes ID 761848.1 & 788060.1 give some anecdotal evidence for what is going on, but we weren't able to get the root cause addressed in time to allow the report to complete successfully as it timed out internally and resulted in the report completing in Error. This means I'm not exactly sure how we could have resolved it, yet I have some suspicion that if we could have expanded the maximum number of extents for this segment we would have seen the session resume and move along. I'll put this down under as a mystery which needs research, because we need to learn more about it for next time when the report in question is something a lot more important and we can't go back to Oracle with an SR to fix.
delete from GL_INTERFACE
where (user_je_source_name, nvl(group_id, -1)) in (listing of ledgers) and status = 'PROCESSED'
and request_id = user request
and rownum <= 5000
and (user_je_source_name, nvl(group_id, -1)) IN (SELECT src.user_je_source_name, nvl(group_id,-1) FROM gl_interface_control ic, gl_je_sources src WHERE ic.je_source_name = src.je_source_name
AND ic.interface_run_id = run id
AND ic.set_of_books_id = set of books id
AND ic.status = 'I'
AND nvl(ic.processed_table_code,'D') != 'S')
I can see in the table dba_outstanding_alerts information about this session as such:
Operation on resumable session Session 1579, Instance 1 session id 1579 suspended because of errors in rollback segment _SYSSMU1260_2942144267$. Error message is ORA-01628: max # extents (32765) reached for rollback segment _SYSSMU1260_2942144267$
Now the error message seems to be straightforward, and My Oracle Support notes ID 761848.1 & 788060.1 give some anecdotal evidence for what is going on, but we weren't able to get the root cause addressed in time to allow the report to complete successfully as it timed out internally and resulted in the report completing in Error. This means I'm not exactly sure how we could have resolved it, yet I have some suspicion that if we could have expanded the maximum number of extents for this segment we would have seen the session resume and move along. I'll put this down under as a mystery which needs research, because we need to learn more about it for next time when the report in question is something a lot more important and we can't go back to Oracle with an SR to fix.
Thursday, January 17, 2013
v$sesstat - A new tool for the toolbox
While I think I have a handle on some of the techniques Tanel puts into the first of his three steps, I need to gain more understanding about what v$sesstat is and how I can use it the next time I get into a situation where I am out of ideas as to what's going wrong with our systems (and why I found it in the first place, but the problem went away before I could use this too extensively). This pretty much sums it up:
Only looking into #1 is enough in 90% of problem cases. But for advanced troubleshooting of complex and exotic problems I regularly have to dive into the #2 – V$SESSTAT performance counters (That’s the reason why I wrote Snapper for example).
If you aren't following Tanel, you need to be.
Only looking into #1 is enough in 90% of problem cases. But for advanced troubleshooting of complex and exotic problems I regularly have to dive into the #2 – V$SESSTAT performance counters (That’s the reason why I wrote Snapper for example).
If you aren't following Tanel, you need to be.
Subscribe to:
Posts (Atom)