8 Cloning Oracle Clusterware
This chapter describes how to clone an Oracle Grid Infrastructure home and use the cloned home to create a cluster. You perform the cloning procedures in this chapter by running scripts in silent mode. The cloning procedures are applicable to Linux and UNIX systems. Although the examples in this chapter use Linux and UNIX commands, the cloning concepts and procedures apply generally to all platforms.
Note:
This chapter assumes that you are cloning an Oracle Clusterware 12c installation configured as follows:
-
No Grid Naming Service (GNS)
-
No Intelligent Platform Management Interface specification (IPMI)
-
Voting file and Oracle Cluster Registry (OCR) are stored in Oracle Automatic Storage Management (ASM)
-
Single Client Access Name (SCAN) resolves through DNS
This chapter contains the following topics:
8.1 Introduction to Cloning Oracle Clusterware
Cloning is the process of copying an existing Oracle Clusterware installation to a different location and then updating the copied installation to work in the new environment. Changes made by one-off patches applied on the source Oracle Grid Infrastructure home are also present after cloning. During cloning, you run a script that replays the actions that installed the Oracle Grid Infrastructure home.
Cloning requires that you start with a successfully installed Oracle Grid Infrastructure home. You use this home as the basis for implementing a script that extends the Oracle Grid Infrastructure home to create a cluster based on the original Grid home.
Manually creating the cloning script can be error prone because you prepare the script without interactive checks to validate your input. Despite this, the initial effort is worthwhile for scenarios where you run a single script to configure tens or even hundreds of clusters. If you have only one cluster to install, then you should use the traditional, automated and interactive installation methods, such as Oracle Universal Installer (OUI) or the Provisioning Pack feature of Oracle Enterprise Manager.
Note:
Cloning is not a replacement for Oracle Enterprise Manager cloning that is a part of the Provisioning Pack. During Oracle Enterprise Manager cloning, the provisioning process simplifies cloning by interactively asking for details about the Oracle home. The interview questions cover such topics as the location to which you want to deploy the cloned environment, the name of the Oracle database home, a list of the nodes in the cluster, and so on.
The Provisioning Pack feature of Oracle Enterprise Manager Grid Control provides a framework that automates the provisioning of nodes and clusters. For data centers with many clusters, the investment in creating a cloning procedure to provision new clusters and new nodes to existing clusters is worth the effort.
The following list describes some situations in which cloning is useful:
-
Cloning prepares an Oracle Grid Infrastructure home once and deploys it to many hosts simultaneously. You can complete the installation in silent mode, as a noninteractive process. You do not need to use a graphical user interface (GUI) console, and you can perform cloning from a Secure Shell (SSH) terminal session, if required.
-
Cloning enables you to create an installation (copy of a production, test, or development installation) with all patches applied to it in a single step. Once you have performed the base installation and applied all patch sets and patches on the source system, cloning performs all of these individual steps as a single procedure. This is in contrast to going through the installation process to perform the separate steps to install, configure, and patch the installation on each node in the cluster.
-
Installing Oracle Clusterware by cloning is a quick process. For example, cloning an Oracle Grid Infrastructure home to a cluster with more than two nodes requires a few minutes to install the Oracle software, plus a few minutes more for each node (approximately the amount of time it takes to run the
root.sh
script). -
Cloning provides a guaranteed method of accurately repeating the same Oracle Clusterware installation on multiple clusters.
A cloned installation acts the same as its source installation. For example, you can remove the cloned Oracle Grid Infrastructure home using OUI or patch it using OPatch. You can also use the cloned Oracle Grid Infrastructure 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 cases. However, you can also customize some aspects of cloning, such as specifying custom port assignments or preserving custom settings.
For example, you can specify a custom port for the listener, as follows:
$ export ORACLE_HOME=/u01/app/12.1.0/grid $ $ORACLE_HOME/bin/srvctl modify listener -endpoints tcp:12345
The cloning process works by copying all of the files from the source Oracle Grid Infrastructure home to the destination Oracle Grid Infrastructure home. You can clone either a local (non-shared) or shared Oracle Grid Infrastructure home. Thus, any files used by the source instance that are located outside the source Oracle Grid Infrastructure home's directory structure are not copied to the destination location.
The size of the binary files at the source and the destination may differ because these files are relinked as part of the cloning 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.
8.2 Preparing the Oracle Grid Infrastructure Home for Cloning
To prepare the source Oracle Grid Infrastructure home to be cloned, create a copy of an installed Oracle Grid Infrastructure home and then use it to perform the cloning procedure on other nodes. Use the following step-by-step procedure to prepare the copy of the Oracle Grid Infrastructure home:
8.2.1 Step 1: Install Oracle Clusterware
Use the detailed instructions in the Oracle Grid Infrastructure Installation and Upgrade Guideto perform the following steps on the source node:
Related Topics
8.2.2 Step 2: Shut Down Running Software
Before copying the source Oracle Grid Infrastructure home, shut down all of the services, databases, listeners, applications, Oracle Clusterware, and Oracle ASM instances that run on the node. Oracle recommends that you use the Server Control (SRVCTL) utility to first shut down the databases, and then the Oracle Clusterware Control (CRSCTL) utility to shut down the rest of the components.
8.2.3 Step 3: Create a Copy of the Oracle Grid Infrastructure Home
To keep the installed Oracle Grid Infrastructure home as a working home, make a full copy of the source Oracle Grid Infrastructure home for cloning.
Tip:
When creating the copy, a best practice is to include the release number in the name of the file.
Use one of the following methods to create a compressed copy of the Oracle Grid Infrastructure home, where Grid_home
is the original Oracle Grid Infrastructure home on the original node with all files included, and copy_path
is the directory path to the copied Oracle Grid Infrastructure home with unnecessary files deleted.
8.3 Creating a Cluster by Cloning Oracle Clusterware
This section explains how to create a cluster by cloning a successfully installed Oracle Clusterware environment and copying it to the nodes on the destination cluster. The procedures in this section describe how to use cloning for Linux, UNIX, and Windows systems. OCR and voting files are not shared between the two clusters after you successfully create a cluster from a clone.
For example, you can use cloning to quickly duplicate a successfully installed Oracle Clusterware environment to create a cluster. Figure 8-1 shows the result of a cloning procedure in which the Oracle Grid Infrastructure home on Node 1 has been cloned to Node 2 and Node 3 on Cluster 2, making Cluster 2 a new two-node cluster.
Figure 8-1 Cloning to Create an Oracle Clusterware Environment
![Description of Figure 8-1 follows Description of Figure 8-1 follows](img/cwadd003.gif)
Description of "Figure 8-1 Cloning to Create an Oracle Clusterware Environment"
The steps to create a cluster through cloning are as follows:
8.3.1 Step 1: Prepare the New Cluster Nodes
On each destination node, perform the following preinstallation steps:
-
Specify the kernel parameters
-
Configure block devices for Oracle Clusterware devices
-
Ensure that you have set the block device permissions correctly
-
Use short, nondomain-qualified names for all of the names in the
/etc/hosts
file -
Test whether the interconnect interfaces are reachable using the
ping
command -
Verify that the VIP addresses are not active at the start of the cloning process by using the
ping
command (theping
command of the VIP address must fail) -
On AIX systems, and on Solaris x86-64-bit systems running vendor clusterware, if you add a node to the cluster, then you must run the
rootpre.sh
script (located at the mount point it you install Oracle Clusterware from a DVD or in the directory where you unzip the tar file if you download the software) on the node before you add the node to the cluster -
Run CVU to verify your hardware and operating system environment
Refer to your platform-specific Oracle Clusterware installation guide for the complete preinstallation checklist.
Note:
Unlike traditional methods of installation, the cloning process does not validate your input during the preparation phase. (By comparison, during the traditional method of installation using OUI, various checks occur during the interview phase.) Thus, if you make errors during the hardware setup or in the preparation phase, then the cloned installation fails.
8.3.2 Step 2: Deploy the Oracle Grid Infrastructure Home on the Destination Nodes
Before you begin the cloning procedure that is described in this section, ensure that you have completed the prerequisite tasks to create a copy of the Oracle Grid Infrastructure home, as described in the section titled "Preparing the Oracle Grid Infrastructure Home for Cloning".
8.3.3 Step 3: Run the clone.pl Script on Each Destination Node
To set up the new Oracle Clusterware environment, the clone.pl
script requires you to provide several setup values for the script.
You can provide the variable values by either supplying input on the command line when you run the clone.pl
script, or by creating a file in which you can assign values to the cloning variables. The following discussions describe these options.
Note:
After you run clone.pl
, the script prompts you to run orainstRoot.sh
and root.sh
. Run only orainstRoot.sh
and then proceed to "Step 4: Launch the Configuration Wizard". The configuration wizard will prompt you to run root.sh
.
Related Topics
8.3.3.1 Supplying input to the clone.pl script on the command line
If you do not have a shared Oracle Grid Infrastructure home, navigate to the Grid_home
/clone/bin
directory on each destination node and run the clone.pl
script, which performs the main Oracle Clusterware cloning tasks.
To run the script, you must supply input to several parameters. The following table describes the clone.pl
script parameters.
Table 8-1 Parameters for the clone.pl Script
Parameters | Description |
---|---|
ORACLE_BASE=ORACLE_BASE |
The complete path to the Oracle base to be cloned. If you specify an invalid path, then the script exits. This parameter is required. |
ORACLE_HOME=GRID_HOME |
The complete path to the Oracle Grid Infrastructure home for cloning. If you specify an invalid path, then the script exits. This parameter is required. |
[ORACLE_HOME_NAME= Oracle_home_name | -defaultHomeName] |
The Oracle home name of the home to be cloned. Optionally, you can specify the |
[ORACLE_HOME_USER= Oracle_home_user_name] |
The Oracle home user on Windows. Oracle recommends that you pass this parameter for Oracle Database software cloning. This parameter is optional. |
INVENTORY_LOCATION= location_of_inventory |
The location for the Oracle Inventory. |
OSDBA_GROUP= OSDBA_privileged_group |
Specify the operating system group you want to use as the OSDBA privileged group. This parameter is optional if you do not want the default value. |
"CLUSTER_ NODES={node_ name,node_ name,...}" |
A comma-delimited (with no spaces) list of short node names for the nodes that are included in this new cluster. The following only apply if you are cloning database homes:
Note: You cannot use this parameter in Oracle Grid Infrastructure 12c release 2 (12.2), and later. |
"LOCAL_NODE=node_name" |
The short node name for the node on which |
CRS=TRUE |
This parameter is necessary to set this property on the Oracle Universal Installer inventory. |
OSASM_GROUP= OSASM_privileged_group |
Specify the operating system group you want to use as the OSASM privileged group. This parameter is optional if you do not want the default value. When you run |
OSOPER_GROUP= OSOPER_privileged_group |
Specify the operating system group you want to use as the OSOPER privileged group. This parameter is optional if you do not want the default value. |
-debug |
Specify this option to run the |
-help |
Specify this option to obtain help for the |
For example, on Linux and UNIX systems:
$ perl clone.pl -silent ORACLE_BASE=/u01/app/oracle ORACLE_HOME=
/u01/app/12.2/grid ORACLE_HOME_NAME=OraHome1Grid
INVENTORY_LOCATION=/u01/app/oraInventory LOCAL_NODE=node1 CRS=TRUE
On Windows systems:
C:\>perl clone.pl ORACLE_BASE=D:\u01\app\grid ORACLE_HOME=D:\u01\app\grid\12.2
ORACLE_HOME_NAME=OraHome1Grid ORACLE_HOME_USER=Oracle_home_user_name
"LOCAL_NODE=node1" CRS=TRUE
For Windows platforms, on all other nodes, run the same command with an additional argument: PERFORM_PARTITION_TASKS=FALSE
.
For example:
C:\>perl clone.pl ORACLE_BASE=D:\u01\app\grid ORACLE_HOME=D:\u01\app\grid\12.2
ORACLE_HOME_NAME=OraHome1Grid ORACLE_HOME_USER=Oracle_home_user_name
"LOCAL_NODE=node1" CRS=TRUE PERFORM_PARTITION_TASKS=FALSE
Refer to the preceding table for descriptions of the various parameters in the preceding examples.
If you have a shared Oracle Grid Infrastructure home, then append the -cfs
option to the command example in this step and provide a complete path location for the cluster file system.
8.3.3.2 Supplying Input to the clone.pl Script in a File
Because the clone.pl
script is sensitive to the parameter values that it receives, you must be accurate in your use of brackets, single quotation marks, and double quotation marks. To avoid errors, create a file that is similar to the start.sh
script shown in Example 8-1 in which you can specify environment variables and cloning parameters for the clone.pl
script.
Example 8-1 shows an excerpt from an example script called start.sh
that calls the clone.pl
script; the example is configured for a cluster named crscluster
. Run the script as the operating system user that installed Oracle Clusterware.
Note:
On Solaris systems, there is no -s
following hostname
.
The start.sh
script sets several environment variables and cloning parameters, as described in Table 8-2. Table 8-2 describes the environment variables E01
, E02
, E03
, and E04
that are shown in bold typeface in Example 8-1, and C01
and C02
.
Table 8-2 Environment Variables Passed to the clone.pl Script
Symbol | Variable | Description |
---|---|---|
|
|
The location of the Oracle base directory. |
|
|
The location of the Oracle Grid Infrastructure home. This directory location must exist and must be owned by the Oracle operating system group: OINSTALL. |
|
|
The name of the Oracle Grid Infrastructure home. This is stored in the Oracle Inventory. |
|
|
The location of the Oracle Inventory. This directory location must exist and must initially be owned by the Oracle operating system group: OINSTALL. |
|
|
A comma-delimited list of short node names for the nodes in the cluster. |
|
|
The short name of the local node. |
Example 8-1 Excerpt From the start.sh Script to Clone Oracle Clusterware
#!/bin/sh ORACLE_BASE=/u01/app/oracle GRID_HOME=/u01/app/12.1/grid THIS_NODE=`hostname -s` E01=ORACLE_BASE=${ORACLE_BASE} E02=ORACLE_HOME=${GRID_HOME} E03=ORACLE_HOME_NAME=OraGridHome1 E04=INVENTORY_LOCATION=${ORACLE_BASE}/../oraInventory #C00="-debug"
C01="CLUSTER_NODES={node1,node2}" C02="LOCAL_NODE=$THIS_NODE" perl ${GRID_HOME}/clone/bin/clone.pl -silent $E01 $E02 $E03 $E04 $C01 $C02 CRS=TRUE
8.3.4 Step 4: Launch the Configuration Wizard
The Configuration Wizard helps you to prepare the crsconfig_params
file, prompts you to run the root.sh
script (which calls the rootcrs.pl
script), relinks Oracle binaries, and runs cluster verifications.
Start the Configuration Wizard, as follows:
On Linux/UNIX:
$ Oracle_home/crs/config/config.sh
On Windows:
C:\>Oracle_home\crs\config\config.bat
Optionally, you can run the Configuration Wizard silently, as follows, providing a response file:
$ Oracle_home/crs/config/config.sh -silent -responseFile file_name
On Windows:
C:\>Oracle_home\crs\config\config.bat -silent -responseFile file_name
Related Topics
See Also:
Oracle Grid Infrastructure Installation and Upgrade Guide for your platform for information about preparing response files
8.4 Using Cloning to Add Nodes to a Cluster
You can also use cloning to add nodes to a cluster.
Figure 8-2 shows the result of a cloning procedure in which the Oracle Grid Infrastructure home on Node 1 has been cloned to Node 2 in the same cluster, making it a two-node cluster. Newly added nodes to the cluster share the same OCR and voting files.
Figure 8-2 Cloning to Add Nodes to a Cluster
![Description of Figure 8-2 follows Description of Figure 8-2 follows](img/cwadd03.gif)
Description of "Figure 8-2 Cloning to Add Nodes to a Cluster"
Using Figure 8-2 as an example, the following procedure explains how to add nodes to a cluster using cloning. In this procedure, you make a copy of the image (a clone) that you used to create Node 1, initially, to Node 2.
Prepare Node 2 as described in "Step 1: Prepare the New Cluster Nodes".
Related Topics
8.5 Locating and Viewing Log Files Generated During Cloning
The cloning script runs multiple tools, each of which can generate log files. After the clone.pl
script finishes running, you can view log files to obtain more information about the status of your cloning procedures. Table 8-3 lists the log files that are generated during cloning that are the key log files for diagnostic purposes.
Note:
Central_inventory
in Table 8-3 refers to the Oracle Inventory directory.
Table 8-3 Cloning Log Files and their Descriptions
Log File Name and Location | Description |
---|---|
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 information. |
Table 8-4 lists the location of the Oracle Inventory directory for various platforms.
Table 8-4 Finding the Location of the Oracle Inventory Directory
Type of System | Location of the Oracle Inventory Directory |
---|---|
All UNIX computers except Linux and IBM AIX |
|
IBM AIX and Linux |
|
Windows |
|