Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Cloning Oracle 12c Home Binaries

Almost every backup and recovery concern is focused on protecting the data stored inside database and rightly so. But during the course of a DBA career, restoring the Oracle Home or duplicating is sometimes is necessary. This may be required to either quickly bring back a home after a failed upgrade or to maintain the standard configuration settings for new installs.  Manually redoing all those configurations can get quite hectic and there are chances of error. In this article we will look at how you can clone an existing Oracle Home.
There are just two steps required for cloning the Oracle Home as shown below. In our sample here, we experiment on a Linux OS, cloning and restoring to the same server. But the steps can be very similar and you may only have to change the commands a bit as mentioned in first step, if you have different platform or want to clone it to different server then your source. The second step will be more or less identical.

Copying Files

The first step is to copy the Oracle Home binary files from the source location to the destination. Before we can copy the files, first we will have to create a new Oracle Base. You can use same Oracle Base but for clarity we will create a new one. Log in as root and issue the following commands.
# mkdir -p /u02/app/oracle
# chown -R oracle:oinstall /u02/app/oracle
# chmod -R 775 /u02/app/oracle
Create the directory structure where you want to copy Oracle Home files.
# mkdir -p /u02/app/oracle/product/12.1.0
Copy the files from your source Oracle Home to destination using the following command.
# cp -rp /u01/app/oracle/product/12.1.0/dbhome_1/ /u02/app/oracle/product/12.1.0
If the above command is successful then all the files should have been copied to the destination folder.

Cloning Oracle Home using Oracle Universal Installer

Once the copy is successful, we can now start the cloning process. First set the ORACLE_HOME environment variable to the newly copied Oracle Home.
$ export ORACLE_HOME=/u02/app/oracle/product/12.1.0/dbhome_1/
$ echo $ORACLE_HOME
/u02/app/oracle/product/12.1.0/dbhome_1/
Use the command below to clone Oracle Home. All the parameters are pretty much self explanatory. You will need to provide Oracle Home location, the Oracle Home name and the location of Oracle Base where Oracle Home should be cloned.
$ /u02/app/oracle/product/12.1.0/dbhome_1/oui/bin/runInstaller -silent -clone ORACLE_HOME="/u02/app/oracle/product/12.1.0/dbhome_1/" ORACLE_HOME_NAME="OraDB12c_Home2" ORACLE_BASE="/u02/app/oracle"
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 4031 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-01-14_11-27-41PM. Please wait ...[oracle@localhost ~]$ Oracle Universal Installer, Version 12.1.0.1.0 Production
Copyright (C) 1999, 2013, Oracle. All rights reserved.

You can find the log of this install session at:
/u01/app/oraIventory/logs/cloneActions2014-01-14_11-27-41PM.log
.................................................................................................... 100% Done.

 

Installation in progress (Tuesday, January 14, 2014 11:27:58 PM PKT)
................................................................................. 81% Done.
Install successful

Linking in progress (Tuesday, January 14, 2014 11:28:05 PM PKT)
. 82% Done.
Link successful

Setup in progress (Tuesday, January 14, 2014 11:29:02 PM PKT)
.......... 100% Done.
Setup successful

Saving inventory (Tuesday, January 14, 2014 11:29:03 PM PKT)
Saving inventory complete

Configuration in progress (Tuesday, January 14, 2014 11:29:27 PM PKT)
Configuration complete

End of install phases.(Tuesday, January 14, 2014 11:29:28 PM PKT)
WARNING:
The following configuration scripts need to be executed as the "root" user.
/u02/app/oracle/product/12.1.0/dbhome_1//root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts

The cloning of OraDB12c_Home2 was successful.
Please check '/u01/app/oraIventory/logs/cloneActions2014-01-14_11-27-41PM.log' for more details.

Just like it is the case for normal installation you need to run the root.sh script using root login. Open a new window, log in as root and run the above script.
# /u02/app/oracle/product/12.1.0/dbhome_1//root.sh
Check /u02/app/oracle/product/12.1.0/dbhome_1//install/root_localhost.localdomain_2014-01-14_23-30-19.log for the output of root script
Check the log-file as mentioned above and confirmation from success will be there.

Verifying Inventory

The last step is to verify that everything went OK. You need to check the inventory for this. Check the inventory.xml file located at /u01/app/oraInventory/ContentsXML/. The entry for the new home under HOME_LIST can verify the new home was added to the inventory. You will have something like this.
   <HOME_LIST>
<HOME NAME="OraDb12c_home1" LOC="/u01/app/oracle/product/12.1.0/dbhome_1" TYPE="O" IDX="1"/>
<HOME NAME="OraDB12c_home2" LOC="/u02/app/oracle/product/12.1.0/dbhome_1" TYPE="O" IDX="2"/>
</HOME_LIST>

Comments

Popular posts from this blog

Oracle DBMS SCHEDULER Examples

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

How to Enable/Disable autovacuum on PostgreSQL