Monday, May 16, 2022

Return of a blogger (plus a bit of ORA-7445 [LpxMemFree()+200] )

Considering that "conference life" is picking up (two in-person events in June!), it is time to start writing something meaningful (yes, I am back to blogging after years of ignorance)! 

To cover event previews I need a bit more prep time, while today I would like to share a small story (narrow, but very practical!)

At Dulcian we have a couple of systems still on Oracle 11g (yeah, I understand that it is outdated). And today one of my support people started to complain about ORA-07445. To be precise - ORA-7445  [LpxMemFree()+200]. And you know how much fun is to sort out those errors, especially considering my gut feeling ("I bet, XMLtype is misbehaving!")

Obviously, first two steps were obvious: Google and MOS. 

Oook... Google gave me a direct hit - and I indeed was right, it was XML parsing issue - Doc ID 2220757.1 

And in case you don't have MOS access - here is a code snippet to replicate (it should blow up with "end of communication channel" plus corresponding trace file):

 declare
  lv_text varchar2(6000);
  lv_temp_xml xmltype;
  lv_len number := 0;
begin
  lv_text := '<LPCNotes Subject="Comments for LPC " Text="'
  || to_char(sysdate, 'dd-Mon-yy hh24:mi')
  || ' '
  ||lpad('A',4033,'A')
  || '" />';
  lv_len := length(lv_text);
  dbms_output.put_line('Length of the 3rd run is '||lv_len);
  lv_temp_xml := sys.xmltype(lv_text);
 end;

The proposed solution was to enable some kind of "old parser" - you can do it on either session of system level. Considering that everything else in our system worked fine, I added it via Dynamic SQL just before the problematic code, so it will be less overall system impact:

 declare
  lv_text varchar2(6000);
  lv_temp_xml xmltype;
  lv_len number := 0;
begin
  execute immediate 'alter session set events ''31156 trace name context forever, level 1024''';
  lv_text := '<LPCNotes Subject="Comments for LPC " Text="'
  || to_char(sysdate, 'dd-Mon-yy hh24:mi')
  || ' '
  ||lpad('A',4033,'A')
  || '" />';
  lv_len := length(lv_text);
  dbms_output.put_line('Length of the 3rd run is '||lv_len);
  lv_temp_xml := sys.xmltype(lv_text);
 end;

And the whole problem was gone! After a bit more digging I found that this kind of approach could help with a number of other similar ORA-07445 errors if you still on 11.2.0.4 (here is a doc from MOS: Bug 14822091)

Hope, it helps!

P.s. Footprint: in the doc they use hexadecimal level 0x400, but I prefer to use decimals (1024) for readability. What is funny, in the bug description whoever wrote it also used decimal - so, don't worry, it is the same stuff written differently.

Thursday, February 11, 2021

Tuesday, February 9, 2021

RMOUG-2021 Day #2

 If anybody needs - here is my most recent presentation: "Hidden Gems of Performance Tuning":

https://www.slideshare.net/MishaRosenblum/hidden-gems-of-performance-tuning-hierarchical-profiler-and-dml-trigger-optimization

P.s. It was a pleasure to get back to RMOUG  - even virtually!

Wednesday, April 5, 2017

Collaborate'17: Slides are available

For some reasons, slides from one of my presentations are not available via the conference agenda tool. No problem, here is a direct link:
https://www.slideshare.net/MishaRosenblum/developers-approach-to-code-management

More thoughts/comments about the conference are coming! To be continued...

Wednesday, April 20, 2016

Collaborate'16: Slides are available

First, of all, I would like to thank everybody who came to my presentations on Collab'16! It was a pleasure talking FOR you :-) A lot of nice questions/comments/follow-ups.

Second, some SlideShare uploads (as promised):
- my talk about user-defined functions - that's where I was talking a lot about execution counts and the impact of Cost-Based Optimizer on them:
http://www.slideshare.net/MishaRosenblum/plsql-userdefined-functions-in-the-read-world

- updated version of my "Printing without Printers" talk. As usual, I was reminded that "the best live demo is dead demo". Now you've got everything covered explicitly:
http://www.slideshare.net/MishaRosenblum/printing-without-printers


Monday, April 13, 2015

Collaborate'15 A New View of Database Views

Thanks to everybody who visited my presentation! Here is a link to view and/or download the slide set: http://www.slideshare.net/MishaRosenblum/2015-458-rosenblumpptfinal

Feel free to ask questions!

Tuesday, October 7, 2014

NYOUG Training Event: "High Performance PL/SQL" on November 7, 2014

If you want to be able to create contemporary high-performing PL/SQL code, welcome to my training event in NYC (hosted by NYOUG) on November 7, 2014:

http://nyoug.org/event/nyoug-fall-2014-training-event-high-performance-plsql/?instance_id=258

I think, it is as important as ever to follow best practices for server-side development. There are lots of options that could get the job done "now", but very few that would survive for months/years. Also, there is a constant pressure from various "alternative" solutions to move the business logic somewhere else (front-end/ middle-tier/other database technologies/you name it). But my strong believe that by properly utilizing available Oracle technologies you can achieve much better results without compromising data security and manageability.

I've put together more than a decade of my experience to a full-day seminar that can really help you. Here is an outline:

1. Know your Environment – This section introduces the available tools and features related to
PL/SQL performance tuning including: data dictionary views, logging, tracing, profiling etc. It
also discusses the proper ways to instrument code deal with and exception handling.

2. User-Defined PL/SQL Functions in the SQL Context – For most developers, knowledge of
PL/SQL starts from writing user-defined functions. As a result, even if this code is functionally
correct, the program units are fired significantly more often than needed, impact CBO
decisions, and cause execution plan degradation. This section addresses these issues and
includes a number of examples of how PL/SQL can extend basic SQL functionality.

3. SQL Sets Within PL/SQL – The goal of PL/SQL is to efficiently communicate with SQL sets
using cursors. This key feature of database cursors is often missed by assuming that they are
nothing more than pointers to SQL sets. The most efficient way of working with SQL sets is to
access data using set-based operators. This section reviews the results of two case studies
focused on comparing different access approaches. The first one looks for the most efficient
ways of moving significant volumes of data between remote locations, while the second tests
the impact of MULTISET operations on resource utilization.

4. Triggers are NOT Evil - Both table triggers and INSTEAD-OF triggers are examined from a
global system optimization point of view that includes not only the aspect of functional
correctness, but also the tradeoffs between multiple goals. For example, depending upon the
available hardware, developers can select either CPU-intense or I/O-intense solutions. This
section also covers some of the most common performance problems related to different kinds
of DML triggers and the proper ways of resolving them.

5. Keeping the Cache - One of the most important performance tuning strategies is to ensure
that you are not doing exactly the same thing multiple times. However, often you cannot avoid
this repetition. In those cases, the best option is to minimize the impact by utilizing existing
caching techniques, either manual or built-in. Currently in Oracle, there are different caching
mechanisms, each with its own strengths, drawbacks, and side-effects. This section introduces
all of them and details the selection criteria for matching the appropriate mechanism to specific
situations.3

6. WHEN OTHERS THEN… – The topic of PL/SQL performance tuning is too large to cover
in a 6-hour seminar. However, some tips and tricks can be very useful to attendees. This last
section describes some one-off cases that overlap multiple areas. It also includes an extended
question & answer period where attendees will get a chance to share their experiences and ask
questions.