This chapter provides information about Oracle cloning using Oracle Universal Installer (OUI). This chapter contains the following topics:
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 allows the paths in the cloned home and the target home to be different.
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:
To prepare the source Oracle home to be cloned, perform the following steps:
At the source, run a script called
prepare_clone.pl. This is a Perl script that prepares the source for cloning by recording the information required for cloning. This script is generally found in the following location:
During this phase,
prepare_clone.pl parses files in the source Oracle home to extract and store the required values.
Note:The need to perform the preparation phase depends on the Oracle product you are installing. This script needs to be executed only for the Application Server Cloning. Database and CRS Oracle home cloning does not require this.
Archive and compress the source Oracle home using your preferred archiving tool. For example, you can use WinZip on Microsoft Windows system computers and
gzip on UNIX. Make sure that the tool that you use preserves the permissions and file timestamps. When archiving the home, also ensure that you skip the
tnsnames.ora for archiving. Also ensure that you do not archive the following folders:
The following sample shows an exclude file list:
$ cat excludedFileList.txt ./install/make.log ./cfgtoollogs/cfgfw/CfmLogger_2007-07-13_12-03-16-PM.log ./cfgtoollogs/cfgfw/oracle.server_2007-07-13_12-03-17-PM.log ./cfgtoollogs/cfgfw/oracle.network.client_2007-07-13_12-03-18-PM.log ./cfgtoollogs/cfgfw/oracle.has.common_2007-07-13_12-03-18-PM.log ./cfgtoollogs/cfgfw/oracle.assistants.server_2007-07-13_12-03-18-PM.log ./cfgtoollogs/cfgfw/OuiConfigVariables_2007-07-13_12-03-18-PM.log ./cfgtoollogs/cfgfw/oracle.sysman.console.db_2007-07-13_12-03-18-PM.log ./cfgtoollogs/cfgfw/oracle.sqlplus.isqlplus_2007-07-13_12-03-18-PM.log ./cfgtoollogs/oui/cloneActions2007-07-13_11-52-19AM.log ./cfgtoollogs/oui/silentInstall2007-07-13_11-52-19AM.log
The following example shows how to archive and compress the source for various platforms:
To archive and compress: 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.
On the destination system, you unarchive the Oracle home and run the
clone.pl script. This Perl script performs all parts of the cloning operation automatically by running OUI and various other utilities. This script uses the cloning functionality in OUI. When you run the
clone.pl script, it handles the specifics that OUI may have missed. The Central Inventory of the box where the home is being cloned is updated as is the Oracle home inventory (
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)
You must have Perl 5.6 or higher installed on your system to enable cloning. Also ensure that you set the path environment variable to the correct Perl executable.
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.
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
On Windows system computers, you can obtain the location from the Windows Registry key:
clone.pl script finishes running, refer to these log files to obtain more information about the cloning process.
There are two steps involved in cloning an Oracle Database 11.1 Oracle home:
To prepare the source Oracle home to be cloned, perform the following steps:
Ensure that the Oracle Database installation whose home you want to clone has been successful.
For Windows system computers, you can check the status of the installation by reviewing the
.log file for the installation session, where
date_time represents the date and time when the file was created; for example,
installActions2007-05-30_10-28-04PM.log. This log file is normally located in the
c:\Program Files\Oracle\Inventory\logs directory.
For Linux-based systems, the logs are kept in the
<inventory location>/logs directory. To determine the location of the Central Inventory, see"Locating and Viewing Log Files".
If you have installed patches, you can check their status by running the following commands:
For Windows-based system computers:
c:\ORACLE_BASE\ORACLE_HOME\OPatch> set ORACLE_HOME = ORACLE_HOME_using_patch c:\ORACLE_BASE\ORACLE_HOME\OPatch> opatch lsinventory
For Linux-based and UNIX-based systems:
/ORACLE_BASE/ORACLE_HOME/OPatch> setenv ORACLE_HOME ORACLE_HOME_using_patch /ORACLE_BASE/ORACLE_HOME/OPatch> ./opatch lsinventory
Archive and compress the source Oracle home, using your preferred tool for archiving. For more information on this, see "Source Preparation Phase".
To clone the 11.1 Oracle Database, perform the following steps:
Copy the compressed zip or archive file to the target computer.
Extract the contents of the compressed zip or archive file in the target computer. For more information on extracting the contents, see "Cloning Phase".
On the target computer, go to the
$ORACLE_HOME/clone/bin directory and run
clone.pl. This is a Perl script that performs all parts of the cloning operation automatically by calling various utilities and OUI. This script uses the cloning functionality in OUI.
clone.plscript clones the software only and not the database instance.
The following command shows the syntax for the
For Windows-based systems:
perl <Oracle_Home>\clone\bin\clone.pl ORACLE_BASE=<path to oracle base> ORACLE_HOME=<Path to the Oracle_Home being_cloned> ORACLE_HOME_NAME=<Oracle_Home_Name for the Oracle_Home being cloned> [-command_line_arguments]
For Linux-based and UNIX-based systems:
perl <Oracle_Home>/clone/bin/clone.pl ORACLE_BASE=<path to oracle base> ORACLE_HOME=<Path to the Oracle_Home being_cloned> ORACLE_HOME_NAME=<Oracle_Home_Name for the Oracle_Home being cloned> [-command_line_arguments]
The preceding command uses the <command_line_arguments> variable. Table 6-1 describes the command-line arguments.
If you use this argument, anything following it is passed to the OUI clone command line. For example, you can use this option to pass the location of the
'-O -paramFile C:\OraHome_1\oui\oraparam.ini'
If you use this argument, the script runs in debug mode.
If you use this argument, the script prints the help for the clone script.
You can also pass values in the command line by using the
$ORACLE_HOME/clone/config/cs.properties file. You can enter values in the line
clone_command_line=<value>. The values entered here are appended to the OUI command line, which is run to perform the clone operation.
For example, to specify a non-default location for the Oracle inventory file on UNIX system computers, you can add the following line to the
clone_command_line= -invptrloc /private/oracle/oraInst.loc
Note:To specify multiple arguments, separate each argument with a space.
Locate the log file, if desired, after OUI starts and records the cloning actions in the
For Windows-based systems, this log file is normally located in the following directory:
For Linux-based and UNIX-based systems, this log file is normally located in the following directory:
To configure the connection information for the new database, run the Net Configuration Assistant:
On Windows-based systems, select Start > Programs > Oracle - HOME_NAME > Configuration and Migration Tools > Net Configuration Assistant.
On Linux-based and UNIX-based systems, set the
ORACLE_HOME variable and run
To create a new database for the newly cloned Oracle home, run the Oracle Database Configuration Assistant:
On Windows-based systems, select Start > Programs > Oracle - HOME_NAME > Configuration and Migration Tools > Database Assistant.
On Linux-based and UNIX-based systems, run
After cloning, you can view the status of the clone operation by navigating to the
$ORACLE_HOME/clone/log directory and by reviewing the
*.err files. For more information, see the section "Locating and Viewing Log Files".
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 1 (11.1) (B28254-04)
Oracle® Clusterware Administration and Deployment Guide 11g Release 1 (11.1) (B28255-03)