Steps to re-configure Grid Infrastructure

Oracle

Audience
Public
Technology Integrations
Oracle
Source Type
Documentation

In this example scenario, we have a source VM vm-ora-vvol-prod-01 that is hosting a database vvprd01. The objective is to clone a new VM vm-ora-vvol-dev-01 that runs a copy of the database. The cloned VM was created using the instructions provided in Cloning an Oracle Database on VMware Virtual Volumes. The hostname of the cloned VM was not changed as that would break Grid Infrastructure configuration.

The following steps need to be performed on the cloned VM to change the hostname and re-configure Grid Infrastructure so that ASM and the database can be started.

Please note that all the commands in this documents with the exception of the the first one need to be executed on the cloned VM. The command prompt shows the name of the source VM because the hostname on the cloned VM has not been changed yet.

1. Collect information from ASM and database

If ASM on the cloned VM is up and running with the source hostname, then these commands can be run on the cloned VM. If ASM is down, these commands can be run on the source database instead. All we are doing here is collecting some information that will be used in one of the subsequent steps.


[oracle@vm-ora-vvol-prod-01 ~]$ srvctl config asm
ASM home: <CRS home>
Password file: 
Backup of Password file: 
ASM listener: LISTENER
Spfile: +DATA/ASM/ASMPARAMETERFILE/registry.253.1035156397
ASM diskgroup discovery string: /dev/sd*


[oracle@vm-ora-vvol-prod-01 ~]$ srvctl config database -db vvprd01
Database unique name: vvprd01
Database name: vvprd01
Oracle home: /u01/app/oracle/product/18.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/VVPRD01/PARAMETERFILE/spfile.266.1038345579
Password file: 
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: FRA,DATA
Services: 
OSDBA group: 
OSOPER group: 
Database instance: vvprd01

2. Deconfigure the Oracle Restart stack on the target

Login as root and run the following command:


[root@vm-ora-vvol-prod-01 ~]# cd /u01/app/oracle/product/18.0.0/grid/crs/install
[root@vm-ora-vvol-prod-01 install]# ./roothas.sh -deconfig -force
Using configuration parameter file: /u01/app/oracle/product/18.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/oracle/product/18.0.0/grid_base/crsdata/vm-ora-vvol-prod-01/crsconfig/hadeconfig.log
2020/04/22 11:47:10 CLSRSC-332: CRS resources for listeners are still configured
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'vm-ora-vvol-prod-01'
CRS-2673: Attempting to stop 'ora.vvprd01.db' on 'vm-ora-vvol-prod-01'
CRS-2673: Attempting to stop 'ora.evmd' on 'vm-ora-vvol-prod-01'
CRS-2677: Stop of 'ora.evmd' on 'vm-ora-vvol-prod-01' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'vm-ora-vvol-prod-01'
CRS-2677: Stop of 'ora.vvprd01.db' on 'vm-ora-vvol-prod-01' succeeded
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'vm-ora-vvol-prod-01'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'vm-ora-vvol-prod-01'
CRS-2677: Stop of 'ora.FRA.dg' on 'vm-ora-vvol-prod-01' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'vm-ora-vvol-prod-01' succeeded
CRS-2677: Stop of 'ora.cssd' on 'vm-ora-vvol-prod-01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'vm-ora-vvol-prod-01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
2020/04/22 11:49:14 CLSRSC-337: Successfully deconfigured Oracle Restart stack

3. Rename the host

Run the following commands as root to change the host name.


HOSTNAME=vm-ora-vvol-dev-01
HOSTIP=10.21.184.111
echo "$HOSTIP $HOSTNAME" >> /etc/hosts
echo "$HOSTNAME" > /etc/hostname
hostnamectl set-hostname $HOSTNAME --static

4. Reconfigure Restart stack

Run the following commands as root to reconfigure the Restart stack.


[root@vm-ora-vvol-dev-01 install]# ./roothas.sh -verbose
Using configuration parameter file: /u01/app/oracle/product/18.0.0/grid/crs/install/crsconfig_params
2020-04-22 11:51:46:   mkpath (/u01/app/oracle/product/18.0.0/grid_base/crsdata/vm-ora-vvol-dev-01/crsconfig)
2020-04-22 11:51:46: Setting owner (grid:54331) and group (oinstall:54321) on file /u01/app/oracle/product/18.0.0/grid_base/crsdata/vm-ora-vvol-dev-01/crsconfig
2020-04-22 11:51:46: Setting permissions (0775) on file/dir /u01/app/oracle/product/18.0.0/grid_base/crsdata/vm-ora-vvol-dev-01/crsconfig
The log of current session can be found at:
  /u01/app/oracle/product/18.0.0/grid_base/crsdata/vm-ora-vvol-dev-01/crsconfig/roothas_2020-04-22_11-51-46AM.log
LOCAL ADD MODE 
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node vm-ora-vvol-dev-01 successfully pinned.
2020/04/22 11:52:22 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'vm-ora-vvol-dev-01'
CRS-2673: Attempting to stop 'ora.evmd' on 'vm-ora-vvol-dev-01'
CRS-2677: Stop of 'ora.evmd' on 'vm-ora-vvol-dev-01' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'vm-ora-vvol-dev-01' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.

vm-ora-vvol-dev-01     2020/04/22 11:54:18     /u01/app/oracle/product/18.0.0/grid/cdata/vm-ora-vvol-dev-01/backup_20200422_115418.olr     70732493     
2020/04/22 11:54:19 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

5. Set attributes to auto-start services

By default, the following services do not auto-start, so we modify the AUTO_START attribute to enable it. Change directory to GI_HOME/bin and execute the following commands.


[root@vm-ora-prdm-test-03 bin]# ./crsctl modify res ora.cssd -attr "AUTO_START=1" -unsupported
[root@vm-ora-prdm-test-03 bin]# ./crsctl modify res ora.diskmon -attr "AUTO_START=1" -unsupported
      

6. Start the CSSD service.


[root@vm-ora-vvol-dev-01 bin]# ./crsctl start resource ora.cssd -unsupported
CRS-2672: Attempting to start 'ora.cssd' on 'vm-ora-vvol-dev-01'
CRS-2672: Attempting to start 'ora.diskmon' on 'vm-ora-vvol-dev-01'
CRS-2676: Start of 'ora.diskmon' on 'vm-ora-vvol-dev-01' succeeded
CRS-2676: Start of 'ora.cssd' on 'vm-ora-vvol-dev-01' succeeded

7. Update Listener configuration

Login as grid. Update the hostname in $ORACLE_HOME/network/admin/listener.ora


# listener.ora Network Configuration File: /u01/app/oracle/product/18.0.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = vm-ora-vvol-dev-01)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER=ON            # line added by Agent

Add the listener and start it.


[grid@vm-ora-vvol-dev-01 admin]$ srvctl add listener -l listener

[grid@vm-ora-vvol-dev-01 admin]$ srvctl start listener

[grid@vm-ora-vvol-dev-01 admin]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): vm-ora-vvol-dev-01

8. Configure ASM

Login as grid. Execute the following command to configure ASM. This command takes the ASM diskgroup discovery string and spfile path as arguments. The values come from step 1. Note here we have to use the ASM parameter file here.


[grid@vm-ora-vvol-dev-01 admin]$ srvctl add asm -l listener -d "/dev/sd*" -p "+DATA/ASM/ASMPARAMETERFILE/registry.253.1035156397"

[grid@vm-ora-vvol-dev-01 admin]$ srvctl start asm
      

At this point, ASM instance should be up.


[grid@vm-ora-vvol-dev-01 admin]$ srvctl status asm
ASM is running on vm-ora-vvol-dev-01

[grid@vm-ora-vvol-dev-01 admin]$ ps -ef|grep smon
grid     14168 1  0 16:58 ?     00:00:00 asm_smon_+ASM

Check if the disk groups are mounted. If not, mount them.


[grid@vm-ora-vvol-dev-01 admin]$ 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   2097152  2094544                0         2094544              0             N  DATA/
MOUNTED  EXTERN  N         512             512   4096  1048576   1048576  1047875                0         1047875              0             N  FRA/

Check the status of the resources using the following command.


[grid@vm-ora-vvol-dev-01 admin]$ crsctl status resource -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       vm-ora-vvol-dev-01       STABLE
ora.FRA.dg
               ONLINE  ONLINE       vm-ora-vvol-dev-01       STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       vm-ora-vvol-dev-01       STABLE
ora.asm
               ONLINE  ONLINE       vm-ora-vvol-dev-01       Started,STABLE
ora.ons
               OFFLINE OFFLINE      vm-ora-vvol-dev-01       STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       vm-ora-vvol-dev-01       STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       vm-ora-vvol-dev-01       STABLE
--------------------------------------------------------------------------------

9. Configure Database

Once required disk groups are mounted, we can go ahead and register the database. Again, the value for the spfile parameter for the database can be obtained from step 1.


[oracle@vm-ora-vvol-dev-01 ~]$ srvctl add database -db vvprd01 -oraclehome /u01/app/oracle/product/18.0.0/dbhome_1 \
                                -spfile +DATA/VVPRD01/PARAMETERFILE/spfile.266.1038345579
      

10. Start Database

Finally, we can start the database!


[oracle@vm-ora-vvol-dev-01 admin]$ srvctl start database -db vvprd01 
[oracle@vm-ora-vvol-dev-01 admin]$ ps -ef|grep smon
grid     24066     1  0 12:09 ?        00:00:00 asm_smon_+ASM
oracle   26688     1  0 12:35 ?        00:00:00 ora_smon_vvprd01

The database name and DBID is the same as the source. It can be changed using the DBNEWID utility.