Tuesday, December 26, 2017

Cloning OID 11g

Oracle does not support the changing of hostname or IP address for your Oracle Internet Directory 11g installation, rendering cloning impossible. These instructions, however, guide you through that process.


1. Set the environment:
export ORACLE_HOME=/u01/app/oracle/middleware/Oracle_OID
export ORACLE_INSTANCE=/u01/app/oracle/middleware/asinst_1
export TNS_ADMIN=$ORACLE_INSTANCE/config 
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/ldap/bin:$ORACLE_INSTANCE/bin:$PATH
2. Clear the temp folders on node 1 (for AdminServer, wls_ods1):
cd ${ASERVER_HOME}/servers/AdminServer
rm -rf cache/* logs/* tmp/*
cd ${MSERVER_HOME}/servers/wls_ods1
rm -rf cache/* logs/* tmp/* data/*
cd ${MSERVER_HOME}/servers/wls_ods2 
rm -rf cache/* logs/* tmp/* data/*
3. Replace values in red:
cd /u01/app/oracle/middleware
find . -type f \( ! -name "oidpwdr*" ! -name "*.DAT" ! -name "*.cer" ! -name "*dump1" ! -name "*.swp" ! -name "*.jks" \) -exec sed -i "s/OLDHOST/NEWHOST/g" {} \;
find . -type f \( ! -name "oidpwdr*" ! -name "*.DAT" ! -name "*.cer" ! -name "*dump1" ! -name "*.swp" ! -name "*.jks" \) -exec sed -i "s/OLDHOST/NEWHOST/g" {} \; 
find . -type f \( ! -name "oidpwdr*" ! -name "*.DAT" ! -name "*.cer" ! -name "*dump1" ! -name "*.swp" ! -name "*.jks" \) -exec sed -i "s/.olddomain.com/.newdomain.com/g" {} \;
4. Change the strings to the new database string:
FILE: /u01/app/oracle/middleware/asinst_1/config/tnsnames.ora
OLD: OIDDB=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=prod-cluster)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=oiddb.raastech.com)))
FILE: /u01/app/oracle/middleware/user_projects/domains/oiddomain/config/jdbc/schedulerDS-*-jdbc.xml
OLD: <url>jdbc:oracle:thin:@//prod-cluster:1521/oiddb.raastech.com</url>
OLD: <value>1521</value>
OLD: <value>prod-cluster</value>
5. Run the change-ip-host script:
nohup ${ASERVER_HOME}/bin/startWebLogic.sh >> ${ASERVER_HOME}/servers/${ADMINSERVER}/logs/${ADMINSERVER}.out & 
cd $ORACLE_HOME 
$ORACLE_HOME/chgip/scripts/chgiphost.sh -oldhost OLDHOST -newhost NEWHOST -instanceHome /u01/app/oracle/middleware/asinst_1 
$ORACLE_INSTANCE/bin/opmnctl unregisterinstance -instanceName asinst_1 -adminHost NEWHOST.raastech.com -adminPort 7001 
$ORACLE_INSTANCE/bin/opmnctl redeploy -adminHost NEWHOST.raastech.com -adminPort 7001 
ll /u01/app/oracle/middleware/user_projects/domains/oiddomain/servers/AdminServer/upload/NonJ2EEManagement/11.1.1/app/NonJ2EEManagement.ear 
$ORACLE_INSTANCE/bin/opmnctl redeploy -adminHost NEWHOST.raastech.com -adminPort 7001

$ORACLE_INSTANCE/bin/opmnctl registerinstance -adminHost NEWHOST.raastech.com -adminPort 7001
If the 'redeploy' or 'registerinstance' actions fail, do not worry. Just confirm that "NonJ2EEManagement" is a deployed application and exists in /u01/app/oracle/middleware/user_projects/domains/oiddomain/servers/AdminServer/upload/NonJ2EEManagement/11.1.1/app/NonJ2EEManagement.ear.
 6. Remove the states folder to avoid the "Failed to open locale state file" error:
rm -rf /u01/app/oracle/middleware/asinst_1/config/OPMN/states
7. Reset the ODS password in the wallet (make sure this password matches that of the ODS user in the database):
cd $ORACLE_INSTANCE/OID/admin

mv oidpwdlldap1 oidpwdlldap1.old

$ORACLE_HOME/ldap/bin/oidpasswd connect=OIDDB create_wallet=true
8. Startup the rest of the environment:
nohup ${MSERVER_HOME}/bin/startManagedWebLogic.sh wls_ods1 >> ${MSERVER_HOME}/servers/wls_ods1/logs/wls_ods1.out & 
${MW_HOME}/asinst_1/bin/opmnctl startall
9. Verify the installation:
$ORACLE_HOME/bin/ldapbind -h oidhost1.raastech.com -p 3060 -D cn=orcladmin -w welcome1
$ORACLE_HOME/bin/ldapbind -h oidhost1.raastech.com -p 3131 -D cn=orcladmin -w welcome1 -U 1 
$ORACLE_HOME/bin/ldapsearch -h oidhost1.raastech.com -p 3131 -U 1 -D cn=orcladmin -s sub "(objectclass=*)" -w welcome1

Applicable Versions
  • Oracle Internet Directory (OID) 11g (11.1.1.9.0)

 

1 comment:

Anonymous said...

Hi, thank you for your blog. We are in a situation where we have created anotehr OID server retaining the original hostname/domain and file ssytems etc exactly same. The only thing that has changed is the IP address. When I start the opmnctl servcies, it just hangs. Would you be able to advise if I can follow above guide to reflect the new Ip addresses?

Thanks