How to move or rename Oracle Home

How to move or rename Oracle Home

If you want to rename Oracle Home you usually need to:

1. uninstall existing Oracle Home
2. reinstall Oracle software to the right directory that will be the new Oracle Home.

You cannot just move Oracle Home because installing Oracle Home is not just copying executable files. However uninstalling and installing again Oracle software takes some time.

If you want to do it quickly there is another way to do it using Oracle software cloning:
1. Move Oracle Home using OS command
2. Clone the new Oracle Home using Oracle Universal Installer (OUI)
3. Remove the old Oracle Home from Oracle inventory with OUI.

Here is a full example with Oracle Database 12.1.0.1 Enterprise Edition on Oracle Linux 6.4 64bit. All steps have been with run oracle account unless otherwise stated.

Step 1 : Check ORACLE HOME

Command :

Here my ORACLE HOME location in /oraeng/app/oracle/product/12.1.0.

First connect as Oracle software owner:

Check that no executable is currently running from this Oracle Home (you should stop any Oracle database instance, listener, RMAN or SQL*Plus sessions):

Move the directory with the mv command:

I have created directory location /u01/app/oracle/product/12.1.0.2 and moved all the files and directories into it.

Step 2: Clone the Oracle Home

Of course you must use new Oracle Home path for runInstaller and you must also specify new Oracle Home directory as ORACLE_HOME parameter and set ORACLE_BASE parameter (I have also added silent mode (-silent) because graphical mode is not needed and -waitForCompletion so that OUI command is not started in the background):

Command :

The cloning of ORACLE HOME was successful.

You can see that OUI has linked again the binaries and executables and run some configuration steps.
You need to run root.sh:

Modify /etc/oratab for existing database that is using the Oracle Home that has been moved (because this has not been done by OUI):

Check Oracle inventory:

It should have /u01 location.

Connect to database and check ORACLE HOME .

By using PL*SQL package we can get ORACLE HOME location.

“exec dbms_system.get_env”

 

If any suggestions please write in comments.

 

Thank you.

Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 4.83 out of 5)
Loading...

One thought on “How to move or rename Oracle Home

Add Comment