Disclaimer

Tuesday 20 July 2021

Steps For Changing Public Hostname For A Standalone Grid Infrastructure

Sometimes Hostname can be requested to be changed on where Oracle ASM is installed,  in which case there are steps to be taken on Oracle ASM and HAS ( High Availability Services ). 

Any database which ASM is not installed, you can change the hostname, then reboot and register and open the listener. 

However, when Oracle ASM is installed for database, some configurations are required.

Now let’s explain them step by step below.

If you are planning to change the hostname and ip address of the standalone grid infrastructure ( oracle restart), then we need to do below deconfig and reconfig on the grid setup.

1. Stop the has:-

$GRID_HOME/bin/crsctl stop has


[grid@rac6 ~]$ echo $ORACLE_HOME
/u02/app/18.3.0/grid

[grid@rac6 ~]$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac6'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac6'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac6'
CRS-2677: Stop of 'ora.DATA.dg' on 'rac6' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac6'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac6' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac6' succeeded
CRS-2673: Attempting to stop 'ora.evmd' on 'rac6'
CRS-2677: Stop of 'ora.evmd' on 'rac6' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac6'
CRS-2677: Stop of 'ora.cssd' on 'rac6' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac6' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[grid@rac6 ~]$






2 . Run the deconfig tool ( from root user )

export GRID_HOME=/u02/app/18.3.0/grid

$GRID_HOME/crs/install/roothas.pl -deconfig -force


./roothas.pl: line 8: =head1: command not found


rootcrs.sh/roothas.sh should be used instead of rootcrs.pl/roothas.pl



[root@rac6 install]# ./roothas.sh -verbose -deconfig -force

Using configuration parameter file: /u02/app/18.3.0/grid/crs/install/crsconfig_params

The log of current session can be found at:

  /u02/app/grid/crsdata/rac6/crsconfig/hadeconfig.log

PRCR-1070 : Failed to check if resource ora.asm is registered

CRS-0184 : Cannot communicate with the CRS daemon.

2021/07/19 14:44:22 CLSRSC-180: An error occurred while executing the command '/u02/app/18.3.0/grid/bin/srvctl remove asm -force'

PRCR-1070 : Failed to check if resource ora.ons is registered

CRS-0184 : Cannot communicate with the CRS daemon.

2021/07/19 14:44:23 CLSRSC-180: An error occurred while executing the command '/u02/app/18.3.0/grid/bin/srvctl config ons'

2021/07/19 14:45:44 CLSRSC-337: Successfully deconfigured Oracle Restart stack

[root@rac6 install]#





3. Change hostname in this step:-

1)  /etc/hosts and 

2) /etc/sysconfig/network files


[root@rac6 ~]# cat /etc/hosts

127.0.0.1   localhost

192.168.0.106 rac6.samik.com

[root@rac6 ~]#

[root@rac6 ~]#

[root@rac6 ~]# vi /etc/hosts

[root@rac6 ~]#

[root@rac6 ~]#

[root@rac6 ~]# cat /etc/hosts

127.0.0.1   localhost

192.168.0.108 rac8.samik.com





[root@rac6 ~]# cat /etc/sysconfig/network

# Created by anaconda

NETWORKING=yes

HOSTNAME=rac6.samik.com

[root@rac6 ~]#

[root@rac6 ~]#

[root@rac6 ~]#

[root@rac6 ~]# vi /etc/sysconfig/network

[root@rac6 ~]#

[root@rac6 ~]#

[root@rac6 ~]# cat /etc/sysconfig/network

# Created by anaconda

NETWORKING=yes

HOSTNAME=rac8.samik.com


[oracle@root network-scripts]$ cat ifcfg-ens32
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens32
UUID=f3747baa-7155-4757-9b38-66f32fed29c8
DEVICE=ens32
ONBOOT=yes
IPADDR=192.168.0.106
PREFIX=24
GATEWAY=192.168.0.1
IPV6INIT=no
[oracle@localhost network-scripts]$ vi ifcfg-ens32

[root@localhost network-scripts]# cat ifcfg-ens32
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens32
UUID=f3747baa-7155-4757-9b38-66f32fed29c8
DEVICE=ens32
ONBOOT=yes
IPADDR=192.168.0.108
PREFIX=24
GATEWAY=192.168.0.1
IPV6INIT=no




4. Reboot server and then check Hostname:-

[root@rac8 ~]# hostname
rac8.samik.com
[root@rac8 ~]#
[root@rac8 ~]#
[root@rac8 ~]# cat /etc/hosts
127.0.0.1   localhost
192.168.0.108 rac8.samik.com
[root@rac8 ~]#




5. Set ASM Profile and go to  $ORACLE_HOME/crs/install directory. Execute roothas.sh script and configure High Availability Services again.

[root@rac8 ~]# cd $ORACLE_HOME/crs/install
[root@rac8 install]#
[root@rac8 install]#
[root@rac8 install]#
[root@rac8 install]# ./roothas.sh

Using configuration parameter file: /u02/app/18.3.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u02/app/grid/crsdata/rac8/crsconfig/roothas_2021-07-19_03-26-29PM.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 rac8 successfully pinned.
2021/07/19 15:26:40 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac8'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac8'
CRS-2677: Stop of 'ora.evmd' on 'rac8' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac8' has completed
CRS-4133: Oracle High Availability Services has been stopped.
CRS-4123: Oracle High Availability Services has been started.

rac8     2021/07/19 15:29:11     /u02/app/18.3.0/grid/cdata/rac8/backup_20210719_152911.olr     70732493
2021/07/19 15:29:11 CLSRSC-327: Successfully configured Oracle Restart for a standalone server



[root@rac8 install]# crsctl check has
CRS-4638: Oracle High Availability Services is online






6. Change Auto Start parameter of ora.cssd ( Cluster Syncronization Services Daemon ) as 1 like following.

[root@rac8 install]# crsctl modify resource "ora.cssd" -init -attr "AUTO_START=1"
[root@rac8 install]#




7. Stop and Start 'has' now:-

[root@rac8 install]# crsctl stop has

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac8'

CRS-2673: Attempting to stop 'ora.evmd' on 'rac8'

CRS-2677: Stop of 'ora.evmd' on 'rac8' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac8' has completed

CRS-4133: Oracle High Availability Services has been stopped.





[root@rac8 install]# crsctl start has

CRS-4123: Oracle High Availability Services has been started.





8. Now you can startup Oracle ASM Instance like following.


[grid@rac8 ~]$ sqlplus / as sysasm

SQL*Plus: Release 18.0.0.0.0 - Production on Mon Jul 19 16:11:28 2021
Version 18.3.0.0.0

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

Connected to an idle instance.

SQL>
SQL>
SQL> startup
ORA-00099: warning: no parameter file specified for ASM instance
ASM instance started

Total System Global Area 1136934472 bytes
Fixed Size                  8666696 bytes
Variable Size            1103101952 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted


SQL>
SQL> select instance_name,status from gv$Instance;

INSTANCE_NAME    STATUS
---------------- ------------
+ASM             STARTED

SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
ORCL:DISK1

SQL>
SQL> create spfile from pfile;
create spfile from pfile
*
ERROR at line 1:
ORA-29786: Oracle Restart attribute GET failed with error [Attribute 'SPFILE'
sts[200] lsts[0]]


SQL> shut immediate;
ORA-15100: invalid or missing disk group name


ORA-15100: invalid or missing disk group name


ASM instance shutdown



[grid@rac7 ~]$ cat init+ASM.ora
+ASM.__oracle_base='/u02/app/grid'#ORACLE_BASE set from in memory value
*.asm_power_limit=1
*.large_pool_size=12M
*.remote_login_passwordfile='EXCLUSIVE'


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

Total System Global Area 1136934472 bytes
Fixed Size                  8666696 bytes
Variable Size            1103101952 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

SQL> alter diskgroup DATA MOUNT;

Diskgroup altered.

SQL>
SQL>
SQL> select path from v$asm_disk;

PATH
--------------------------------------------------------------------------------
/dev/oracleasm/disks/DISK1







SQL>
SQL> create spfile from pfile;
create spfile from pfile
*
ERROR at line 1:
ORA-29786: Oracle Restart attribute GET failed with error [Attribute 'SPFILE'
sts[200] lsts[0]]

9. Check asm config details :-

[grid@rac8 ~]$ srvctl config asm
PRCR-1001 : Resource ora.asm does not exist
[grid@rac8 ~]$
[grid@rac8 ~]$

From above error, it means, no ASM resource created that has to communicate with cluster services

10. Add ASM resource using srvctl command as :

