Category - RAC

Change Hostname for Oracle Restart 19c

Changin HOSTNAME for Oracle Restart Database 19c
************************************************
** How to change Hostname / IP for a Grid Infrastructure Oracle Restart Standalone Configuration (SIHA) 11.2 and Later (Doc ID 1552810.1)**
==============================================

STEP 1==> Check HAS is down

[root@ace2oraclehost1 ~]#
[root@ace2oraclehost1 ~]# ps -eaf |grep pmon
root      87518  87301  0 18:03 pts/1    00:00:00 grep --color=auto pmon
[root@ace2oraclehost1 ~]# 

STEP 2==> Run deconfig

[root@ace2oraclehost1 ~]# /u01/app/19.0.0/grid/crs/install/roothas.sh -deconfig -force

Using configuration parameter file: /u01/app/19.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/19.0.0/grid_base/crsdata/ace2oraclehost1/crsconfig/hadeconfig.log
PRCR-1070 : Failed to check if resource ora.asm is registered
CRS-5168 : unable to communicate with ohasd
2021/12/23 07:33:55 CLSRSC-180: An error occurred while executing the command '/u01/app/19.0.0/grid/bin/srvctl remove asm -force'
PRCR-1070 : Failed to check if resource ora.ons is registered
CRS-5168 : unable to communicate with ohasd
2021/12/23 07:33:56 CLSRSC-180: An error occurred while executing the command '/u01/app/19.0.0/grid/bin/srvctl config ons'
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
Redirecting to /bin/systemctl restart rsyslog.service
2021/12/23 07:34:20 CLSRSC-337: Successfully deconfigured Oracle Restart stack
[root@ace2oraclehost1 ~]#
[root@ace2oraclehost1 ~]#
[root@ace2oraclehost1 ~]# /u01/app/19.0.0/grid/bin/srvctl remove asm -force
****Unable to retrieve Oracle Clusterware home.
Start Oracle Clusterware stack and try again.
[root@ace2oraclehost1 ~]#
[root@ace2oraclehost1 ~]# 

STEP 3==>  Then the do the hostname change with help of OS Team.
From ace2oraclehost1 to ace2mighost

STEP 4==> Execute roothas.sh

[root@ace2mighost ~]#  /u01/app/19.0.0/grid/crs/install/roothas.sh
Using configuration parameter file: /u01/app/19.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/19.0.0/grid_base/crsdata/ace2mighost/crsconfig/roothas_2021-12-23_08-16-58AM.log
Redirecting to /bin/systemctl restart rsyslog.service
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 ace2mighost successfully pinned.
2021/12/23 08:18:20 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
ace2mighost     2021/12/23 08:24:31     /u01/app/19.0.0/grid_base/crsdata/ace2mighost/olr/backup_20211223_082431.olr     3331580692    
2021/12/23 08:24:32 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
[root@ace2mighost ~]#
[root@ace2mighost ~]#
[root@ace2mighost ~]# 

[TCHIPDLIX0006@ace2mighost ~]$ sudo su - grid
Last login: Thu Dec 23 18:57:07 IST 2021
[grid@ace2mighost ~]$ 

STEP 5==>Enable auto start of cssd

[grid@ace2mighost ~]$ /u01/app/19.0.0/grid/bin/crsctl modify resource "ora.cssd" -init -attr "AUTO_START=1" -unsupported
[grid@ace2mighost ~]$ 

STEP 6==>Stop has

[grid@ace2mighost ~]$ /u01/app/19.0.0/grid/bin/crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'ace2mighost'
CRS-2673: Attempting to stop 'ora.evmd' on 'ace2mighost'
CRS-2677: Stop of 'ora.evmd' on 'ace2mighost' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'ace2mighost' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ /u01/app/19.0.0/grid/bin/crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[grid@ace2mighost ~]$ /u01/app/19.0.0/grid/bin/crsctl check has
CRS-4638: Oracle High Availability Services is online

STEP 7==>Check resource status

[grid@ace2mighost ~]$ /u01/app/19.0.0/grid/bin/crsctl stat resource
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on ace2mighost

NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE

NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on ace2mighost

NAME=ora.ons
TYPE=ora.ons.type
TARGET=OFFLINE
STATE=OFFLINE

[grid@ace2mighost ~]$
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ ps -eaf |grep tns
root         61      2  0 18:20 ?        00:00:00 [netns]
grid      58630  56890  0 18:59 pts/1    00:00:00 grep --color=auto tns
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ 

STEP 8==> ADD listener now

[grid@ace2mighost ~]$ srvctl add listener
[grid@ace2mighost ~]$ ps -eaf |grep tns
root         61      2  0 18:20 ?        00:00:00 [netns]
grid      58662  56890  0 18:59 pts/1    00:00:00 grep --color=auto tns
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ srvctl start listener
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ ps -eaf |grep tns
root         61      2  0 18:20 ?        00:00:00 [netns]
grid      58711      1  1 18:59 ?        00:00:00 /u01/app/19.0.0/grid/bin/tnslsnr LISTENER -no_crs_notify -inherit
grid      58720  56890  0 18:59 pts/1    00:00:00 grep --color=auto tns
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ lsnrctl sattus LISTENER

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 23-DEC-2021 18:59:48

Copyright (c) 1991, 2021, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                23-DEC-2021 08:29:34
Uptime                    0 days 0 hr. 0 min. 13 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/19.0.0/grid_base/diag/tnslsnr/ace2mighost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1521)))
The listener supports no services
The command completed successfully
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ 

STEP 9==> add Asm file and start Asm

[grid@ace2mighost ~]$ cd $ORACLE_HOME/dbs
[grid@ace2mighost dbs]$ ls -lrt
total 12
-rw-r--r--. 1 grid oinstall 3079 May 14  2015 init.ora
-rw-rw----. 1 grid oinstall 1715 Nov 14 14:56 ab_+ASM.dat
-rw-rw----. 1 grid oinstall 1544 Dec 22 11:16 hc_+ASM.dat
[grid@ace2mighost dbs]$
[grid@ace2mighost dbs]$ ls -lrt /dev/oracleasm/disks/*
brw-rw----. 1 grid oinstall 8,  49 Dec 23  2021 /dev/oracleasm/disks/RDATA03
brw-rw----. 1 grid oinstall 8,  33 Dec 23  2021 /dev/oracleasm/disks/RDATA02
brw-rw----. 1 grid oinstall 8,  65 Dec 23  2021 /dev/oracleasm/disks/RDATA01
brw-rw----. 1 grid oinstall 8,  17 Dec 23  2021 /dev/oracleasm/disks/FRA
brw-rw----. 1 grid oinstall 8, 129 Dec 23  2021 /dev/oracleasm/disks/DATA02
brw-rw----. 1 grid oinstall 8,   1 Dec 23  2021 /dev/oracleasm/disks/DATA
[grid@ace2mighost dbs]$
[grid@ace2mighost dbs]$ vi init+ASM.ora
asm_diskgroups=DATA,FRA,RDATA
asm_diskstring= '/dev/oracleasm/disks/*' 
instance_type='asm'
large_pool_size=12M

[grid@ace2mighost dbs]$ /u01/app/19.0.0/grid/bin/srvctl add asm

STEP 10==> Enable auto start of Asm

[grid@ace2mighost dbs]$ /u01/app/19.0.0/grid/bin/crsctl modify resource "ora.asm" -init -attr "AUTO_START=1"  -unsupported
[grid@ace2mighost dbs]$
[grid@ace2mighost dbs]$ echo $ORACLE_SID
+ASM
[grid@ace2mighost dbs]$ 

STEP 11==> Start ASM now

[grid@ace2mighost dbs]$ sqlplus "/as sysasm"

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Dec 23 19:04:08 2021
Version 19.11.0.0.0

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup pfile='init+ASM.ora';
ASM instance started

Total System Global Area 1137173312 bytes
Fixed Size    8905536 bytes
Variable Size 1103101952 bytes
ASM Cache   25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
SQL>
SQL>
SQL> show parameter asm

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups     string DATA, FRA
asm_diskstring     string /dev/oracleasm/disks/*
asm_power_limit      integer 1
asm_preferred_read_failure_groups    string

SQL> create spfile from pfile;

File created.

SQL> show parameter pfile

NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile     string
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[grid@ace2mighost dbs]$ 

[grid@ace2mighost dbs]$ sqlplus "/as sysasm"

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Dec 23 19:07:47 2021
Version 19.11.0.0.0
Copyright (c) 1982, 2020, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0

SQL> create spfile='+DATA'  from pfile;

File created.

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.11.0.0.0
[grid@ace2mighost dbs]$ 

STEP 12==> Modify Asm & Listener

[grid@ace2mighost trace]$ /u01/app/19.0.0/grid/bin/srvctl modify asm  -p "+DATA/ASM/ASMPARAMETERFILE/registry.253.1092078485"
[grid@ace2mighost trace]$ /u01/app/19.0.0/grid/bin/srvctl modify asm  -l LISTENER
[grid@ace2mighost trace]$
[grid@ace2mighost trace]$ 

STEP 13==> Stop HAS now

[grid@ace2mighost trace]$
[grid@ace2mighost trace]$ /u01/app/19.0.0/grid/bin/crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'ace2mighost'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'ace2mighost'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'ace2mighost'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'ace2mighost'
CRS-2677: Stop of 'ora.DATA.dg' on 'ace2mighost' succeeded
CRS-2677: Stop of 'ora.FRA.dg' on 'ace2mighost' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'ace2mighost'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'ace2mighost' succeeded
CRS-2677: Stop of 'ora.asm' on 'ace2mighost' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'ace2mighost'
CRS-2677: Stop of 'ora.evmd' on 'ace2mighost' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'ace2mighost'
CRS-2677: Stop of 'ora.cssd' on 'ace2mighost' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'ace2mighost' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[grid@ace2mighost trace]$ /u01/app/19.0.0/grid/bin/crsctl start has
CRS-4123: Oracle High Availability Services has been started.
[grid@ace2mighost trace]$
[grid@ace2mighost trace]$ 

[grid@ace2mighost trace]$  /u01/app/19.0.0/grid/bin/crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       ace2mighost           STABLE
ora.FRA.dg
               ONLINE  ONLINE       ace2mighost           STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       ace2mighost           STABLE
ora.asm
               ONLINE  ONLINE       ace2mighost           Started,STABLE
ora.ons
               OFFLINE OFFLINE      ace2mighost           STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ace2mighost           STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       ace2mighost           STABLE
--------------------------------------------------------------------------------
[grid@ace2mighost trace]$
[grid@ace2mighost trace]$
[grid@ace2mighost trace]$ 

STEP 14==>  ADD DATABASE TO HAS

[grid@ace2mighost ~]$ srvctl add database -db ncdb -oraclehome /u02/app/product/19.0.0/db_home1 -spfile "+DATA/ncdb/PARAMETERFILE/spfile.266.1075285535" -pwfile "/u02/app/product/19.0.0/db_home1/dbs/orapwncdb" -dbname ncdb -diskgroup FRA,DATA,RDATA

[grid@ace2mighost ~]$ srvctl start database -d ncdb 

[grid@ace2mighost ~]$ /u01/app/19.0.0/grid/bin/crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details      
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       ace2mighost           STABLE
ora.FRA.dg
               ONLINE  ONLINE       ace2mighost           STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       ace2mighost           STABLE
ora.RDATA.dg
               ONLINE  ONLINE       ace2mighost           STABLE
ora.asm
               ONLINE  ONLINE       ace2mighost           Started,STABLE
ora.ons
               OFFLINE OFFLINE      ace2mighost           STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       ace2mighost           STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       ace2mighost           STABLE
ora.ncdb.db
      1        ONLINE  ONLINE       ace2mighost           Open,HOME=/u02/app/p
                                                             roduct/19.0.0/db_hom
                                                             e1,STABLE
--------------------------------------------------------------------------------

STEP 15==>  Modify Listener now

[grid@ace2mighost ~]$ srvctl status listener -l LISTENER
Listener LISTENER is enabled
Listener LISTENER is running on node(s): ace2mighost
[grid@ace2mighost ~]$ srvctl modify listener -l LISTENER -p 1535
[grid@ace2mighost ~]$ srvctl stop listener
[grid@ace2mighost ~]$ srvctl start listener
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$
[grid@ace2mighost ~]$ lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 23-DEC-2021 19:52:25

Copyright (c) 1991, 2021, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                23-DEC-2021 09:21:57
Uptime                    0 days 0 hr. 0 min. 28 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/19.0.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/19.0.0/grid_base/diag/tnslsnr/ace2mighost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.10)(PORT=1535)))
The listener supports no services
The command completed successfully
[grid@ace2mighost ~]$