Re: Direct SGA access problem because of structs' changing start addresses (e.g., x$ksmsp)

  • From: Frits Hoogland <frits.hoogland@xxxxxxxxx>
  • To: keydana@xxxxxx
  • Date: Tue, 7 Jan 2014 23:56:14 +0100

See inline.

Frits Hoogland

http://fritshoogland.wordpress.com
frits.hoogland@xxxxxxxxx
Phone: +31 20 8946342

On 07 Jan 2014, at 23:33, keydana@xxxxxx wrote:

> Hi,
> 
> I'm trying to write some Haskell code for direct SGA access of - preferredly, 
> as of today - x$ksmsp (sql queries against this table being expensive, 
> possibly...), and for that I'm following the approach from Kyle Hailey, as 
> detailed in the Oracle Wait Interface book.
> 
> So I need the struct's start address, but unfortunately, when I query x$ksmsp 
> several times in a row - even from the same  sqlplus process - I get 
> different results every time... (Actually, this seems to be the case with 
> most fixed tables, apart from those "fixed" fixed ones as x$ksuse...)
This seems very logical to me. This view externalises the shared pool 
administration (if memory serves me well), which has a lot of stuff going on 
all the time.
You even might think twice about doing this on a real life, busy, system.
I would have to look it up, but I think this view holds latches to get a more 
or less consistent view, which is the reason this view can take some time 
(acquiring the latches).

The X$ views are essentially Oracle memory structures externalised as database 
tables. Because the data is so transient (you are watching memory areas, hash 
tables, arrays, etc. of a running program), the design of this views is the 
tables can be inconsistent (it would hang your system to lock everything down 
for a consistent version).

This means that even if you dump the shared pool of a running system a few 
times from oradebug, you will see differences too, because all the processes 
keep on doing stuff.

> 
> It'd be great if anyone had advice, or an idea, what I could do to get this 
> working all the same (and as to what the reason might be?) 
Becasue the X$ tables are not tables, but externalised views on memory 
structures of a running program.
> It  ought to be possible somehow to do this, as I've tried oradebug direct 
> access with x$ksmsp and it worked (of course, it runs in sqlplus, so I don't 
> know...)
> 
> Thanks a lot in advance!
> 
> Sigrid--
> //www.freelists.org/webpage/oracle-l
> 
> 

Other related posts: