Oracle E-business suite: virtual host names solution for R12.2

Posted in: Oracle, Technical Track

You have seen me rant about Oracle’ provided virtual hostname solution before. If you have not, check it out here. In summary, Oracle provided solution basically asks you to change the physical hostname of the server to the virtual one, which effects no just oracle ebs, but everything running on that server.

In my earlier blog post, I outlined the steps to get virtual hostname working for 11i, R12.0 and R12.1 releases. Oracle EBS R12.2 is a special case, as it uses both 32bit and 64bit JDK. I am happy to tell you that I have a working virtualhostname solution that works with EBS R12.2. Thanks to Maris Elsins who figured this out.

In brief, the solution is to compile both 32bit and 64bit version of the fakehostname library and copy them to /usr/lib and /usr/lib64 directories with same name libfakehostname.so.1. And then set LD_PRELOAD to just libfakehostname.so.1 with out the absolute path. This way both 32bit and 64bit libraries pick up appropriate library corresponding to their architecture.

Here are the steps to implement the solution
#download the source code
[applmgr@apps ~]$
wget https://github.com/nonspecialist/fakehostname/archive/master.zip
[applmgr@apps ~]$
unzip master.zip

[applmgr@apps ~]$ cd fakehostname-master/
#compile 32bit library
[applmgr@apps fakehostname-master]$ gcc -fPIC -m32 -shared -Wl,-soname,libfakehostname.so.1 -ldl -o libfakehostname.so.1 fakehostname.c
#compile 64bit library
[applmgr@apps fakehostname-master]$ gcc -fPIC -m64 -shared -Wl,-soname,libfakehostname64.so.1 -ldl -o libfakehostname64.so.1 fakehostname.c


[applmgr@apps fakehostname-master]$
ls libfakehostname*

libfakehostname64.so.1 libfakehostname.so.1

#copy the 32bit library to /usr/lib
[applmgr@apps fakehostname-master]$ sudo cp libfakehostname.so.1 /usr/lib

#copy 64bit library to /usr/lib64 with same name as 32bit library
[applmgr@apps fakehostname-master]$ sudo cp libfakehostname64.so.1 /usr/lib64/libfakehostname.so.1

#set LD_PRELOAD to the library name. Do not use the absolute path

[applmgr@apps ~]$ export LD_PRELOAD=”libfakehostname.so.1″

#test the fake hostname
[applmgr@apps ~]$ hostname
apps.example.com

[applmgr@apps ~]$ export MYHOSTNAME=virtapps.example.com

[applmgr@apps ~]$ hostname
virtapps.example.com

email

Author

Interested in working with Vasu? Schedule a tech call.

About the Author

Vasu Balla’s colleagues call him “Eagle Eye” for a reason – his diverse technical background enables him to view his clients’ systems from a 360-degree angle, giving him a higher level of understanding. Vasu is well known for being approachable, and he truly enjoys helping people. Even former colleagues reach out to Vasu when they are really stuck on an issue. When he isn’t working, Vasu can be found in the kitchen trying new recipes.

2 Comments. Leave new

Andrejs Prokopjevs
July 13, 2016 3:50 am

Hi Vasu,

To add. Maybe update this blog post of yours. There is an issue with Multi Apps-Tier setup.

Adding these two MYHOSTNAME and LD_PRELOAD variables to the sh profile are not taken by remote calls that ADOP is doing to remote slave nodes.

If you do from node1 ” ssh virtual-node2 “hostname” ” it will still return your physical hostname value from node2.
This is the nature of SSH which is not using login shell for direct remote call executions.

There are two options how to bypass it.

Option 1: (less secure) to configure ~/.ssh/rc file with same export commands.

-bash-4.2$ vi ~/.ssh/rc
-bash-4.2$ cat ~/.ssh/rc
export FAKEHOSTNAME=virtual-node2.virtualdomain
export LD_PRELOAD=libfakehostname.so.1
-bash-4.2$

This requires PermitUserRC to be enabled in your /etc/ssh/sshd_config.

Why this is less secure. Well… anybody can put there ANY command there and it will be executed by ssh.
Imagine having there ” rm -Rf /* “. :)

Option 2: to configure ~/.ssh/environment file with same environment variables to be added.

-bash-4.2$ vi ~/.ssh/environment
-bash-4.2$ cat ~/.ssh/environment
FAKEHOSTNAME=virtual-node2.virtualdomain
LD_PRELOAD=libfakehostname.so.1
-bash-4.2$

This requires PermitUserEnvironment to be enabled in your /etc/ssh/sshd_config.

This is way more safe, as environment variables are not so harmful, right? :)

One sshd restart, and it works.

bash-4.2$ ssh virtual-node2 “id ; hostname”
uid=501(applmgr) gid=500(dba) groups=500(dba)
virtual-node2.virtualdomain
bash-4.2$

And ” adop -validate ” is not throwing anymore errors.

Reply

Awesome solution and kudos to Maris, Vasu and Andrejs for figuring this out. Thanks Vasu for sharing this. This solution will greatly reduce the switch over time during the DR of EBS.

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *