How to move or rename Oracle Home
Reprinted from: https://pierreforstmanndotcom.wordpress.com/2014/09/30/how-to-move-or-rename-oracle-home/
Also refer to Oracle's official documentation: HTTP://DOCS.ORACLE.COM/CD/B14117_01/EM.101/B12140/2_OUI_USING.HTM#I1007152
If you want to rename Oracle Home usually need to:
1. Uninstall existing Oracle Home
2. Reinstall Oracle software to the right directory, that'll be the new Oracle Home.
You cannot just move Oracle home because installing Oracle home isn't just copying executable files. However uninstalling and installing again Oracle software takes some time.
If you want to does it quickly there is another a-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 are a full example with Oracle Database 12.1.0.1 entreprise Edition on Oracle Linux 6.4 64bit. All steps has been with run Oracle account unless otherwise stated.
Step 1:move Oracle Home
First Connect as Oracle software owner:
$ ID oracleuid=54231 (Oracle) gid=54321 (oinstall) groups=54321 (Oinstall), 54322 (DBA), 54323 (Oper)
Check that no executable are currently running from this Oracle Home (you should stop any Oracle database instance, Listene R, RMAN or Sql*plus sessions):
$ ps-fu oracleuid PID PPID C stime TTY time cmdoracle 2692 2691 0 18:01 pts/0 00:00:00-bashoracle 3277 2692 0 18:09 pts/0 00:00:00 ps-fu Oracle
Current Oracle Home is /u01/app/oracle/product/12.1.0/db_1 and I'll rename it to /u01/app/orac Le/product/12.1.0.1/db_1 So, directory name has the full 4 digit version number:
$ $ORACLE _home/opatch/opatch lsinv-alloracle Interim Patch Installer version 12.1.0.1.0Copyright (c), ORACLE Corpora tion. All rights reserved. Oracle Home:/u01/app/oracle/product/12.1.0/db_1central Inventory:/u01/app/orainventory from:/u01/a pp/oracle/product/12.1.0/db_1/orainst.locopatch Version:12.1.0.1.0oui version:12.1.0.1.0log file location:/U01/APP/ORACLE/PRODUCT/12. 1.0/db_1/cfgtoollogs/opatch/opatch2014-09-30_18-08-14pm_1.loglsinventory Output file Location:/u01/app/oracle/ product/12.1.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-09-30_ 18-08-14pm.txt--------------------------------------------------------------------------------List of Oracle Homes:name oradb12home1/u01/app/oracle/product/12.1.0/db_1installed top-level products (1): Oracle Database 12c 12.1.0.1.0There is 1 products installed in this Orac Le Home.there is no interim patches installed in this Oracle Home.--------------------------------------------------------------------------------Opatch succeeded.$
Move the directory with the MV command:
$ pwd/u01/app/oracle/product$ MV 12.1.0 12.1.0.1
Step 2:clone the Oracle Home
Of course must use new Oracle home path for Runinstaller and 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 was not Neede D and-waitforcompletion So, OUI command is not started in the background):
$/u01/app/oracle/product/12.1.0.1/db_1/oui/bin/runinstaller-clone-silent-defaulthomename ORACLE_HOME=/u01/app/ Oracle/product/12.1.0.1/db_1 oracle_base=/u01/app/oracle-waitforcompletionstarting ORACLE Universal Installer ... Checking swap space:must be greater than MB. Actual 4031 MB passedpreparing to launch Oracle Universal Installer from/tmp/orainstall2014-09-30_06-35-53pm. Please wait ... Oracle Universal Installer, Version 12.1.0.1.0 productioncopyright (C) 1999, Oracle. All rights reserved. You can find the log of this install session at:/u01/app/orainventory/logs/cloneactions2014-09-30_06-35-53pm.log .................................................................................................... 100% Done.installation in Progress (Tuesday, September, 6:36:03 PM CEST) ................................................................................. 81% Done.install successfullinking in Progress (Tuesday, September, 6:36:08 PM CEST). 82% Done.link Successfulsetup in Progress (Tuesday, September 30, 201 4 6:36:47 PM CEST) ..... 100% Done.setup successfulsaving Inventory (Tuesday, September, 6:36:48 PM CEST) Saving inventory Completeconfigura tion in Progress (Tuesday, September, 6:37:08 PM CEST) Configuration completeend of install phases. (Tuesday, September, 6:37:09 PM CEST) Warning:the following configuration scripts need to be executed as the "root" user./u01/app/oracle/product/12.1.0.1/db_1/Root.shto Execute the configuration scripts:1. Open a terminal window 2. Log in as "root" 3. Run the scriptsthe cloning of OraHome1 was successful. Please check the '/u01/app/orainventory/logs/cloneactions2014-09-30_06-35-53pm.log ' for more details.
You can see that OUI have linked again the binaries and executables and run some configuration steps.
You need to run root.sh:
# iduid=0 (root) gid=0 (root) groups=0 (root) #/u01/app/oracle/product/12.1.0.1/db_1/ root.shcheck/u01/app/oracle/product/12.1.0.1/db_1/install/root_ol6twsf_ 2014-09-30_18-38-46.log for the output of root script# cat/u01/app/oracle/product/12.1.0.1/db_1/install/root_ol6twsf_ 2014-09-30_18-38-46.logperforming Root user operation for Oracle 12cThe following environment variables is set As:ora cle_owner= Oracle oracle_home=/u01/app/oracle/product/12.1.0.1/db_1 Copying dbhome to/usr/local/bin ... Copying oraenv To/usr/local/bin ... Copying coraenv To/usr/local/bin ... Entries'll be added to The/etc/oratab file as needed bydatabase Configuration Assistant when a database is Createdfinis Hed running generic part of root script. Now product-specific root actions would be performed.
Modify /etc/oratab for existing database which is using the Oracle Home it has been moved (because this Have not been do by OUI):
$ tail-1/etc/oratabcdb12c:/u01/app/oracle/product/12.1.0.1/db_1:n$
Reset Current Environment:
$ . Oraenvoracle_sid = [cdb12c]? The Oracle base remains unchanged with value/u01/app/oracle$
Check Oracle Inventory:
$ $ORACLE _home/opatch/opatch lsinv-alloracle Interim Patch Installer version 12.1.0.1.0Copyright (c), ORACLE Corpora tion. All rights reserved. Oracle Home:/u01/app/oracle/product/12.1.0.1/db_1central Inventory:/u01/app/orainventory from:/u01 /app/oracle/product/12.1.0.1/db_1/orainst.locopatch Version:12.1.0.1.0oui version:12.1.0.1.0log file location :/u01/app/oracle/product/12.1.0.1/db_1/cfgtoollogs/opatch/opatch2014-09-30_18-40-48pm_1.loglsinventory Output File Location:/u01/app/oracle/product/12.1.0.1/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-09-30_ 18-40-48pm.txt--------------------------------------------------------------------------------List of Oracle Homes:name location Oradb12home1/u01/app/oracle/product/12.1.0/db_1 Orahome1/u01/app/orac Le/product/12.1.0.1/db_1installed top-level products (1): Oracle Database 12c 12.1.0.1.0There is 1 products installed in this Oracle Home.there is no interim patches installed in this Oracle Hom E.--------------------------------------------------------------------------------Opatch succeeded.$
Noe that, the old Oracle home was still registered and that the new Oracle home have been added by the cloning step.
Step 3:remove the old Oracle Home from Oracle Inventory
Need to use OUI and give old Oracle Home name as oracle_home parameter with-detachhome option:
$ $ORACLE _home/oui/bin/runinstaller-silent-detachhome oracle_home=/u01/app/oracle/product/12.1.0/db_1- waitforcompletionstarting Oracle Universal Installer ... Checking swap space:must be greater than MB. Actual 4027 MB passedthe inventory pointer is located at/etc/orainst.loc ' detachhome ' was successful.$
Check that the old Oracle Home have been removed from Oracle Inventory:
$ $ORACLE _home/opatch/opatch lsinv-alloracle Interim Patch Installer version 12.1.0.1.0Copyright (c), ORACLE Corpora tion. All rights reserved. Oracle Home:/u01/app/oracle/product/12.1.0.1/db_1central Inventory:/u01/app/orainventory from:/u01 /app/oracle/product/12.1.0.1/db_1/orainst.locopatch Version:12.1.0.1.0oui version:12.1.0.1.0log file location :/u01/app/oracle/product/12.1.0.1/db_1/cfgtoollogs/opatch/opatch2014-09-30_18-44-19pm_1.loglsinventory Output File Location:/u01/app/oracle/product/12.1.0.1/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-09-30_ 18-44-19pm.txt--------------------------------------------------------------------------------List of Oracle Homes:name orahome1/u01/app/oracle/product/12.1.0.1/db_1installed top-level products (1): Or Acle Database 12c 12.1.0.1.0There is 1 products installed in this Oracle Home.there is no interim patches installed in this Oracle Home.--------------------------------------------------------------------------------Opatch succeeded.$
At this step the Oracle Home renaming have been completed and you need to restart database instance (s) and Oracle Net Liste NER (s) and to check this everything is OK:
$ sqlplus/as sysdbasql*plus:release 12.1.0.1.0 Production on Tue Sep 18:44:40 2014Copyright (c) 1982, oracle.< C0/>all rights reserved. Connected to an idle instance. [Email protected]>startuporacle instance started. Total System Global area 1035534336 bytesfixed size 2296184 bytesvariable size 402654856 bytesdatabase buffers< c3/>624951296 Bytesredo buffers 5632000 bytesdatabase mounted. Database opened. [email protected]>show parameter spfilename TYPE VALUE------------------------------------------------ -----------------------------spfile string /u01/app/oracle/product/12.1.0 . 1/db_1/dbs/ Spfilecdb12c.ora
Also need to check the scripts run at boot time to start automatically database instance (s) and Oracle Net Listener (s) And to modify them if they is using hard-coded Oracle Home directory name.
About OUI Documentation:i has not been able to find Oracle Universal Installer and Opatch User's Guide in 12.1 datab ASE documentation but you can find OUI User's Guide there.
How to rename or modify Oracle_home