How to Clone Oracle Home Without Using Clone.pl

Cloning Oracle Homes is a convenient way of getting a new Oracle Home. It’s particularly helpful when you need to patch out-of-place.

A popular method for cloning Oracle Homes is to use clone.pl. However, in Oracle Database 18c, it is deprecated.

[INFO] [INS-32183] Use of clone.pl is deprecated in this release. Clone operation is equivalent to performing a Software Only installation from the image. 
You must use runInstaller script available to perform the Software Only install. For more details on image based installation, refer to help documentation.

This Is How You Should Clone Oracle Home

You should use runInstaller to create golden images instead of clone.pl. Golden image is just another word for the zip file containing the Oracle Home.

How to Create a Golden Image

  1. First, only create a golden image from a freshly installed Oracle Home. Never use an Oracle Home that is already in use. As soon as you start to use an Oracle Home you taint it with various files and you don’t want to carry those files around in your golden image. The golden image must be completely clean.

  2. Then, you create a directory where you can store the golden image:

    export GOLDIMAGEDIR=/u01/app/oracle/goldimages
    mkdir -p $GOLDIMAGEDIR
    
  3. Finally, you create the golden image:

    $ORACLE_HOME/runInstaller -createGoldImage \
       -destinationLocation $GOLDIMAGEDIR \
       -silent
    
    • If you need to exclude files, you can use -exclFiles. It accepts a wilcard, so for example you can specify -exclFiles network/admin* to exclude all files and subdirectories in a directory.
  4. The installer creates the golden image as a zip file in the specified directory. The name of the zip file is unique and printed on the console.

Check the documentation for further details.

How to Deploy from a Golden Image

  1. First, you create a directory for the new Oracle Home and unzip the golden image:
    export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_2
    mkdir -p $ORACLE_HOME
    cd $ORACLE_HOME
    unzip -q /u01/app/oracle/goldimages/my_golden_image.zip
    
  2. Next, you need to install the Oracle Home. You can do it interactively:
    cd $ORACLE_HOME
    ./runInstaller
    
    Or, you can do it in silent mode:
    cd $ORACLE_HOME
    ./runInstaller -ignorePrereq -waitforcompletion -silent \
    ...
    

That’s it!

If you need to read further on silent installations, check out oracle-base.com.

The Oracle Database 23c documentation has an good example of using use the new procedure.

But How about OraInst.loc?

One of the differences between clone.pl and runInstaller is that the latter does not include the file $ORACLE_HOME/oraInst.loc.

This is intentional because the file is not needed for golden image deployment. runInstaller recreates the file when you install the golden image.

One of the things listed in oraInst.loc is the location of the Oracle inventory. Either runInstaller finds the value itself, or you can specify it on the command line using INVENTORY_LOCATION=<path-to-inventory>.

You can read more about oraInst.loc in the documentation or MOS note Significance of oraInst.loc When Installing Oracle Products and Applying Patches (Doc ID 418537.1).

Naming Your Golden Image

If you want your zip file (the golden image) to have a specific name, you have two options:

  1. Rename the zip file after executing runInstaller -createGoldImage.
  2. Use the secret parameter -name, which allows you to specify a name for the zip file. To name the zip file my_golden_image.zip:
    $ORACLE_HOME/runInstaller -createGoldImage \
       ... \
       -name my_golden_image.zip
    

Why Is Clone.pl Deprecated?

Previously, many tools existed to do the same – clone an Oracle Home. Now, we have consolidated our resources into one tool.

From now on, there is one method for cloning Oracle Home. That is easier for everyone.

In addition, runInstaller has some extra features that clone.pl doesn’t. For instance:

  • Better error reporting
  • Precheck run
  • Multimode awareness
  • Ability to apply patches during installation

When Will It Be Desupported?

I don’t know. Keep an eye out on the Upgrade Guide, which contains information about desupported features.

However, I can see in the Oracle Database 23c documentation that clone.pl is still listed. But that’s subject to change until Oracle Database 23c is released.

Pro Tips

  • Remember, you can install patches to your golden image after it has been unzipped – as part of the installation.

  • If you clone Oracle Homes because you are doing out-of-place patching, you are on the right track. I strongly recommend always using out-of-place patching. Also, when you patch out-of-place, remember to move all the database configuration files.

  • If you clone Oracle Homes, you keep adding stuff to the same Oracle Home. Over time the Oracle Home will increase in size. The more patches you install over time, the more the Oracle Home increases in size. OPatch has functionality to clean up inactive patches from an Oracle Home. Consider running it from time to time using opatch util deleteinactivepatches. Mike Dietrich has a really good blog post about it. I also describe it in our of our previous webinars:

Appendix

Thanks to Anil Nair for pointing me in the right direction.

Further Reading

4 thoughts on “How to Clone Oracle Home Without Using Clone.pl

  1. Hello Daniel, We had to clone a home with an older Oracle version last week in an emergeny. Fortunately I remembered I had seen your post a couple of days before. Worked great, thank you!

    Like

  2. Hi Dagmar,
    I’m glad that my blog post was of use to you. This is one of the reasons why I try to write a many as I can.
    Thanks for letting me know. Much appreciated.
    Regards,
    Daniel

    Like

  3. Interesting and enlightening post. I’ve written a script or two to do this before these tools were known to me. It’s good to know which is best to use. How about engineered systems? They also have utilities to do this – dbaascli and dbcli for instance. Should they be used instead on those systems?

    Like

  4. Hi Michael,

    Thanks for the feedback. Much appreciated.

    On engineered systems, the answer is… it depends. Technically, you can use the above method on all platforms, however, it might break certain functionality. For instance, if you manually clone an Oracle Home on a base database system in OCI, then it won’t work for the OCI tooling.

    Regards,
    Daniel

    Like

Leave a comment