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.
• SGA Instance Parameters in CDB and PDB
• Oracle 12c Database Installation on Oracle Linux 6 using VirtualBox
• IOUG COLLABORATE 14: Presenting “Learn What it Takes to Manage Oracle 12c Database in the Cloud
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.
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
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 ...[[email protected] ~]$ Oracle Universal Installer, Version 220.127.116.11.0 Production
Copyright (C) 1999, 2013, Oracle. All rights reserved.
You can find the log of this install session at:
.................................................................................................... 100% Done.
Installation in progress (Tuesday, January 14, 2014 11:27:58 PM PKT)
................................................................................. 81% Done.
Linking in progress (Tuesday, January 14, 2014 11:28:05 PM PKT)
. 82% Done.
Setup in progress (Tuesday, January 14, 2014 11:29:02 PM PKT)
.......... 100% Done.
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)
End of install phases.(Tuesday, January 14, 2014 11:29:28 PM PKT)
The following configuration scripts need to be executed as the "root" user.
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.
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.
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 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"/>
• Cloning Oracle 12c Home Binaries using clone.pl