If there is one thing a DBA hates it is to waste time. Particularly on boring and tedious tasks. One such task is installing Oracle on a new system (or duplicating a home on an existing system) which generally involves X server setup (Xming for Windows, XQuartz on Mac, pure as the driven snow on Linux) and obnoxious Oracle Installer GUI screens.
Yet despite the widespread angst at performing Oracle installs, I’m surprised at the number of clients and DBAs I see trudging through Next buttons on every single server to get it installed. Nevermind the fact that with modern server deployment we should be able to create new systems which already have Oracle installed and configured; a DBA can clone Oracle Homes from server to server even if enterprise provisioning not an option.
Cloning the Oracle Home is done through simple tools: cp if you are cloning on the same server, tar (or other tools) and scp to go to a new server, and the vanilla runInstaller package from Oracle conveniently located in $ORACLE_HOME/oui/bin.
[oracle@orahost ~]$ echo $ORACLE_HOME
[oracle@orahost ~]$ cd /u01/app/oracle/product/11.2.0
[oracle@orahost 11.2.0]$ cp -rp db_1 db_2
cp: cannot open `db_1/bin/nmhs' for reading: Permission denied
cp: cannot open `db_1/bin/nmb' for reading: Permission denied
cp: cannot open `db_1/bin/nmo' for reading: Permission denied
In the steps above, we copied the ORACLE_HOME located at /u01/app/oracle/product/11.2.0/db_1 to another directory (/u01/app/oracle/product/11.2.0/db_2). If you use the cp command, make sure you use the -rp flags; -r copies directories recursively, and -p preserves file attributes. You may also notice that a few files could not be copied. Don’t worry about these, when we run the installer it will take care of that.
Once the copy (or tar/untar between servers) is complete, the rest is simple. We will run the runInstaller command in the new Oracle Home and provide the information it requires. This is done silently, so no X Windows server is required at all.
[oracle@orahost 11.2.0]$ cd db_2/oui/bin
[oracle@orahost bin]$ ./runInstaller -silent -clone ORACLE_BASE="/u01/app/oracle" ORACLE_HOME="/u01/app/oracle/product/11.2.0/db_2" ORACLE_HOME_NAME="OraHome2"
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 3960 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2013-03-12_09-46-15AM. Please wait ...[oracle@orahost bin]$ Oracle Universal Installer, Version 184.108.40.206.0 Production
Copyright (C) 1999, 2009, Oracle. All rights reserved.
You can find the log of this install session at:
.................................................................................................... 100% Done.
Installation in progress (Tuesday, March 12, 2013 9:46:35 AM EDT)
............................................................................. 77% Done.
Linking in progress (Tuesday, March 12, 2013 9:46:43 AM EDT)
Setup in progress (Tuesday, March 12, 2013 9:48:14 AM EDT)
End of install phases.(Tuesday, March 12, 2013 9:50:31 AM EDT)
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 OraHome2 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2013-03-12_09-46-15AM.log' for more details.
The actual command we used was:
These flags defined:
- -silent: specifies that the command should be done without interaction
- -clone: specifies that the home is a clone of another location
- ORACLE_BASE: the base directory for Oracle products as per the Optimal Flexible Architecture (OFA)
- ORACLE_HOME: the new directory location
- ORACLE_HOME_NAME: a unique name for the Oracle Home for the server you have cloned to
Once you have finished running the command and have confirmed success, the standard root.sh (and orainstRoot.sh if this is the first Oracle install on the server) execution by the root user applies.
Good luck, and happy cloning!