[grid@rac8 ~]$ srvctl config asm
PRCR-1001 : Resource ora.asm does not exist
[grid@rac8 ~]$
[grid@rac8 ~]$
[grid@rac8 ~]$
[grid@rac8 ~]$ srvctl add asm
[grid@rac8 ~]$
[grid@rac8 ~]$
[grid@rac8 ~]$ srvctl config asm
ASM home: <CRS home>
Password file:
Backup of Password file:
ASM listener: LISTENER
Spfile:
ASM diskgroup discovery string: ++no-value-at-resource-creation--never-updated-through-ASM++
[grid@rac8 ~]$
[grid@rac8 ~]$
[grid@rac8 ~]$ srvctl status asm
ASM is not running.
[grid@rac8 ~]$
[grid@rac8 ~]$
[grid@rac8 ~]$
[grid@rac8 ~]$ srvctl start asm
[grid@rac8 ~]$
[grid@rac8 ~]$
[grid@rac8 ~]$ srvctl status asm
ASM is running on rac8
[grid@rac8 ~]$



[grid@rac8 ~]$ sqlplus / as sysasm

SQL*Plus: Release 18.0.0.0.0 - Production on Mon Jul 19 20:00:38 2021
Version 18.3.0.0.0

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


Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

SQL>
SQL>
SQL>
SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string
SQL>
SQL>
SQL> create spfile from pfile;
create spfile from pfile
*
ERROR at line 1:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file
'/u02/app/18.3.0/grid/dbs/init+ASM.ora'


SQL> shut immediate;

11. Create pfile from ASM instance and start the instance:-

[grid@rac8 dbs]$ pwd
/u02/app/18.3.0/grid/dbs
[grid@rac8 dbs]$
[grid@rac8 dbs]$
[grid@rac8 dbs]$ cat init+ASM.ora_bkp
*.asm_diskstring='/dev/oracleasm/disks/*'
*.asm_power_limit=1
*.large_pool_size=12M
*.instance_type='asm'
*.remote_login_passwordfile='EXCLUSIVE'
*.asm_diskgroups='DATA'
*.diagnostic_dest='/u02/app/grid'


12. create the spfile from pfile :-


SQL> startup;
ASM instance started

Total System Global Area 1136934472 bytes
Fixed Size                  8666696 bytes
Variable Size            1103101952 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
SQL>
SQL>
SQL>
SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string
SQL>
SQL> !pwd
/u02/app/18.3.0/grid/dbs

SQL> create spfile='+DATA' from pfile='/u02/app/18.3.0/grid/dbs/init+ASM.ora';

File created.

SQL>
SQL> shut immediate;
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown
SQL>
SQL>
SQL> exit





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

SQL*Plus: Release 18.0.0.0.0 - Production on Mon Jul 19 22:11:16 2021
Version 18.3.0.0.0

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

Connected to an idle instance.

SQL>
SQL> startup;
ASM instance started

Total System Global Area 1136934472 bytes
Fixed Size                  8666696 bytes
Variable Size            1103101952 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled





Note:- When you create spfile, please find the below output from asm alert log file-




13. Shutdown ASM instance once again :-


[grid@rac8 dbs]$ sqlplus / as sysasm


SQL*Plus: Release 18.0.0.0.0 - Production on Mon Jul 19 23:46:17 2021

Version 18.3.0.0.0

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

Connected to an idle instance.


SQL> startup;
ASM instance started
Total System Global Area 1136934472 bytes
Fixed Size                  8666696 bytes
Variable Size            1103101952 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled
SQL>
SQL>
SQL> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/ASM/ASMPARAMETERFILE/reg
                                                 istry.253.1078357407





[grid@rac8 ~]$ crsctl status resource -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       rac8                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac8                     STABLE
ora.asm
               ONLINE  ONLINE       rac8                     STABLE
ora.ons
               OFFLINE OFFLINE      rac8                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       rac8                     STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       rac8                     STABLE
--------------------------------------------------------------------------------
[grid@rac8 ~]$





14.  Stop and Start 'has' one more time::-


[grid@rac8 dbs]$ crsctl stop has

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac8'

CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac8'

CRS-2673: Attempting to stop 'ora.evmd' on 'rac8'

CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac8'

CRS-2677: Stop of 'ora.DATA.dg' on 'rac8' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'rac8'

CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac8' succeeded

CRS-2677: Stop of 'ora.evmd' on 'rac8' succeeded

CRS-2677: Stop of 'ora.asm' on 'rac8' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'rac8'

CRS-2677: Stop of 'ora.cssd' on 'rac8' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac8' has completed

CRS-4133: Oracle High Availability Services has been stopped.

[grid@rac8 dbs]$

[grid@rac8 dbs]$

[grid@rac8 dbs]$

[grid@rac8 dbs]$ crsctl start has

CRS-4123: Oracle High Availability Services has been started.


Now our standalone grid infrastructure is back to normal.

No comments:

Post a Comment

100 Oracle DBA Interview Questions and Answers

  Here are 100 tricky interview questions tailored for a Senior Oracle DBA role. These questions span a wide range of topics, including perf...