Monday, June 2, 2008

Change hostname, ip address of an Oracle Application Server SOA suite (chgiphost.sh)

It is possible to change the hostname ip address from a linux server where Oracle Application Server SOA suite (10.1.3.3.x) is installed.
The following steps need to be executed:
1. Stop the Oracle Application Server
opmnctl shutdown

2. Change the network linux server settings
Change hostname/ip address in /etc/hosts
Change hostname/ip address in /etc/sysconfig/network
Change ip address in /etc/sysconfig/network-scripts/ifcfg-eth0

Execute command hostname:
hostname {HOST_NAME_NEW}

3. Execute script chgiphost.sh
$ORACLE_HOME/chgip/scripts/chgiphost.sh

4. Find and replace the hostname in all the files of the ORACLE_HOME. These files can be found with the following command:
find ./ -type f -name '*' -print0  xargs -0 grep -li -e "{HOST_NAME_ORG}"

I created a script to do this for me: searchreplace


#!/bin/sh

if [ $# != 2 ];
then
echo "Start op: $0 "
exit 1
fi

REPLACE_WORD=${1}
WORD=${2}


for FILE in `find ./ -type f -name '*' -print0 | xargs -0 grep -li -e "${REPLACE_WORD}"`
do
echo "In the ${FILE} the word ${REPLACE_WORD} is replaced by ${WORD}."
cat ${FILE} | sed 's/'${REPLACE_WORD}'/'${WORD}'/g' > ${FILE}_TMP
mv ${FILE}_TMP ${FILE}
done

exit 0


5. Start Oracle Database which is used for the SOA metadata repository and Update table ORAESB.ESB_PARAMETER en DT_OC4J_HOST:

sqlplus oraesb
update oraesb.esb_parameter
set param_value='$HOST_NAME_NEW.$HOST_DOMAIN_NEW'
where param_name ='DT_OC4J_HOST';

6. Start Oracle Application Server:
opmnctl startall