[20240618]Oracle C functions annotations.txt
--//网站orafun.info可以查询oracle c functions.Created by Frits Hoogland with a little help from Kamil Stawiarski.
--//可以通过它了解oracle 内部C 函数.实际上可以直接下载相关文件,在本地使用.
https://gitlab.com/FritsHoogland/ora_functions/archive/master/ora_functions-master.tar.gz
https://gitlab.com/FritsHoogland/ora_functions
--//例子:
$ ./lookup.awk kgllkal
kgllkal : kernel generic library cache management library cache lock allocate
--//如果是windows系统,如果安装awk了.可以使用如下:
D:\tools\ora_functions-master>awk -f lookup.awk kgllkal
kgllkal : kernel generic library cache management library cache lock allocate
--//我开始以为我直接使用grep直接查询functions.csv文件,实际情况按照层次组织该文件.通过例子说明:
D:\tools\ora_functions-master>grep -i kgllkal functions.csv
kgllkal|allocate
--//仅仅看到allocate.实际上看lookup.awk 代码,执行如下
D:\tools\ora_functions-master>grep -E "^k\||^kg\||^kgl\||^kgllk\||^kgllkal" functions.csv
k|kernel
kg|generic
kgl|library cache management
kgllk|library cache lock
kgllkal|allocate
--//拚接起来就是如下内容:
D:\tools\ora_functions-master>grep -E "^k\||^kg\||^kgl\||^kgllk\||^kgllkal" functions.csv| cut -f2 -d"|" | paste -sd" "
kernel generic library cache management library cache lock allocate
D:\tools\ora_functions-master>awk -f lookup.awk -h
Usage: ./lookup.awk [-w] <function>
<function> = full function name, or part of a function name when used with -w.
-w = wildcard, lookup all functions start with <function>
--//可以使用-w参数,模糊查询,不过无法使用前缀模糊查询.这个由于函数的组织结构决定的.
D:\tools\ora_functions-master>awk -f lookup.awk -w kgllk
kgllk : kernel generic library cache management library cache lock
kgllkdl : kernel generic library cache management library cache lock delete
kgllkds : kernel generic library cache management library cache lock delete state object
kgllkal : kernel generic library cache management library cache lock allocate
(kgllk)a : kernel generic library cache management library cache lock ??
(kgllk)d : kernel generic library cache management library cache lock ??
--//最后两个为不完整的信息,注意结尾出现的??.
D:\tools\ora_functions-master>awk -f lookup.awk kgllka
(kgllk)a : kernel generic library cache management library cache lock ??
--//提示括号内的内容可以查询到kgllk.
--//另外注意函数的大小写.
$ ./lookup.awk -w kglget
kglget : kernel generic library cache management get a lock on an object
$ ./lookup.awk -w kglGetMutex
kglGetMutex : kernel generic library cache management get mutex
--//前者没有找到kglGetMutex.
--//如果pstack的执行结果.例子:
SCOTT@book> select count(*) from emp,emp,dba_objects,dba_objects ;
$ pstack 54305
#0 0x0000000009726543 in qersoFetch ()
#1 0x000000000970b15d in qerjotFetch ()
#2 0x000000000256715f in qergsFetch ()
#3 0x00000000095b5776 in opifch2 ()
#4 0x0000000001ba5c5d in kpoal8 ()
#5 0x00000000095bbdad in opiodr ()
#6 0x00000000097a629f in ttcpip ()
#7 0x000000000186470e in opitsk ()
#8 0x0000000001869235 in opiino ()
#9 0x00000000095bbdad in opiodr ()
#10 0x00000000018607ac in opidrv ()
#11 0x0000000001e3a48f in sou2o ()
#12 0x0000000000a29265 in opimai_real ()
#13 0x0000000001e407ad in ssthrdmain ()
#14 0x0000000000a291d1 in main ()
--//在http://orafun.info/stack/,copy and paste上面内容,显示如下:
Parsed stack:
Discovered stack type: gdb/pstack stack
Parsed gdb/pstack stack:
#0 0x0000000009726543 in qersoFetch () query execute rowsource sort fetch from from a sort row source
#1 0x000000000970b15d in qerjotFetch () query execute rowsource nested loop outer join tunneling fetch
#2 0x000000000256715f in qergsFetch () query execute rowsource group by sort fetch
#3 0x00000000095b5776 in opifch2 () oracle program interface oracle side of the fetch interface main routine
#4 0x0000000001ba5c5d in kpoal8 () kernel programmatic interface oracle V8 bundled execution
#5 0x00000000095bbdad in opiodr () oracle program interface oracle code request driver, route the current request
#6 0x00000000097a629f in ttcpip () two task common pipe read/write
#7 0x000000000186470e in opitsk () oracle program interface two task function dispatcher
#8 0x0000000001869235 in opiino () oracle program interface initialize opi
#9 0x00000000095bbdad in opiodr () oracle program interface oracle code request driver, route the current request
#10 0x00000000018607ac in opidrv () oracle program interface route current request driver, entry side into two task interface
#11 0x0000000001e3a48f in sou2o () main oracle executable entry point
#12 0x0000000000a29265 in opimai_real () oracle program interface main real oracle start point
#13 0x0000000001e407ad in ssthrdmain () operating system dependent system main for every thread in a threaded oracle
#14 0x0000000000a291d1 in main () (non oracle)general c starting function
--//如果本地操作可以执行如下:
D:\tools\ora_functions-master>awk "{print $4}" a.txt | tr -d "\r" | xargs -iQ awk -f lookup.awk Q"
qersoFetch : query execute rowsource sort fetch from from a sort row source
qerjotFetch : query execute rowsource nested loop outer join tunneling fetch
qergsFetch : query execute rowsource group by sort fetch
opifch2 : oracle program interface oracle side of the fetch interface main routine
kpoal8 : kernel programmatic interface oracle V8 bundled execution
opiodr : oracle program interface oracle code request driver, route the current request
ttcpip : two task common pipe read/write
opitsk : oracle program interface two task function dispatcher
opiino : oracle program interface initialize opi
opiodr : oracle program interface oracle code request driver, route the current request
opidrv : oracle program interface route current request driver, entry side into two task interface
sou2o : main oracle executable entry point. reads environment var ORACLE_SPAWNED_PROCESS.
opimai_real : oracle program interface main real oracle start point
ssthrdmain : operating system dependent system main for every thread in a threaded oracle
main : (non oracle)general c starting function
--//如果是跟踪文件里面记录的stack信息,可以执行如下:
kglLock()+1406<-kglget()+293<-qostobkglcrt1()+498<-qostobkglcrt()+248<-qostobkglcrt2()+412<-qospsis()+2511<-qospPostProcessIStats()+2765<-qerltFetch()+1544<-qerstFetch()+449<-insdlexe()+364<-insExecStmtExecIniEngine()+1810<-insexe()+2283<-atbugi_update_global_indexes()+1656<-atbFMdrop()+3088<-atbdrv()+7719
--//另外保存文件b.txt,执行如下:
D:\tools\ora_functions-master>cat b.txt | tr "<-" " \n" | sed "s/().*$//"| tr -d "\r" | xargs -iQ awk -f lookup.awk Q
kglLock : kernel generic library cache management library cache lock
kglget : kernel generic library cache management get a lock on an object
(qos)tobkglcrt1 : query optimizer statistics ??
(qos)tobkglcrt : query optimizer statistics ??
(qos)tobkglcrt2 : query optimizer statistics ??
qospsis : query optimizer statistics DBMS_STATS.SET_INDEX_STATS_CALLOUT
(qos)pPostProcessIStats : query optimizer statistics ??
qerltFetch : query execute rowsource load table fetch
qerstFetch : query execute rowsource statistics row source fetch
insdlexe : insert direct load execute
(ins)ExecStmtExecIniEngine : insert ??
insexe : insert execute
(atb)ugi_update_global_indexes : alter table ??
(atb)FMdrop : alter table ??
atbdrv : alter table driver
热门相关:间谍的战争 神级幸运星 农家小地主 豪门宠婚:权少夫人萌上天 名门极致宠妻