[20241105]跟踪library cache lock library cache pin使用gdb(11g)2.txt

[20241105]跟踪library cache lock library cache pin使用gdb(11g)2.txt

--//前一段时间写的使用gdb跟踪library cache lock/library cache pin的脚本。

--//我看过以前的笔记,当时测试过链接https://nenadnoveljic.com/blog/library-cache-lock-debugger/,我的测试在11g是失败.
--//今天有空再次尝试,确实不成功,不过有了前面测试的经验,可以很容易写成11g的gdb监测脚本.

1.环境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.测试gdb脚本:
--//我直接给出gdb脚本,一些细节忽略,主要讲解比较麻烦,就是在gdb下设置kgllkal,kglpnal断点.然后使用info register查看寄存器内
--//容,然后获取该执行语句的sql_id,hash_value值,继续退出,然后执行:

@ sharepool/shp4 <sql_id> 0

--//然后查看KGLHDADR的值,对比就知道那个寄存器保存的是对象句柄地址,测试结果对应的寄存器是rsi,至于mode我仅仅猜测是寄存器
--//rdx.这样稍微改改11g的监测脚本就可以写成.
--//里面的偏移量很容易