Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

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

RE: reading the SGA from my own program

From: Tanel Poder <tanel.poder.003_at_mail.ee>
Date: Sat, 19 Aug 2006 17:30:05 +0800
Message-id: <000f01c6c372$0e681cb0$6401a8c0@windows01>


Anjo,  

Yeah, if you start scanning non-initialized/mapped memory, you've have to keep the gaps in mind, otherwise you'll get segfaults or similar trouble
(even if you wouldnt get segfaults then it would be quite time consuming to
sweep through 64bit (or even 40bit) address space ;)  

If you just plan to do pointer chasing and not sweeping through the whole SGA, then the simplest approach is just to map all segments onto their proper locations in your program and you're all set. No complex pointer arithmetic is needed.  

Also, if all you're interested in is the current wait state of a session, then there's no real fundamental need to map those SHM segments which do not contain the data you're interested in (as far as I understand).  

It is just simpler to map everything as Oracle processes see them. Of course if everything is in a single SHM segment, this is a non-issue..  

Tanel.  


From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Anjo Kolk
Sent: Saturday, August 19, 2006 16:20
To: tanel.poder.003_at_mail.ee
Cc: jeremiah_at_ora-600.net; Oracle Discussion List Subject: Re: reading the SGA from my own program

Hi Tanel,  

You have to map all the segments, and I always use them with any conversion. I have a little program called websga and you can browse and search in the SGA with a browser instead of a debugger (so much simpler and nicer), this program maps all segments but has to check for gaps if it starts searching for addresses and contents of addresses.  

Anjo.  

On 8/19/06, Tanel Poder <tanel.poder.003_at_mail.ee> wrote:

Why bother at all with those calculations?  

Just map all SGA SHM segments at the same locations in your program where they'd be mapped in an oracle processes and use all SGA addresses without any conversion needed.  

Even if some data is stored in different shared memory segments, it's still the same virtual address space - no need for doing some segment offset calcuations...  

Tanel.


From: oracle-l-bounce_at_freelists.org [mailto: <mailto:oracle-l-bounce_at_freelists.org> oracle-l-bounce_at_freelists.org] On Behalf Of Jeremiah Wilton
Sent: Saturday, August 19, 2006 05:14
To: 'Oracle Discussion List'
Subject: reading the SGA from my own program  

I am trying to play around with reading the SGA using my own program, as popularized by Kyle Hailey and Miladin Modrakovic's papers and presentations. I am confused about where to find x$ksusecst (session wait) and other items in the fixed area.  

The base address of the SGA from x$ksmmem is hex 20000000.  

The lowest ADDR I see in x$ksusecst on my instance is 27133F24. So far so good.  

That means that x$ksusecst begins (27133F24-20000000=7133F24) bytes into the segment containing the fixed SGA, right?  

Hex 7133F24 is decimal 118,701,860, so that should be about 113Mb into the segment.  

The problem is that the segment containing my fixed area (from oradebug ipc) is only 4Mb. All the shared memory segments owned by oracle on my host
(according to ipcs -a) total less than 108Mb.
 

So according to x$ksusecst(ADDR), session waits have an address beyond the highest address in the SGA. What am I getting wrong?  

Thanks for any insights!

--

Jeremiah Wilton

ORA-600 Consulting

http://www.ora-600.net <http://www.ora-600.net/>  




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


--
http://www.freelists.org/webpage/oracle-l
Received on Sat Aug 19 2006 - 04:30:05 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US