Re: reading the SGA from my own program

  • From: "Anjo Kolk" <anjo.kolk@xxxxxxxxxxx>
  • To: "Jeremiah Wilton" <jeremiah@xxxxxxxxxxx>
  • Date: Sat, 19 Aug 2006 10:17:15 +0200

You have to map all the segments. When I wrote programs to access the SGA, I
also made sure that every address that I tried to access was mapped (sounds
expensive but it is easy to do and the info is available). So the space
between the segments, counts but can't be accesssed.

oradebug ipc will tell you what segment(s) is(are) for the variable SGA and
which ones should be mapped.

I think that it is more simple than how you are approaching it and you are
doing the right thing but are concerned with things that don't matter ;-)


On 8/19/06, Jeremiah Wilton <jeremiah@xxxxxxxxxxx> wrote:


I guess I realize I could set shmmax high and get a single segment, but I
want my program to work on any old Oracle instance, not just one I set up
special for it.

Are you saying that because segments can be noncontiguous, you have to
the space between segments where there is no segment allocated when you
counting up from the SGA base address to the address of the object you are

In my case the segments are noncontiguous.  There are big gaps between
segment according to oradebug IPC.  If I count space between segments,
the supposed location of session waits falls in the last segment.  I'll
around and see what I find.  Any hints are welcome.

Is there a better (more programmatic way) to map the segments' base
addresses and sizes other than looking at the trace file from oradebug


Jeremiah Wilton
ORA-600 Consulting

________________________________________ From: akolk@xxxxxxxxxxx [mailto:akolk@xxxxxxxxxxx] On Behalf Of Anjo Kolk

Your assumption is wrong. The fixed SGA contains variables that are known
oracle compile time or point to structures in variable part. So the answer
is that generally speaking, all x$ are in the variable part of the SGA.
there may be multiple segments but they are contiguous in memory (not
the case), so you will have to map/attach at least to the segments of the
fixed and variable part. A better trick you can pull is so set SHMMAX
extremely large, so the whole SGA will fit in one segment. That means that
every thing is attached (easy to do when you are on linux).


Anjo Kolk
Owner and Founder OraPerf Projects
tel:    +31-577-712000
mob: +31-6-55340888

Other related posts: