Memory Access Mode of Oracle Enterprise Manager

Many people after some years with Oracle software may come up with Direct SGA Access project and presentation of Kyle Hailey discussing how to do direct SGA access in C. This following material of Miladin Modrakovic also helps understanding.

Why might we need this one, may be the first question coming into mind; let’s think of a bad work day now, you as a dba of a production system found out that you can not access to your database from any oracle utility even it is opened and startup doesn’t change anything. Let’s say Oracle support also advices you to use your backups, nothing to do for this hang situation after some dump analysis. But your recently backup media is broken or lost somehow, so what now..

After 10g Oracle Enterprise Manager gets the data about system hangs using the same method. When you enable the SGA direct attach, Oracle uses a single SQL collector per instance and this collector starts automatically along with Enterprise Manager.

Also this technique may be useful in tuning areas to access oracle statistics without impacting the Oracle kernel. It could also be a technique for accessing data from a running database for other security related purposes or just to do some reverse engineering to understand internals.

Refences Used :
Memory Access Mode of EM
Undocumented Oracle
Oracle Insights: Tales of the Oak Table – Chapter 6: Direct Memory Access, by Kyle Hailey
Oracle Wait Interface: A Practical Guide to Performance Diagnostics & Tuning (Osborne ORACLE Press Series) (Paperback) – Appendix D – Direct SGA Access
Another similar example, on security
Direct SGA Access for Hung/Slow Systems by Arup Nanda
Hung But Not Paralyzed: Memory-Attached SGA Query by Arup Nanda

6 Comments

  1. prodlife says:

    Are you really recommending that people will write their own programs to access the SGA through direct memory? Its a cool project if you are into C and memory management, but if you are not you can usually (as in 99.999% of the time) live without it.
    AFAIK, even Mr Haily no longer maintains his, because you need to repeat all the tedious research every time the version changes, and for each operating system, so you need a really good reason to do this.

    Also, I believe that Quest has a performance monitoring and diagnosis tool that uses direct access to SGA. It is not cheap though, and unless your performance issues are so severe that queries simply can’t run, I still think that direct SGA access is not really needed.

    That said, it is still a very cool project and I wish I had the patience to try this.

  2. prodlife this post was not a recommendation, thank you for the opportunity to clear this.

    But for some people it will mean more than a need, for example check Julian Dyke’s presentations; how an outsider can know that much internals of Oracle for sure if he didn’t see the source code? This may be an entrance to a new deeper world and it is interestingly fun to play with:)

  3. prodlife says:

    Ah, Julian Dyke’s presentations are great, and I wish I could have been there to hear them. Indeed, if you want to check the deep internals of Oracle, you’ll want to dig into the memory. Of course, if you are the kind of person who checks deep internals, writing the direct memory program will not be a problem for you.
    Just keep in mind that knowing the internals that deeply is not necessary for most DBAs (just those who are nerdy enough to like internals for their own sake), you can be a great DBA if you know just the external information of how things work without getting into exact memory locations. Problems start with DBAs that don’t bother knowing the external information either.

    Being a nerd myself, I love peeking into Oracle’s memory structures. Preferably when someone else did the hard research work :-)

  4. I wrote a small direct-access C program once and it was a *lot* of work. Also, it’s completely different between ipc shared memory (the default and most common) and /dev/shm (used for 32-bit systems with large memory and MEMORY_TARGET on 11g)… I’ve never tried but does OEM direct SGA access work for both of these modes?

  5. Jeremy I also didn’t try the feature my own, this was a hot topic last week with one of my dba friend, I sent an email and mentioned your question and this post. I hope he will comment but he is a real lazy type of dba indeed and he is proud of this always :)

Leave a Comment