RE: reading the SGA from my own program

  • From: "Jeremiah Wilton" <jeremiah@xxxxxxxxxxx>
  • To: "'Anjo Kolk'" <anjo.kolk@xxxxxxxxxxx>
  • Date: Fri, 18 Aug 2006 16:38:00 -0700


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 count
the space between segments where there is no segment allocated when you are
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 each
segment according to oradebug IPC.  If I count space between segments, then
the supposed location of session waits falls in the last segment.  I'll play
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 ipc?


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 at
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. Also
there may be multiple segments but they are contiguous in memory (not always
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). 


Other related posts: