Cloning Middleware Home using Movement Scripts (copyBinary.sh,pasteBinary.sh)

Recently I came across a requirement to create a high availability OAM environment.

“There existed a running OAM/OID environment on Node1. A cluster for OAM Domain was required to be created. OAM Domain has deployments on Admin Server and oam_server1 (Node 1) managed server.
To extend domain for clustering managed servers for OAM , I needed to do following tasks :
1. Extending OAM domain on node1 to create a cluster having managed servers oam_server1(already existing on node1) and oam_server2 (new one on node2)
2. Install WebLogic Server binaries on Node 2.
3. Install OAM Oracle Home on Node 2.
4. Create OAM domain on Node2 (using pack.sh and unpack.sh)
5. Start managed servers on Node 1 and Node 2.”

 

Aim of this post is not creating High availability OAM environment but to show how we can utilise cloningclient(movement scripts) in WLS to avoid rework in such scenarios. Read more about movement scripts here.
The movement scripts minimize the amount of work that would otherwise be required to reapply all the customization and configuration changes made in one environment to another.

You can use these scripts to:
Create a Middleware home that is a copy of a production, test, or development environment. The scripts create a new Middleware home with all patches applied to all of the Oracle homes and the WebLogic Server home in a single step. This is in contrast to separately installing and applying any patches to the WebLogic Server home and separate Oracle homes.
• Prepare a “gold” image of a patched Middleware home and deploying it to many hosts.
• Move the configuration of a domain or Oracle instance, including the components in the domain or Oracle instance, from one environment to another.

So Instead of Installing WLS Oracle Home and OAM Oracle Home on Node 2 , I decided to clone Middleware Home and Oracle homes from Node 1 environment.

We will clone WebLogic oracle home and OAM Oracle Home using WebLogic cloningclient.
1. Check oraInst.loc file, if it is pointing to right Inventory.
2. Verify Oracle Homes listed in Inventory.xml.
3. If there are any extra Oracle Homes, backup the original Inventory.xml and delete the entry of Oracle Home which is not to be cloned.
4. Check the JAVA_HOME

username@Node1 $ which java
/usr/java6_64/jre/bin/java
5. Change directory to $MW_HOME/oracle_common/bin
username@Node1 $ pwd
/u02/AMDEV/Middleware/Weblogic/oracle_common/bin
6. Run copyBinary.sh as below
username@Node1 $ copyBinary.sh -javaHome /usr/java6_64 -archiveLoc /oadbbackup/AMDEV/mw_copy.jar -sourceMWHomeLoc /u02/AMDEV/Middleware/Weblogic -invPtrLoc /etc/oraInst.loc -logDirLoc /u02/AMDEV/Middleware/clone_log/ -ignoreDiskWarning true

Log File: “/u02/AMDEV/Middleware/clone_log/CLONE2013-04-01_05-15-29AM.log”.
Error File: “/u02/AMDEV/Middleware/clone_log/CLONE2013-04-01_05-15-29AM.error”.
……………………..
In my case /oadbbackup/AMDEV is the shared mountpoint where i am creating mw_copy.jar archive.
What this script does:
a. First this script checks prerequisites.
b. Creates archive for Middleware Home..
c. Adds archive of Middleware home to the main jar file.
d. Does b and c for all Oracle Homes in Middleware Home.
e. Creates permission files for each Oracle Home and add them to main archive.

Make sure there is enough space for jar file to be created.
If everything goes fine, you will see below message on Shell prompt.

INFO : Apr 1, 2013 5:26:20 AM – CLONE-21032 Archive created successfully at /oadbbackup/AMDEV/mw_copy.jar.
INFO : Apr 1, 2013 5:26:28 AM – CLONE-21006 Total time taken by cloningclient was “658” seconds.
INFO : Apr 1, 2013 5:26:28 AM – CLONE-21007 Cloning operation completed successfully.
—————————————————————————————————————————————————–

Now we will run pastebinary.sh script on target server.
Before that, we have to ensure:
1. Directory Structure similar to source exists on target example /u02/AMDEV/Middleware/ in my case.
2. Java is installed on target host. Please version compatibility accordingly.
3. File oraInst.loc exists and point to a directory OraInventory. It is better to copy the oraInst.loc from source and make OraInventory at a location specified.
4. Pastebinary.sh and cloninclient.jar exists in same directory on target Server. Copy both the files from Source Middleware Home.
Go to the directory where pastebinary.sh and cloningclient.jar exist.
Set JAVA_HOME and PATH environment variables.
export JAVA_HOME=<path to your JDK>
export PATH=$PATH:$JAVA_HOME/bin
Run pastebinary.sh as below:
username@Node2 $ pasteBinary.sh -javaHome /usr/java6_64 -archiveLoc /oadbbackup/AMDEV/mw_copy.jar -targetMWHomeLoc /u02/AMDEV/Middleware/Weblogic -invPtrLoc /u02/AMDEV/oraInventory/oraInst.loc
Log File: “/tmp/CLONE2013-04-01_07-14-34AM-LOG/CLONE2013-04-01_07-14-34AM.log”.
Error File: “/tmp/CLONE2013-04-01_07-14-34AM-LOG/CLONE2013-04-01_07-14-34AM.error”.
……………..
What happens when Pastebinary.sh runs:
a. Checks prerequisites on target host.
b. Extracts and restores the Middleware Home from archive file.
c. Extracts Oracle Homes, makes their directory structures.
d. Configures Oracle Homes.
e. Sets the permissions for Oracle Homes.
f. Updates the Inventory.

If everything goes smooth, you will notice the below like messages.
INFO : Apr 1, 2013 7:21:56 AM – CLONE-21037 Time taken to restore all cloners from archive was “434,544” milliseconds.
INFO : Apr 1, 2013 7:21:56 AM – CLONE-21006 Total time taken by cloningclient was “441” seconds.
INFO : Apr 1, 2013 7:21:56 AM – CLONE-21007 Cloning operation completed successfully.

Now if required ,we can clone the configurations from source to target using : copyconfig.sh, extractMovePlan.sh and pasteconfig.sh scripts

Since my requirement was not to clone configuration, i didn’t run the above scripts,I will try to take that up in separate post.

About the Author Masroof Ahmad

Leave a Comment:

3 comments
Add Your Reply