Playing with oracle DB 18c on-premises before official release

Rodrigo Jorge has already explained a great way to install and play with Oracle 18c DB instance on-premises using Exadata binaries downloaded from edelivery. The basic idea is to install the oracle exadata binaries and before creating the database replace the library “libserver18.a” with the  version gotten from an oracle cloud instance  (Using Oracle Cloud trial account). And that’s it !

But for those like me that don’t have an international credit card required to create an Oracle Cloud trial account  (Yes i don’t have one 😦 ) or don’t want to create one  ! How to proceed to get a copy of this working libserver18.a library ? May be ask one of the oracle folks to upload it to somewhere and hope that there is no backdoor on it :p  or just try to hack it your self 😀

So after some digging i figure out a way 😀 no need to change the library “libserver18.a” just run this systemtap script that will change the return value of the function “ksz_exadata_feature_on” to 1 and that’s all !!

TEST ENV : OEL6/UEK4

stap -g -v -e ‘ function  _hatem_startup_force() %{ long ret; ret = 1; memcpy( ((char *)CONTEXT->uregs) + 80 , &ret, sizeof(ret)); %} probe process(“oracle”).function(“ksz_exadata_feature_on”).return { _hatem_startup_force(); }’

Before :

Capture 51

Capture 01

Patched / Hacked / whatever !!!

Capture 80

Capture 02

Capture 03

Of course this is only for fun and testing 😀

 

UPDATE 07/03/2018 : Another way is to set the parameter “_exadata_feature_on=true”

That’s all 😀

16 thoughts on “Playing with oracle DB 18c on-premises before official release

  1. That’s cool, especially the function _hatem_startup_force, the advanced C embedded function. Is there a detailed explanation for coming up the “memcpy( ((char *)CONTEXT->uregs) + 80 , &ret, sizeof(ret)); “? what “context->uregs” is? and why 80 is used here?

    Or is there any more in-depth material to show how to modify a return code of any functions of oracle binary or whatever a program?

    Thanks

  2. Thanks a lot, Mahmoud.
    By slightly modifying your script, I managed to cheat Oracle that I have 6 CPU_COUNT, although I really have 2:

    #!/usr/bin/stap
    function modify_rax() %{ long ret; ret = 6; memcpy( ((char *)CONTEXT->uregs) + 80 , &ret, sizeof(ret)); %}
    probe process(“oracle”).function(“skgpnumcpu”).return { modify_rax(); }

    Best Regards

  3. hi,
    I am getting the below error after executing the script as root.
    Pass 1: parsed user script and 119 library scripts using 228000virt/44072res/6240shr/38040data kb, in 520usr/50sys/564real ms.
    semantic error: while resolving probe point: identifier ‘process’ at :1:126
    source: function _hatem_startup_force() %{ long ret; ret = 1; memcpy( ((char *)CONTEXT->uregs) + 80 , &ret, sizeof(ret)); %} probe process(“oracle”).function(“ksz_exadata_feature_on”).return { _hatem_startup_force(); }
    ^

    semantic error: cannot find executable ‘oracle’

    Pass 2: analyzed script: 0 probes, 1 function, 0 embeds, 0 globals using 229188virt/45244res/6372shr/39228data kb, in 10usr/0sys/12real ms.
    Pass 2: analysis failed. [man error::pass2]
    Could you please help me out with this.

  4. anyway to modify this script for oracle GI ?
    i tried this method when installing Oracle GI , but got the following :

    [root@orcl18 bin]# stap -g -v -e ‘function _hatem_startup_force() %{ long ret; ret = 1; memcpy( ((char *)CONTEXT->uregs) + 80 , &ret, sizeof(ret)); %} probe process(“oracle”).function(“ksz_exadata_feature_on”).return { _hatem_startup_force(); }’
    Pass 1: parsed user script and 476 library scripts using 248092virt/53252res/6760shr/46624data kb, in 1150usr/20sys/1181real ms.
    Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 327868virt/134568res/8220shr/126400data kb, in 880usr/60sys/1434real ms.
    Pass 3: translated to C into “/tmp/stapkAfk6s/stap_a41e38b23794db6d412807923f6a5848_1287_src.c” using 327868virt/134864res/8512shr/126400data kb, in 90usr/170sys/10010real ms.

    Pass 4: compiled C into “stap_a41e38b23794db6d412807923f6a5848_1287.ko” in 14900usr/2110sys/32222real ms.
    Pass 5: starting run.

    WARNING: probe process(“/u01/app/18.1.0/grid/bin/oracle”).function(“ksz_exadata_feature_on”).return inode-offset 0000000000d68d80 registration error (rc -524)
    WARNING: task_finder inode-uprobes callback for task 13118 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13334 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13336 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13337 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13351 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13354 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13359 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13366 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13371 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13373 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13378 failed: -524
    WARNING: task_finder inode-uprobes callback for task 13383 failed: -524

    • I have this same error:

      [root@ora18 ~]$ stap -g -v -e ‘function _hatem_startup_force() %{ long ret; ret = 2; memcpy( ((char *)CONTEXT->uregs) + 80 , &ret, sizeof(ret)); %} probe process(“oracle”).function(“ksz_exadata_feature_on”).return { _hatem_startup_force(); }’
      Pass 1: parsed user script and 470 library scripts using 136208virt/41540res/3312shr/38360data kb, in 1200usr/190sys/1404real ms.
      Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 228148virt/134228res/4056shr/130300data kb, in 1740usr/310sys/2077real ms.
      Pass 3: translated to C into “/tmp/stap7Gi6FX/stap_7450aeee0881ad6b6adeee4b4599c684_1304_src.c” using 228148virt/134568res/4388shr/130300data kb, in 80usr/500sys/585real ms.
      Pass 4: compiled C into “stap_7450aeee0881ad6b6adeee4b4599c684_1304.ko” in 5840usr/1870sys/15069real ms.
      Pass 5: starting run.
      WARNING: probe process(“/opt/oracle/product/18.0.0/dbhome_1/bin/oracle”).function(“ksz_exadata_feature_on”).return inode-offset 0000000000f772c0 registration error (rc -524)
      WARNING: task_finder inode-uprobes callback for task 5369 failed: -524
      WARNING: task_finder inode-uprobes callback for task 5376 failed: -524
      WARNING: task_finder inode-uprobes callback for task 5379 failed: -524
      WARNING: task_finder inode-uprobes callback for task 5421 failed: -524

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s