Before we go further into this section, we need to understand the purpose of
cloning and advantage of cloning the Oracle home binaries.
At what circumstance, cloning oracle home is useful?
1) When you setup the standby database, you don't
want to install the oracle binary from the scratch. You might install some extra component or you
might miss some component which is not in primary database. The best
practice, it is always primary and standby should be Apple to Apple. Binary
cloning will be appropriate for setting up the standby database server.
2) If you are performing multiple oracle database
installations on several server as Production, Pre-production, Development, QA
and Test, then you may want to use binary cloning to make sure you install same
component across the environment. This approach is much faster than
installing from the scratch and then applying PSU/CPU patch on each
server.
Source Database : devdb12
Target Database : devdb13
The Binary version is 11.2.0.4
Oracle home : /ora/app/oracle/product/11.2.0/db_4
Step 1(Clone the binary in source database)
Login to source database:
cd /ora/app/oracle/product/11.2.0
tar -cvf oracle_110204_binaries.tar db_4
check tar -tvf
/ora/app/oracle/product/11.2.0/oracle_11204_binaries.tar |more
The above command ensure the binaries are zipped.
scp the oracle_11204_binaries.tar file to devdb13 under /ora/app/oracle/product/11.2.0/
On step1, oracle binaries are cloned and copied to target server.
Step 2(Untar the binaries in target server)
Login to devdb13
Extract
Oracle 11.2.0.4 binaries
cd
/ora/app/oracle/product/11.2.0
tar
-tvf oracle_11204_binaries.tar|more
tar
-xvf oracle_11204_binaries.tar
Delete
or move the oracle_11204_binaries.tar file if you need to.
cd
/ora/app/oracle/product/11.2.0
mv
oracle_11204_binaries.tar /work/exports
Step 3 (create the clone script)
cd
/homo/oracle
cat
clone.sh
#!/bin/sh
echo
"Clone started at `date`" | tee -a clone.log
perl
/ora/app/oracle/product/11.2.0/db_4/clone/bin/clone.pl
ORACLE_BASE=/ora/app/oracle ORACLE_HOME=/ora/app/oracle/product/11.2.0/db_4
ORACLE_HOME_NAME=OraDb11g_home4 '-O"LOCAL_NODE=devdb13.acsrr.com"'
echo
"Clone ended at `date`" | tee -a clone.log
Step 3 (Clone the binary)
nohup
./clone.sh &
Here is the cloning log screenshot, We need to execute root,sh as requested in the log file.
Unix Admin can run the root.sh as a root user. Unix admin can
also provide sudo privilege to oracle account and DBA can run
this script.
Here is the log for executing root.sh.
sh /ora/app/oracle/product/11.2.0/db_4/root.sh
Performing
root user operation for Oracle 11g
The
following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/db_4
Enter
the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating
/etc/oratab file...
Entries
will be added to the /etc/oratab file as needed by
Database
Configuration Assistant when a database is created
Finished
running generic part of root script.
Now
product-specific root actions will be performed.
Finished
product-specific root actions.