Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Mailing Lists -> Oracle-L -> Re: reading the SGA from my own program

Re: reading the SGA from my own program

From: Anjo Kolk <>
Date: Sat, 19 Aug 2006 10:17:15 +0200
Message-ID: <>

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 <> wrote:
> Anjo,
> 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
> seeking?
> 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?
> Thanks,
> Jeremiah Wilton
> ORA-600 Consulting
> ________________________________________
> From: [] 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).
> Anjo.

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

Received on Sat Aug 19 2006 - 03:17:15 CDT

Original text of this message