DEV Community

loading...
Cover image for How to move or rename a 19c RAC Database Oracle Home

How to move or rename a 19c RAC Database Oracle Home

project42 profile image Project-42 ・10 min read

When I created my RAC lab, I decided to create my 19c Databases ORACLE_HOME using the name "../19.3.0/dbhome_1" since it was 19.3 version, but of course, after last patching when I updated the system to 19.7, that didn't make much sense.

I tried to follow the document How to move RAC Database ORACLE_HOME from one location to another one (Doc ID 1438719.1) but clone.pl is not longer the best option for 19c

[oracle@rac1-node1 ~]$ perl /u01/app/oracle/product/19.0.0/dbhome_1/clone/bin/clone.pl 

[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 /u01/app/oracle/product/19.0.0/dbhome_1/runInstaller script available to perform the Software Only install. For more details on image based installation, refer to help documentation.

Starting Oracle Universal Installer...
[oracle@rac1-node1 ~]$ 
Enter fullscreen mode Exit fullscreen mode

I found HOW TO CLONE AN ORACLE HOME IN 19C article from René Antunez and decided to follow similar process:

Create Gold image

First, we need to create a gold image from our original db_home (/u01/app/oracle/product/19.3.0/dbhome_1) to the new destination (in my case will be /u01/app/oracle/product/19.0.0) where a Zip file will be created with our gold image.
The advantage of this process, is that we won't need to install any patches already in our source, also, we can just copy this gold image to any other cluster/server so we make sure we have the same versions on both sides

[oracle@rac1-node1 ~]$ mkdir -p /u01/app/oracle/product/19.0.0
[oracle@rac1-node1 ~]$ 

[oracle@rac1-node1 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/19.3.0/dbhome_1
[oracle@rac1-node1 ~]$ 

[oracle@rac1-node1 ~]$ $ORACLE_HOME/runInstaller -silent  -createGoldImage -destinationLocation /u01/app/oracle/product/19.0.0
Launching Oracle Database Setup Wizard...

Successfully Setup Software.
Gold Image location: /u01/app/oracle/product/19.0.0/db_home_2021-04-23_10-09-12AM.zip


[oracle@rac1-node1 ~]$ 
[oracle@rac1-node1 ~]$ ls -lrth /u01/app/oracle/product/19.0.0/
total 4.1G
-rw-r--r-- 1 oracle oinstall 4.1G Apr 23 10:18 db_home_2021-04-23_10-09-12AM.zip
[oracle@rac1-node1 ~]$ 
Enter fullscreen mode Exit fullscreen mode

Install new ORACLE_HOME

Now, we can unzip the gold image into our new ORACLE_HOME

[oracle@rac1-node1 ~]$ unzip -q /u01/app/oracle/product/19.0.0/db_home_2021-04-23_10-09-12AM.zip -d /u01/app/oracle/product/19.0.0/dbhome_1
[oracle@rac1-node1 ~]$ 

[oracle@rac1-node1 ~]$ ls -lrth /u01/app/oracle/product/19.0.0/
total 4.1G
-rw-r--r--  1 oracle oinstall 4.1G Apr 23 10:18 db_home_2021-04-23_10-09-12AM.zip
drwxr-xr-x 73 oracle oinstall 4.0K Apr 23 10:23 dbhome_1
[oracle@rac1-node1 ~]$ 
Enter fullscreen mode Exit fullscreen mode

I really liked how René executed the Oracle Installer, so I just copied it changing my system variables.
Remember to run root.sh script as root in all the nodes once is completed

[oracle@rac1-node1 ~]$ unset ORACLE_HOME ORACLE_SID ORACLE_RSID ORACLE_UNQNAME ORACLE_BASE

[oracle@rac1-node1 ~]$ export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
[oracle@rac1-node1 ~]$ export ORACLE_HOSTNAME=rac1-node1
[oracle@rac1-node1 ~]$ export ORA_INVENTORY=/u01/app/oraInventory
[oracle@rac1-node1 ~]$ export NODE1_HOSTNAME=rac1-node1
[oracle@rac1-node1 ~]$ export NODE2_HOSTNAME=rac1-node2
[oracle@rac1-node1 ~]$ export ORACLE_BASE=/u01/app/oracle
[oracle@rac1-node1 ~]$ 

[oracle@rac1-node1 ~]$ nohup ${ORACLE_HOME}/runInstaller -ignorePrereq -waitforcompletion -silent \
> -responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
> oracle.install.option=INSTALL_DB_SWONLY \
> ORACLE_HOSTNAME=${ORACLE_HOSTNAME} \
> UNIX_GROUP_NAME=oinstall \
> INVENTORY_LOCATION=${ORA_INVENTORY} \
> SELECTED_LANGUAGES=en \
> ORACLE_HOME=${ORACLE_HOME} \
> ORACLE_BASE=${ORACLE_BASE} \
> oracle.install.db.InstallEdition=EE \
> oracle.install.db.OSDBA_GROUP=oinstall \
> oracle.install.db.OSOPER_GROUP=oinstall \
> oracle.install.db.OSBACKUPDBA_GROUP=oinstall \
> oracle.install.db.OSDGDBA_GROUP=oinstall \
> oracle.install.db.OSKMDBA_GROUP=oinstall \
> oracle.install.db.OSRACDBA_GROUP=oinstall \
> oracle.install.db.CLUSTER_NODES=${NODE1_HOSTNAME},${NODE2_HOSTNAME} \
> oracle.install.db.isRACOneInstall=false \
> oracle.install.db.rac.serverpoolCardinality=0 \
> oracle.install.db.config.starterdb.type=GENERAL_PURPOSE \
> oracle.install.db.ConfigureAsContainerDB=false \
> SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
> DECLINE_SECURITY_UPDATES=true &
[1] 25133
[oracle@rac1-node1 ~]$ nohup: ignoring input and appending output to ‘nohup.out’

[oracle@rac1-node1 ~]$ 

[oracle@rac1-node1 ~]$ tail -500f nohup.out
Launching Oracle Database Setup Wizard...

[WARNING] [INS-13014] Target environment does not meet some optional requirements.
   CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oraInventory/logs/InstallActions2021-04-23_10-55-54AM/installActions2021-04-23_10-55-54AM.log
   ACTION: Identify the list of failed prerequisite checks from the log: /u01/app/oraInventory/logs/InstallActions2021-04-23_10-55-54AM/installActions2021-04-23_10-55-54AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
 /u01/app/oracle/product/19.0.0/dbhome_1/install/response/db_2021-04-23_10-55-54AM.rsp

You can find the log of this install session at:
 /u01/app/oraInventory/logs/InstallActions2021-04-23_10-55-54AM/installActions2021-04-23_10-55-54AM.log

As a root user, execute the following script(s):
    1. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh

Execute /u01/app/oracle/product/19.0.0/dbhome_1/root.sh on the following nodes: 
[rac1-node1, rac1-node2]


Successfully Setup Software with warning(s).


[root@rac1-node1 ~]# /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Check /u01/app/oracle/product/19.0.0/dbhome_1/install/root_rac1-node1.raclab.local_2021-04-23_17-54-45-169559582.log for the output of root script

[root@rac1-node2 ~]# /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Check /u01/app/oracle/product/19.0.0/dbhome_1/install/root_rac1-node2.raclab.local_2021-04-23_17-55-00-472505757.log for the output of root script
[root@rac1-node2 ~]# 
Enter fullscreen mode Exit fullscreen mode

Just to confirm, we can see the new db_home in the inventory

[oracle@rac1-node1 ~]$ cat /u01/app/oraInventory/ContentsXML/inventory.xml |grep 19
<!-- Copyright (c) 1999, 2021, Oracle and/or its affiliates.
<HOME NAME="OraDB19Home1" LOC="/u01/app/oracle/product/19.3.0/dbhome_1" TYPE="O" IDX="2"/>
<HOME NAME="OraGI19Home1" LOC="/u01/app/19.3.0/grid" TYPE="O" IDX="1" CRS="true">
<HOME NAME="OraDB19Home2" LOC="/u01/app/oracle/product/19.0.0/dbhome_1" TYPE="O" IDX="8"/>
[oracle@rac1-node1 ~]$ 
Enter fullscreen mode Exit fullscreen mode

Modify Databases Clusterware Configuration

Before we recreate the Clusterware configuration, review the content of your $ORACLE_HOME/dbs folder, since I notice that some of the init files on node2, still had the instance1 names.
Also copy your tnsnames.ora files from the original ORACLE_HOME and modify the oratab config file in all the nodes

[oracle@rac1-node2 ~]$ ls -lrth /u01/app/oracle/product/19.3.0/dbhome_1/dbs/init* /u01/app/oracle/product/19.0.0/dbhome_1/dbs/init*
-rw-r--r-- 1 oracle oinstall 3.1K Oct 19  2019 /u01/app/oracle/product/19.3.0/dbhome_1/dbs/init.ora
-rw-r--r-- 1 oracle oinstall   56 Oct 25  2019 /u01/app/oracle/product/19.3.0/dbhome_1/dbs/initdb192.ora
-rw-r--r-- 1 oracle oinstall   60 Apr 19 15:41 /u01/app/oracle/product/19.3.0/dbhome_1/dbs/initright192.ora
-rw-r--r-- 1 oracle oinstall   48 Apr 23 11:02 /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initcdbst192.ora
-rw-r--r-- 1 oracle oinstall   56 Apr 23 11:02 /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initdb191.ora
-rw-r--r-- 1 oracle oinstall   60 Apr 23 11:02 /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initright191.ora
-rw-r--r-- 1 oracle oinstall 3.1K Apr 23 11:02 /u01/app/oracle/product/19.0.0/dbhome_1/dbs/init.ora
[oracle@rac1-node2 ~]$

[oracle@rac1-node2 ~]$ mv /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initdb191.ora /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initdb192.ora
[oracle@rac1-node2 ~]$ mv /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initright191.ora /u01/app/oracle/product/19.0.0/dbhome_1/dbs/initright192.ora


[oracle@rac1-node1 ~]$ cp -pr /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/tnsnames.ora /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsnames.ora
[oracle@rac1-node1 ~]$ scp -pr /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsnames.ora rac1-node2:/u01/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsnames.ora
tnsnames.ora                                                                                                                100% 1837     1.5MB/s   00:00    
[oracle@rac1-node1 ~]$


[root@rac1-node1 ~]# sed -i 's|/u01/app/oracle/product/19.3.0/dbhome_1|/u01/app/oracle/product/19.0.0/dbhome_1|g' /etc/oratab
[root@rac1-node1 ~]# grep 19 /etc/oratab
# DB 19 #
cdb191:/u01/app/oracle/product/19.0.0/dbhome_1:N
db191:/u01/app/oracle/product/19.0.0/dbhome_1:N
right191:/u01/app/oracle/product/19.0.0/dbhome_1:N      # line added by Agent
[root@rac1-node1 ~]# 

[root@rac1-node2 ~]# sed -i 's|/u01/app/oracle/product/19.3.0/dbhome_1|/u01/app/oracle/product/19.0.0/dbhome_1|g' /etc/oratab 
Enter fullscreen mode Exit fullscreen mode

Let's now modify the different databases using the old ORACLE_HOME so they start using the new ones.
I have 3 Databases using that ORACLE_HOME, so decided to do it with a "for loop" to make things easier

[oracle@rac1-node1 ~]$ for i in {db19,cdb19,rac1_right19}; do srvctl config database -d $i |egrep -i 'Database name|home'; done;
Database name: db19
Oracle home: /u01/app/oracle/product/19.3.0/dbhome_1
Database name: cdb19
Oracle home: /u01/app/oracle/product/19.3.0/dbhome_1
Database name: right19
Oracle home: /u01/app/oracle/product/19.3.0/dbhome_1
[oracle@rac1-node1 ~]$ 

[oracle@rac1-node1 ~]$ for i in {db19,cdb19,rac1_right19}; do srvctl modify database -d $i -oraclehome /u01/app/oracle/product/19.0.0/dbhome_1; done;

[oracle@rac1-node1 ~]$ for i in {db19,cdb19,rac1_right19}; do srvctl config database -d $i |egrep -i 'Database name|home'; done;
Database name: db19
Oracle home: /u01/app/oracle/product/19.0.0/dbhome_1
Database name: cdb19
Oracle home: /u01/app/oracle/product/19.0.0/dbhome_1
Database name: right19
Oracle home: /u01/app/oracle/product/19.0.0/dbhome_1
[oracle@rac1-node1 ~]$ 
Enter fullscreen mode Exit fullscreen mode

Remove Old ORACLE_HOME

To remove the old home, just execute the deinstall command.
The system will ask couple of questions to proceed with the process:

[oracle@rac1-node1 ~]$ export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1

[oracle@rac1-node1 ~]$ /u01/app/oracle/product/19.3.0/dbhome_1/deinstall/deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /u01/app/oraInventory/logs/

############ ORACLE DECONFIG TOOL START ############


######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /u01/app/oracle/product/19.3.0/dbhome_1
Oracle Home type selected for deinstall is: Oracle Real Application Cluster Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
Checking for existence of the Oracle Grid Infrastructure home /u01/app/19.3.0/grid
The following nodes are part of this cluster: rac1-node1,rac1-node2
Active Remote Nodes are rac1-node2
Checking for sufficient temp space availability on node(s) : 'rac1-node1,rac1-node2'

## [END] Install check configuration ##


Network Configuration check config START

Network de-configuration trace file location: /u01/app/oraInventory/logs/netdc_check2021-04-23_06-17-45PM.log

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /u01/app/oraInventory/logs/databasedc_check2021-04-23_06-17-45PM.log

Use comma as separator when specifying list of values as input

Specify the list of database names that are configured in this Oracle home []: <<<<<< USER INPUT
Database Check Configuration END

######################### DECONFIG CHECK OPERATION END #########################


####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Grid Infrastructure Home is: /u01/app/19.3.0/grid
The following nodes are part of this cluster: rac1-node1,rac1-node2
Active Remote Nodes are rac1-node2
The cluster node(s) on which the Oracle home deinstallation will be performed are:rac1-node1,rac1-node2
Oracle Home selected for deinstall is: /u01/app/oracle/product/19.3.0/dbhome_1
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
Do you want to continue (y - yes, n - no)? [n]: y  <<<<<< USER INPUT

A log of this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2021-04-23_06-17-28-PM.out'
Any error messages from this session will be written to: '/u01/app/oraInventory/logs/deinstall_deconfig2021-04-23_06-17-28-PM.err'

[....]

####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/oracle/product/19.3.0/dbhome_1' from the central inventory on the local node.
Failed to delete directory '/u01/app/oracle/product/19.3.0/dbhome_1' on the local node due to error : Either user has no permission to delete or file is in use.
Review the permissions and manually delete '/u01/app/oracle/product/19.3.0/dbhome_1' on local node.
Successfully detached Oracle home '/u01/app/oracle/product/19.3.0/dbhome_1' from the central inventory on the remote nodes 'rac1-node2'.
Successfully deleted directory '/u01/app/oracle/product/19.3.0/dbhome_1' on the remote nodes 'rac1-node2'.
Oracle Universal Installer cleanup was successful.

Review the permissions and contents of '/u01/app/oracle' on nodes(s) 'rac1-node1,rac1-node2'.
If there are no Oracle home(s) associated with '/u01/app/oracle', manually delete '/u01/app/oracle' and its contents.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################


############# ORACLE DEINSTALL TOOL END #############

[oracle@rac1-node1 ~]$ 
Enter fullscreen mode Exit fullscreen mode

You can now remove the old ORACLE_HOME folders.
Not sure way in my case I needed to do it with root in node1 and was not there already in node2, but I blame myself for that, I vet I didn't follow some process when I did the initial installation

[oracle@rac1-node1 ~]$ cd /u01/app/oracle/product/19.3.0/
[oracle@rac1-node1 19.3.0]$ rmdir dbhome_1/
rmdir: failed to remove ‘dbhome_1/’: Permission denied
[oracle@rac1-node1 19.3.0]$ ls -lrth
total 4.0K
drwxrwxr-x 2 oracle oinstall 4.0K Apr 23 18:18 dbhome_1
[oracle@rac1-node1 19.3.0]$ su -
Password: 
Last login: Fri Apr 23 17:59:33 BST 2021 from rac1-node2.raclab.local on pts/2
[root@rac1-node1 ~]# cd /u01/app/oracle/product/19.3.0/
[root@rac1-node1 19.3.0]# rmdir dbhome_1/
[root@rac1-node1 19.3.0]# cd ..
[root@rac1-node1 product]# rmdir 19.3.0/
[root@rac1-node1 product]# 

[oracle@rac1-node2 ~]$ ls -lrth /u01/app/oracle/product/19.3.0/
ls: cannot access /u01/app/oracle/product/19.3.0/: No such file or directory
[oracle@rac1-node2 ~]$ 
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

Forem Open with the Forem app