How to change hostname in ORACLE ASM

Pre-Tasks

If you root then execute su – oracle
Then > . oraenv
Write down: +ASM
Before start with the Oracle Restart process you must stop the listener:
[oracle@DB ~]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    DB 
ora.FRA.dg     ora....up.type ONLINE    ONLINE    DB 
ora....ER.lsnr ora....er.type ONLINE    ONLINE    DB
ora.asm        ora.asm.type   ONLINE    ONLINE    DB
ora....stro.db ora....se.type OFFLINE   OFFLINE               
ora.cssd       ora.cssd.type  ONLINE    ONLINE    DB
ora.db11g.db   ora....se.type ONLINE    OFFLINE               
ora.diskmon    ora....on.type ONLINE    ONLINE    DB
[oracle@DB ~]# lsnrctl stop listener

LSNRCTL for Linux: Version 19.3.0.0.0 - Production on 09-MAG-2019 22:44:16

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[oracle@DB ~]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    DB
ora.FRA.dg     ora....up.type ONLINE    ONLINE    DB
ora....ER.lsnr ora....er.type OFFLINE   OFFLINE               
ora.asm        ora.asm.type   ONLINE    ONLINE    DB
ora....stro.db ora....se.type OFFLINE   OFFLINE               
ora.cssd       ora.cssd.type  ONLINE    ONLINE    DB
ora.db11g.db   ora....se.type ONLINE    OFFLINE               
ora.diskmon    ora....on.type ONLINE    ONLINE    DB

Remove Configuration

Remove the existing configuration calling Oracle Restart as root (with ORACLE_HOME set to the grid home), set GRID environment:
[oracle@DB ~]# echo $ORACLE_HOME copy to clipboard
[oracle@DB ~]# echo $ORACLE_SID
[root@DB ~]# export ORACLE_HOME= from upper
[root@DB ~]# export ORACLE_SID=+ASM
[root@DB ~]# $ORACLE_HOME/perl/bin/perl -I $ORACLE_HOME/perl/lib -I $ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/roothas.pl -deconfig
2013-04-17 22:44:26: Checking for super user privileges
2013-04-17 22:44:26: User has super user privileges
2013-04-17 22:44:26: Parsing the host name
Using configuration parameter file: /u01/app/19.3.0.0/grid/crs/install/crsconfig_params
CRS resources for listeners are still configured
CRS-2529: Unable to act on 'ora.cssd' because that would require stopping or relocating 'ora.asm', but the force option was not specified
CRS-4000: Command Stop failed, or completed with errors.
CRS-2586: Deletion of a running resource 'ora.cssd' requires the force option
CRS-4000: Command Delete failed, or completed with errors.
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'DB'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'DB'
CRS-2673: Attempting to stop 'ora.FRA.dg' on 'DB'
CRS-2677: Stop of 'ora.DATA.dg' on 'DB' succeeded
CRS-2677: Stop of 'ora.FRA.dg' on 'DB' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'DB'
CRS-2677: Stop of 'ora.asm' on 'DB' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'DB'
CRS-2677: Stop of 'ora.cssd' on 'DB' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'DB'
CRS-2677: Stop of 'ora.diskmon' on 'DB' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'DB' has completed
CRS-4133: Oracle High Availability Services has been stopped.

Successfully deconfigured Oracle Restart stack

Change Hostname

It’s the moment to change the hostname of your Server

/etc/sysconfig/network

Edit this file and set the new name
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=DB-TEST-NEW

or use nmtui tool

/etc/hosts

Update /etc/hosts as appropriate
vim /etc/hosts
127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4
::1          localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.50.4    DB-TEST-NEW DB-TEST-NEW.local.lan

ifcfg-ethX

Change the IP address. Copy first file to .bak
[root@DB ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE="eth0"
HWADDR="00:1F:4C:02:B3:03"
ONBOOT="yes"
IPADDR=192.168.100.10
NETMASK=255.255.255.0
GATEWAY=192.168.100.1

listener.ora

Change the hostname in the listener configuration file. Copy file first to .bak
cat $ORACLE_HOME/network/admin/listener.ora

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

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = DB-TEST-NEW.local.lan)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/grid

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent
Reboot to pickup the changes

Recreate the Configuration

After change the HOSTNAME and Restart the configuration is the moment to re-configure your Grid and Oracle installations.

GRID

Call Oracle Restart as root (with ORACLE_HOME set to the grid home) to configure your GRID installation, set GRID environment:
[root@DB ~]# export ORACLE_HOME= from upper
[root@DB ~]# export ORACLE_SID=+ASM
[root@DB-DES ~]# $ORACLE_HOME/perl/bin/perl -I $ORACLE_HOME/perl/lib -I $ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/roothas.pl
2019-05-17 22:48:56: Checking for super user privileges
2019-05-17 22:48:56: User has super user privileges
2019-05-17 22:48:56: Parsing the host name
Using configuration parameter file: /u01/app/19.3.0.0/grid/crs/install/crsconfig_params
LOCAL ADD MODE 
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
CRS-4664: Node DB-DES successfully pinned.
Adding daemon to inittab
CRS-4123: Oracle High Availability Services has been started.
ohasd is starting

DB-DES     2013/04/17 22:49:15     /u01/app/19.3.0.0/grid/cdata/basedatosregistro-des/backup_20130417_224915.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

Listener,ASM,DB,Services

Exit from root user and log-on as oracle or su – oracle (with ORACLE_HOME set to the grid home) add the listener, ASM, database and services into the Oracle Restart configuration.
[oracle@DB-TEST-NEW ~]$ . oraenv
+ASM

LISTENER

Add the listener and start it
[oracle@DB-TEST-NEW ~]$ srvctl add listener
[oracle@DB-TEST-NEW ~]$ srvctl start listener

ASM diskgroups

The ASM diskgroups (+DATA & +FRA) are not automatically added back to the Oracle Restart configuration add the candidate disks and start ASM:
[oracle@DB-TEST-NEW ~]$ srvctl add asm -d '/dev/sd[a-h]1'
[oracle@DDB-TEST-NEW ~]$ srvctl start asm
As you can see no diskgroups are added
[oracle@DB-TEST-NEW ~]$ asmcmd lsdg
You must add it manually:
[oracle@DB-TEST-NEW ~]$ sqlplus /nolog
SQL> conn / as sysasm
SQL> alter diskgroup data mount;
SQL> alter diskgroup fra mount;
SQL> exit
– If this doeasn’t work, run from GUI asmca and find candidate
/dev/oracleasm/disks/* and mount
If you don’t see disk groups:
[oracle@DB-TEST-NEW ~]$ oracleasm deletedisk DATA1
and run from GUI asmca and find candidate
/dev/oracleasm/disks/* and mount
As shown by the output of srvctl status below, the diskgroup +DATA & +FRA is running on DB-TEST-NEW
[oracle@DB-TEST-NEW ~]$ srvctl status diskgroup -g data
Disk Group data is running on DB-DES

[oracle@DB-DES ~]$ srvctl status diskgroup -g fra
Disk Group fra is running on DB-DES
[oracle@DB-DES ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     30718    27014                0           27014              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     30718    25474                0           25474              0             N  FRA/

Database

Add the database to Oracle Restart, and configure:
[oracle@DB-DES ~]$ srvctl add database -d DB19C -o $ORACLE_HOME -n DB19C -p +DATA/DB-DES/spfileDB19C.ora -a DATA,FRA
[oracle@DB-DES ~]$ srvctl config database -d DB19C
Database unique name: DB19C
Database name: DB19C
Oracle home: /u01/app/19.3.0.0/grid
Oracle user: oracle
Spfile: +DATA/DB-DES/spfileDB19C.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA,FRA
Services:
Finally start your Database:
[oracle@DB-DES ~]$ srvctl start database -d DB19C

Leave a Reply

Your email address will not be published. Required fields are marked *