NOTE – You can follow this method for deinstall and reinstall of  grid infrastructure without losing your database data(asm disk data)

 

Changing the cluster_name in ORACLE RAC means grid infrastructure need to be reconfigured( which is a complex activity). You will need downtime to do this activity and you will lose your cluster services, But good thing is you won’t lose your data. The data (ASM DISKS) will be intact. In the below example, We will show you , how to do that.

 

In the below example we will change the cluster_name from clsprd to clsrep.

NODES        = classbtc03(local node), classbtc04 ( remote node)
GRID VERSION = 19C
GRID_HOME    = /gridapp/app/oracle/product/19c/
ORACLE_HOME  = /oracle/app/oracle/product/19.3.0/dbhome_1
CLUSTER_NAME = clsprd
DATABASES    = CLASSREP

1. Check the existing cluster_name:



[root@install]#  /gridapp/app/oracle/product/19c/bin/olsnodes -c
clsprd

2. Notedown cluster  resource details and the config of database and services.




[oracle@classbtc03 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       classbtc03               STABLE
               ONLINE  ONLINE       classbtc04               STABLE
ora.MGMT.GHCHKPT.advm
               OFFLINE OFFLINE      classbtc03               STABLE
               OFFLINE OFFLINE      classbtc04               STABLE
ora.chad
               ONLINE  ONLINE       classbtc03               STABLE
               ONLINE  ONLINE       classbtc04               STABLE
ora.helper
               OFFLINE OFFLINE      classbtc03               STABLE
               OFFLINE OFFLINE      classbtc04               IDLE,STABLE
ora.mgmt.ghchkpt.acfs
               OFFLINE OFFLINE      classbtc03               volume /opt/oracle/r
                                                             hp_images/chkbase is
                                                             unmounted,STABLE
               OFFLINE OFFLINE      classbtc04               STABLE
ora.net1.network
               ONLINE  ONLINE       classbtc03               STABLE
               ONLINE  ONLINE       classbtc04               STABLE
ora.ons
               ONLINE  ONLINE       classbtc03               STABLE
               ONLINE  ONLINE       classbtc04               STABLE
ora.proxy_advm
               OFFLINE OFFLINE      classbtc03               STABLE
               OFFLINE OFFLINE      classbtc04               STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ARCH.dg(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       classbtc04               STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       classbtc03               STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       classbtc03               STABLE
ora.MGMT.dg(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.OCRVD.dg(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.REDOA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.REDOB.dg(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        ONLINE  OFFLINE                               STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               Started,STABLE
      2        ONLINE  ONLINE       classbtc04               Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       classbtc03               STABLE
      2        ONLINE  ONLINE       classbtc04               STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       classbtc03               STABLE
ora.classbtc03.vip
      1        ONLINE  ONLINE       classbtc03               STABLE
ora.classbtc04.vip
      1        ONLINE  ONLINE       classbtc04               STABLE
ora.classrep.db --> This is the database 
      1        ONLINE  ONLINE       classbtc03               Open,HOME=/oracle/ap
                                                             p/oracle/product/19.
                                                             3.0/dbhome_1,STABLE
      2        ONLINE  ONLINE       classbtc04               Open,HOME=/oracle/ap
                                                             p/oracle/product/19.
                                                             3.0/dbhome_1,STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       classbtc03               Open,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       classbtc03               STABLE
ora.rhpserver
      1        OFFLINE OFFLINE                               STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       classbtc04               STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       classbtc03               STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       classbtc03               STABLE
--------------------------------------------------------------------------------

You can see there is only one database present in the cluster i.e classrep(highlighted) . If there any other services like TAF , then you note down the config information. 

[oracle@classbtc03 ~]$ srvctl config database -d classrep
Database unique name: classrep
Database name:
Oracle home: /oracle/app/oracle/product/19.3.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/classrep/PARAMETERFILE/spfile.263.1070311859
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: REDOA,REDOB,DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: dba
Database instances: classrep1,classrep2
Configured nodes: classbtc03,classbtc04
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed




3. Deconfig the remote node:[ as root user ]



[root@classbtc04 install]# /gridapp/app/oracle/product/19c/crs/install/rootcrs.sh  -deconfig -force -verbose
Using configuration parameter file: /gridapp/app/oracle/product/19c/crs/install/crsconfig_params
The log of current session can be found at:
  /gridapp/app/oracle_base/crsdata/classbtc04/crsconfig/crsdeconfig_classbtc04_2021-04-20_06-22-27PM.log
2021/04/20 18:25:26 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.
2021/04/20 18:27:25 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.
2021/04/20 18:27:26 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node

If you have more than 2 nodes, then run the same on other nodes , excluding the local node.

4. Deconfig on local node: [ as root ]



[root@classbtc03 install]# /gridapp/app/oracle/product/19c/crs/install/rootcrs.sh -deconfig -force -verbose -lastnode
Using configuration parameter file: /gridapp/app/oracle/product/19c/crs/install/crsconfig_params
The log of current session can be found at:
  /gridapp/app/oracle_base/crsdata/classbtc03/crsconfig/crsdeconfig_classbtc03_2021-04-20_06-29-45PM.log
2021/04/20 18:29:48 CLSRSC-332: CRS resources for listeners are still configured
CRS-2673: Attempting to stop 'ora.crsd' on 'classbtc03'
CRS-2677: Stop of 'ora.crsd' on 'classbtc03' succeeded
ASM de-configuration trace file location: /gridapp/app/oracle_base/cfgtoollogs/asmca/asmcadc_clean2021-04-20_06-37-11PM.log
ASM Clean Configuration START
ASM Clean Configuration END

ASM instance deleted successfully. Check /gridapp/app/oracle_base/cfgtoollogs/asmca/asmcadc_clean2021-04-20_06-37-11PM.log for details.

2021/04/20 18:40:10 CLSRSC-4006: Removing Oracle Trace File Analyzer (TFA) Collector.
2021/04/20 18:41:58 CLSRSC-4007: Successfully removed Oracle Trace File Analyzer (TFA) Collector.
2021/04/20 18:42:01 CLSRSC-336: Successfully deconfigured Oracle Clusterware stack on this node
2021/04/20 18:42:01 CLSRSC-559: Ensure that the GPnP profile data under the 'gpnp' directory in /gridapp/app/oracle/product/19c is deleted on each node before using the software in the current Grid Infrastructure home for reconfiguration.
[root@classbtc03 install]#


5.Delete the grid_home directory from both nodes:


echo $ORACLE_HOME
/gridapp/app/oracle/product/19c

cd /gridapp/app
rm -rf oracle

6. Change the permission of mount point from root to grid_owner on both nodes:


cd /
chown oracle:oinstall gridapp

6. Remove the crs=true keyword from inventory.xml file from both nodes:


[oracle@classbtc04 gpnp]$ cd /gridapp/app/oraInventory/ContentsXML

[oracle@classbtc04 ContentsXML]$ cat  inventory.xml | grep CRS


Remove the CRS=”true” keyword.



[oracle@classbtc04 ContentsXML]$ cat  inventory.xml | grep CRS


7.remove the entry for grid_home from oratab entry [ both nodes]


cat  /etc/oratab

 

8. Copy the grid software to grid_home location and unzip it.


mkdir -p /gridapp/app/oracle/product/19c/
cp grid_home19c.zip /gridapp/app/oracle/product/19c/
cd  /gridapp/app/oracle/product/19c/
unzip grid_home19c.zip

9. Start the gridsetup installer in GUI mode:[ on local node as oracle user]

./gridSetup.sh

 

 

On the screen, we will use the new cluster_name clsrep 

 

 

 

 

 



ON NODE 1:

[root@classbtc03 ~]# /gridapp/app/oracle/product/19c/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /gridapp/app/oracle/product/19c

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Relinking oracle with rac_on option
Using configuration parameter file: /gridapp/app/oracle/product/19c/crs/install/crsconfig_params
The log of current session can be found at:
  /gridapp/app/oracle_base/crsdata/classbtc03/crsconfig/rootcrs_classbtc03_2021-04-20_07-38-41PM.log
2021/04/20 19:38:51 CLSRSC-594: Executing installation step 1 of 19: 'SetupTFA'.
2021/04/20 19:38:51 CLSRSC-594: Executing installation step 2 of 19: 'ValidateEnv'.
2021/04/20 19:38:51 CLSRSC-363: User ignored prerequisites during installation
2021/04/20 19:38:51 CLSRSC-594: Executing installation step 3 of 19: 'CheckFirstNode'.
2021/04/20 19:38:54 CLSRSC-594: Executing installation step 4 of 19: 'GenSiteGUIDs'.
2021/04/20 19:38:55 CLSRSC-594: Executing installation step 5 of 19: 'SetupOSD'.
2021/04/20 19:38:55 CLSRSC-594: Executing installation step 6 of 19: 'CheckCRSConfig'.
2021/04/20 19:38:55 CLSRSC-594: Executing installation step 7 of 19: 'SetupLocalGPNP'.
2021/04/20 19:39:08 CLSRSC-594: Executing installation step 8 of 19: 'CreateRootCert'.
2021/04/20 19:39:13 CLSRSC-594: Executing installation step 9 of 19: 'ConfigOLR'.
2021/04/20 19:39:18 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2021/04/20 19:39:28 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'.
2021/04/20 19:39:28 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'.
2021/04/20 19:39:34 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'.
2021/04/20 19:39:34 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2021/04/20 19:41:00 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'.
2021/04/20 19:41:07 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'.
2021/04/20 19:43:05 CLSRSC-594: Executing installation step 15 of 19: 


'InstallKA'.
2021/04/20 19:43:11 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'.

ASM has been created and started successfully.

[DBT-30001] Disk groups created successfully. Check /gridapp/app/oracle_base/cfgtoollogs/asmca/asmca-210420PM074341.log for details.

2021/04/20 19:44:42 CLSRSC-482: Running command: '/gridapp/app/oracle/product/19c/bin/ocrconfig -upgrade oracle oinstall'
CRS-4256: Updating the profile
Successful addition of voting disk fc8c0a7f04194f8ebf8e97dd16ab4aec.
Successful addition of voting disk d2e1c1b390e74f5ebf85e1d2a1faad4b.
Successful addition of voting disk 94cd701b38884fd5bfb1cae446950101.
Successfully replaced voting disk group with +OCRVD.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   fc8c0a7f04194f8ebf8e97dd16ab4aec (/dev/oracleasm/disks/OCRVD1) [OCRVD]
 2. ONLINE   d2e1c1b390e74f5ebf85e1d2a1faad4b (/dev/oracleasm/disks/OCRVD2) [OCRVD]
 3. ONLINE   94cd701b38884fd5bfb1cae446950101 (/dev/oracleasm/disks/OCRVD3) [OCRVD]
Located 3 voting disk(s).
2021/04/20 19:46:14 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'.
2021/04/20 19:47:24 CLSRSC-343: Successfully started Oracle Clusterware stack
2021/04/20 19:47:24 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'.



2021/04/20 20:04:02 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'.

[INFO] [DBT-30001] Disk groups created successfully. Check /gridapp/app/oracle_base/cfgtoollogs/asmca/asmca-210420PM080406.log for details.


2021/04/20 20:05:32 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded
[root@classbtc03 ~]#
[root@classbtc03 ~]#


ON NODE 2:

[root@classbtc04 oracle]# /gridapp/app/oracle/product/19c/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /gridapp/app/oracle/product/19c

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Relinking oracle with rac_on option
Using configuration parameter file: /gridapp/app/oracle/product/19c/crs/install/crsconfig_params
The log of current session can be found at:
  /gridapp/app/oracle_base/crsdata/classbtc04/crsconfig/rootcrs_classbtc04_2021-04-20_08-06-20PM.log
2021/04/20 20:06:25 CLSRSC-594: Executing installation step 1 of 19: 'SetupTFA'.
2021/04/20 20:06:25 CLSRSC-594: Executing installation step 2 of 19: 'ValidateEnv'.
2021/04/20 20:06:25 CLSRSC-363: User ignored prerequisites during installation
2021/04/20 20:06:25 CLSRSC-594: Executing installation step 3 of 19: 'CheckFirstNode'.
2021/04/20 20:06:26 CLSRSC-594: Executing installation step 4 of 19: 'GenSiteGUIDs'.
2021/04/20 20:06:26 CLSRSC-594: Executing installation step 5 of 19: 'SetupOSD'.
2021/04/20 20:06:27 CLSRSC-594: Executing installation step 6 of 19: 'CheckCRSConfig'.
2021/04/20 20:06:27 CLSRSC-594: Executing installation step 7 of 19: 'SetupLocalGPNP'.
2021/04/20 20:06:28 CLSRSC-594: Executing installation step 8 of 19: 'CreateRootCert'.
2021/04/20 20:06:28 CLSRSC-594: Executing installation step 9 of 19: 'ConfigOLR'.
2021/04/20 20:06:37 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'.
2021/04/20 20:06:37 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'.
2021/04/20 20:06:38 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'.
2021/04/20 20:06:38 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2021/04/20 20:06:52 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2021/04/20 20:07:56 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'.
2021/04/20 20:07:58 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'.
2021/04/20 20:09:46 CLSRSC-594: Executing installation step 15 of 19: 'InstallKA'.
2021/04/20 20:09:48 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'.
2021/04/20 20:09:56 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'.
2021/04/20 20:10:47 CLSRSC-343: Successfully started Oracle Clusterware stack
2021/04/20 20:10:47 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'.
2021/04/20 20:11:01 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'.
2021/04/20 20:11:07 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded


 

 

Now your grid setup is completed.

 

10. Verify the cluster_name:


[root@classbtc04 install]#  /gridapp/app/oracle/product/19c/bin/olsnodes -c
clspre

We can see the cluster_name has been updated as per our requirement.

11. Scan the asm disks on both nodes:[ as root user]


[root]# oracleasm scandisks
[root ~]$ oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DATA0"
Instantiating disk "DATA1"
Instantiating disk "DATA2"
Instantiating disk "ARCH0"
Instantiating disk "ARCH1"
Instantiating disk "REDOA"
Instantiating disk "REDOB"

12.Mount the diskgroups on both nodes:



echo $ORACLE_SID=+ASM1
echo $ORACLE_HOME=/gridapp/app/oracle/product/19c
[oracle@classbtc03]$ asmcmd

ASMCMD> lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304     40952    15960                0           15960              0             N  MGMT/
MOUNTED  NORMAL  N         512             512   4096  4194304     61428    60512            20476           20018              0             Y  OCRVD/

--- This will mount all diskgroups:

ASMCMD > mount -a

ASMCMD> lsdg 
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304    511996   511568                0          511568              0             N  ARCH/
MOUNTED  EXTERN  N         512             512   4096  4194304    511996   508788                0          508788              0             N  DATA/
MOUNTED  EXTERN  N         512             512   4096  4194304     40952    15960                0           15960              0             N  MGMT/
MOUNTED  NORMAL  N         512             512   4096  4194304     61428    60512            20476           20018              0             Y  OCRVD/
MOUNTED  EXTERN  N         512             512   4096  4194304    102396   101412                0          101412              0             N  REDOA/
MOUNTED  EXTERN  N         512             512   4096  4194304    102396   101412                0          101412              0             N  REDOB/

We can see the all diskgroups are intact .

13 .Now register the database in the CRS and start it.



[oracle@classbtc03 dbs]$ srvctl add database -d classrep -oraclehome /oracle/app/oracle/product/19.3.0/dbhome_1
[oracle@classbtc03 dbs]$ srvctl add instance -d classrep -i classrep1 -node classbtc03
[oracle@classbtc03 dbs]$ srvctl add instance -d classrep -i classrep2 -node classbtc04
[oracle@classbtc03 dbs]$ srvctl modify database -db classrep -spfile '+DATA/classrep/PARAMETERFILE/spfile.263.1070311859'

[oracle@classbtc03 dbs]$ srvctl config database -d classrep
[oracle@classbtc03 dbs]$ srvctl start database -db classrep

14.Connect the the database and verify details:



SQL> select name,open_mode from gv$database;

NAME      OPEN_MODE
--------- --------------------
classrep   READ WRITE
classrep   READ WRITE

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/classrep/DATAFILE/system.257.1070310095
+DATA/classrep/DATAFILE/sysaux.258.1070310097
+DATA/classrep/DATAFILE/undotbs1.259.1070310099
+DATA/classrep/DATAFILE/undotbs2.261.1070310105
+DATA/classrep/DATAFILE/users.262.1070310105

SQL>

Our data is fine and we have successfully renamed the cluster_name, though it involved a long tedious process.

NOTE – > If you are doing this on production, make sure you have proper backup of everything like grid binary, database etc. Also, do proper dryrun on testing environment before proceeding to production.  For any doubts/queries you can put in the comment section.