4-Sep-2008: Oracle internals

Once upon a time, I disassembled all object files (*.o) extracted from libserver10.a file which is main Oracle RDBMS library, from version 10.2.0.4 Linux x86.

After, I fetched essentials from each one: which functions are in each object file are present, which other functions they may call and possible arguments list.

Here is a short example of what I got:

* Function krvsats

May call krvsarts ()
May call ksdwrf ("krvsats->\n")
May call ksdpec (0x3FAC)
May call ksdpec (0x545)
May call kspgip (ds:kxfpx2_, 1, ...)
May call kslgetl (offset krvsvl_, 1, 0, offset krvsvl_alo_)
May call kslfre (offset krvsvl_)
May call kghfre (ds:ksmgpp_, offset ksmsgh_, ?, 0x2000, "krvslfv: init")
May call kghalo (ds:ksmgpp_, offset ksmsgh_, ?, ?, ?, ?, 0x1002000, ?, "krvslfv: init")
May call kgesic0 (?, ?, 0x42CB)
May call ksdwrf ("krvsats:: Fatal error(%d) during X$LOGSTDBY allocation\n")
May call kgedes (ds:ksmgpp_)
May call kgerse (ds:ksmgpp_)
May call krvssmsg (...)
May call ksdwrf ("->krvxats\n")
May call krvxats (...)
May call krvuam (?, ?, 1, 0x58, ?, "krvslctx")
May call krvsle (?, ?, 0x3EEF, ...)
May call kghalp (ds:ksmgpp_, offset ksmsgh_, 0x330, 1, 0, "krvsats: krvslsv")
May call kslhclt (offset krvsvl_)

Here we can easily see a list of functions which krvsats() may call and its arguments.

Throughout all that files, we can see how Oracle RDBMS checks for turned on trace events (using function ksdpec()), how it raise ORA- errors (using functions ksesic*, ksesec*, etc), how it write to trace logs (using functions ksdwrf(), ksdwra()), and how it allocate memory marked with comment (functions ksmals(), kghalf(), kghalo(), etc), and how it prepare many internal SQL statements for internal execution (functions rpisplu(), kprbprs(), opiprs(), OCIStmtPrepare(), etc).

Excerpts from opiodr() function, which is one of central point of Oracle OPI call dispatcher (see full file here):

May call ksesec0 (0x0C29)
May call ksesec0 (0x3F4)
May call ksesec0 (0x3E9)

....

May call kgeasnmierr (ds:ksmgpp_, ds:ksefac_, "opiodr-fma", 0)

....

May call ksdwrf ("OPI CALL: type=%2d argc=%2d cursor=%3d name=%s\n")
May call ksdpec (0x2743)

First three calls are errors signalling: ORA-3113 ("end-of-file on communication channel"), ORA-1012 ("not logged on"), ORA-1001 ("invalid cursor"), etc.

Last ksdpec() function call is check out, whether trace event 10051 ("trace OPI calls") is turned on. Near that call we can see also call to the function which produce write to trace log, in printf-like format.

.. etc, etc ..

Happy hacking!

All files in one archive for 10.2.0.4 (1679 files, 3.5M) and for 11.1.0.7.0.

All 1679 files separately for 10.2.0.4 and for 11.1.0.7.0.

Using some text reformatting, it is possible to add wiki-markup to all these text files and import it to some wiki software (I prefer MediaWiki).

Then, it is possible to use simple navigation: e.g., opening web-browser on a page dedicated to some function, using "what links here" feature, to see then which functions may call this one. Or, to see, which functions may raise some specific error. And so on.


This open sourced site and this page in particular is hosted on GitHub. Patches, suggestions and comments are welcome.


→ [list of blog posts, my twitter/facebook]

The page last updated on 16-September-2016