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: John D Parker <>
Date: Fri, 18 Aug 2006 19:11:32 -0700 (PDT)
Message-ID: <>

Jerimiah, have you read Kyle's chapter in the oak table book? It's all in there. You can't just find the address of one end and step off the distance. The individual session addresses are all in the array that you referenced first. Step thru that array and read the addresses listed there with the proper structure and it works. I've written a simple sga program and it works well. Much to my surprise, sessions were used from the high end to the low end. I set limits in my test program and kept getting zeros back. I took the limits out and discovered that the high order sessions were used first much to my surprise. Unfortunately at that point real work intervened and I haven't had a chance to get back to it...

John Parker

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?


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).  



Do you Yahoo!?
 Everyone is raving about the all-new Yahoo! Mail Beta.
-- Received on Fri Aug 18 2006 - 21:11:32 CDT

Original text of this message