Cloning an Oracle Home - denis-kol4ev/OraDBA GitHub Wiki
Purpose:
Clone ORACLE_HOME with all installed patches from source to target server.
Based on:
Cloning An Existing Oracle11g Release 2 (11.2.0.x) RDBMS Installation Using OUI (Doc ID 1221705.1)
Tested on:
Oracle 11.2.0.4 on OEL 7.6
Oracle 12.2.0.1 on OEL 6.10
Note:
There should be no requirement to shutdown any databases, listeners, agents etc. that are running from the source home before copying the source installation because any processes that load the static binaries or libraries into memory should not hold a write lock.
Some files in $ORACLE_HOME/bin are owned by root, use the root user to make sure that the ownership of the files is preserved correctly.
1. Use the root user to create the ORACLE_HOME directory archive
# cd /opt/oracle/ora11g/11.2.0.4
# tar -cvf /opt/oracle/distr/ora11g_home.tar .
2. Copy archive to the target server
# scp /opt/oracle/distr/ora11g_home.tar 111.111.111.30:/opt/oracle/distr
3. Use the oracle user to create the ORACLE_HOME directory on target server
$ mkdir -p /opt/oracle/ora11g/11.2.0.4
4. Use the root user to extract archive
# cd /opt/oracle/ora11g/11.2.0.4
# tar -xvf /opt/oracle/distr/ora11g_home.tar
5. Delete unnecessary files from the unzipped Oracle home directory
Remove the .ora files from the network/admin directory, and remove the old database entries from the dbs directory.
# ls -la ./network/admin/
# rm ./network/admin/tnsnames.ora*
# rm ./network/admin/listener.ora*
# ls -la ./dbs/
# rm -rf ./dbs/*
6. If no /etc/oraInst.loc file exists on the server because Oracle has never been installed on the server before, create one
The file should contain a line like this:
inventory_loc=<path_to_oraInventory>
$ cat /etc/oraInst.loc
inventory_loc=/opt/oraInventory
inst_group=oinstall
7. On the target server use the oracle user to clone the installation with the Oracle Universal Installer (OUI)
cd $ORACLE_HOME/clone/bin
perl clone.pl ORACLE_HOME="<target_home>" ORACLE_HOME_NAME="<unique_home_name>" ORACLE_BASE="<path_for_ORACLE_BASE>" OSDBA_GROUP=<OSDBA_privileged_group> OSOPER_GROUP=<OSOPER_privileged_group>
$ cd /opt/oracle/ora11g/11.2.0.4/clone/bin
$ /opt/oracle/ora11g/11.2.0.4/perl/bin/perl clone.pl ORACLE_HOME="/opt/oracle/ora11g/11.2.0.4" ORACLE_HOME_NAME="OraDb11g_home1" ORACLE_BASE="/opt/oracle" OSDBA_GROUP=dba
8. Run root.sh (as root) to finish installation
# /opt/oracle/ora11g/11.2.0.4/root.sh