Monday 4 December 2017

How to move RAC Database ORACLE_HOME from one location to another location

Below are the steps to move the RAC database ORACLE_HOME from one location(filesystem) to another location.

This post for database home only and does not apply to CRS or GI home.

Execute all the following as database user:

Solution 1:

1. Install a new set of RAC binaries with OUI into a new home.
2. Apply all patches that have been installed in the old home, use "opatch lsinventory" to compare the old and new home once all patches are applied.
3. Copy over init{ORACLE_SID}.ora in dbs directory from the old home to the new home on all nodes.
4. Copy over network files (listener.ora, tnsnames.ora, and sqlnet.ora) in network/admin directory from the old home to the new home on all nodes.
5. Shutdown the database with srvctl from the old database home: srvctl stop database -d <dbname>
6. Modify the database resource as with srvctl from the old database home: srvctl modify database -d -o <new-database-home>
7. Start the database with srvctl from the new database home: srvctl start database -d <dbname>


Solution 2: (Clone)

1. Copy existing RAC binaries to a new location and keep the same ownership/permission on any node: cp -rp <old-database-home> <new-database-home>
2. Execute:
$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_2

$ perl $ORACLE_HOME/clone/bin/clone.pl '-O"CLUSTER_NODES={<comma separated listed of hostnames>}"' '-O"LOCAL_NODE=<this host’s hostname>"' ORACLE_BASE=<your ORACLE_BASE> ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME=<your inventory name> '-O-noConfig' "

Refer to: https://docs.oracle.com/cd/E11882_01/rac.112/e41960/clonerac.htm

3. Extend the new home to other nodes: <new-database-home>/oui/bin/addNode.sh
4. Go to Step3 of "Solution 1"