6 Cloning Oracle Software

This chapter provides information about Oracle cloning using Oracle Universal Installer (OUI). This chapter contains the following topics:

Note:

For procedures to clone an Oracle Database Oracle Home, refer to the following documentation depending on your platform:
  • Oracle® Database Installation Guide for Linux 11g Release 2 (11.2)

  • Oracle® Database Installation Guide for Microsoft Windows 11g Release 2 (11.2)

For procedures to clone Oracle Clusterware and Oracle Real Application Clusters homes, refer to the following documentation:

  • Oracle® Real Application Clusters Administration and Deployment Guide 11g Release 2 (11.2)

  • Oracle® Clusterware Administration and Deployment Guide 11g Release 2 (11.2)

About Cloning

Cloning is the process of copying an existing Oracle installation to a different location and updating the copied bits to work in the new environment. The changes made by applying one-off patches on the source Oracle home are also present after the clone operation. The source and the destination path (host to be cloned) need not be the same. During cloning, OUI replays the actions that were run to install the home. Cloning is similar to installation, except that OUI runs the actions in a special mode referred to as clone mode. Some situations in which cloning is useful are:

  • Creating an installation that is a copy of a production, test, or development installation. Cloning enables you to create a new installation with all patches applied to it in a single step. This contrasts with going through the installation process by performing separate steps to install, configure, and patch the installation.

  • Rapidly deploying an instance and the applications that it hosts.

  • Preparing an Oracle home and deploying it to many hosts.

The cloned installation behaves the same as the source installation. For example, the cloned Oracle home can be removed using OUI or patched using OPatch. You can also use the cloned Oracle home as the source for another cloning operation. You can create a cloned copy of a test, development, or production installation by using the command-line cloning scripts. The default cloning procedure is adequate for most usage cases. However, you can also customize various aspects of cloning, for example, to specify custom port assignments, or to preserve custom settings.

The cloning process copies all of the files from the source Oracle home to the destination Oracle home. Thus, any files used by the source instance located outside the source Oracle home's directory structure are not copied to the destination location.

The size of the binaries at the source and the destination may differ because these are relinked as part of the clone operation, and the operating system patch levels may also differ between these two locations. Additionally, the number of files in the cloned home would increase because several files copied from the source, specifically those being instantiated, are backed up as part of the clone operation.

OUI cloning is more beneficial than using the tarball approach, because cloning configures the Central Inventory and the Oracle home inventory in the cloned home. Cloning also makes the home manageable and enables the paths in the cloned home and the target home to be different.

Overview of the Cloning Process

The cloning process uses the OUI cloning functionality. This operation is driven by a set of scripts and add-ons that are included in the respective Oracle software. The cloning process has two phases:

Source Preparation Phase

To prepare the source Oracle home for cloning, archive and compress the source Oracle home using your preferred archiving tool. For example, you can use WinZip on Microsoft Windows system computers and tar or gzip on UNIX.

During this process, ensure the following:

  • The tool that you use should preserve the permissions and file time stamps.

  • When archiving the home, skip the *.log, *.dbf, listener.ora, sqlnet.ora, and tnsnames.ora files for archiving.

  • Do not archive the following folders:

    $ORACLE_HOME/<Hostname>_<SID>
    $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_<Hostname>_<SID>
    

Example 6–1 shows an example of an excluded file list.

Example 6-1 Excluded File List

$ cat excludedFileList.txt
./install/make.log
./cfgtoollogs/cfgfw/CfmLogger_2009-07-13_12-03-16-PM.log
./cfgtoollogs/cfgfw/oracle.server_2009-07-13_12-03-17-PM.log
./cfgtoollogs/cfgfw/oracle.network.client_2009-07-13_12-03-18-PM.log
./cfgtoollogs/cfgfw/oracle.has.common_2009-07-13_12-03-18-PM.log
./cfgtoollogs/cfgfw/oracle.assistants.server_2009-07-13_12-03-18-PM.log
./cfgtoollogs/cfgfw/OuiConfigVariables_2009-07-13_12-03-18-PM.log
./cfgtoollogs/cfgfw/oracle.sysman.console.db_2009-07-13_12-03-18-PM.log
./cfgtoollogs/cfgfw/oracle.sqlplus.isqlplus_2009-07-13_12-03-18-PM.log
./cfgtoollogs/oui/cloneActions2009-07-13_11-52-19AM.log
./cfgtoollogs/oui/silentInstall2009-07-13_11-52-19AM.log

Example 6–2 shows how to archive and compress the source for various platforms.

Example 6-2 Archiving and Compressing the Source

tar cpf - . | compress -fv > temp_dir/archiveName.tar.Z  ( for "aix" or $^O eq "hpux")
tar cpfX - excludeListFile . | compress -fv > temp_dir/archiveName.tar.Z (for remaining UNIX based systems)

Note:

Do not use the jar utility to archive and compress the Oracle home.

Cloning Phase

On the destination system, you unarchive the Oracle home and run the following OUI clone command from the destination home:

<destination home location>/oui/bin/runInstaller -clone -silent -defaultHomeName ORACLE_HOME=<destination home location>

The following example shows how to unarchive and decompress the source for various platforms:

To unarchive:
mkdir  Destination_oracle_homecd   Destination_oracle_homezcat temp_dir/archiveName.tar.Z | tar xpf - (for "hpux")zcat temp_dir/archiveName.tar.Z | tar xBpf -  (for remaining UNIX based systems)

Note:

The cloned home and source home will not be identical in size, because the cloned home will have additional files created during the cloning operation.

Locating and Viewing Log Files

The cloning script runs multiple tools, each of which may generate its own log files. However, the following log files that OUI and the cloning scripts generate are the key log files of interest for diagnostic purposes:

  • <Central_Inventory>/logs/cloneActions timestamp.log: Contains a detailed log of the actions that occur during the OUI part of the cloning.

  • <Central_Inventory>/logs/oraInstall timestamp.err: Contains information about errors that occur when OUI is running.

  • <Central_Inventory>/logs/oraInstall timestamp.out: Contains other miscellaneous messages generated by OUI.

  • $ORACLE_HOME/clone/logs/clone timestamp.log: Contains a detailed log of the actions that occur during the pre-cloning and cloning operations.

  • $ORACLE_HOME/clone/logs/error timestamp.log: Contains information about errors that occur during the pre-cloning and cloning operations.

To find the location of the Oracle inventory directory:On all UNIX system computers except Linux and IBM AIX, look in the /var/opt/oracle/oraInst.loc file. On IBM AIX and Linux-based systems, look in the /etc/oraInst.loc file.

On Windows system computers, you can obtain the location from the Windows Registry key: HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\INST_LOC.