Oracle Restart 12c – How to change Hostname?

Often when i want to test something in a non-production environment i will use a local VM running on my Notebook. In VM Oracle Restart with ASM and a Single Instance Database is installed.  It happens quite often to clone the VM – if you want to run the cloned VM on an new machine (with different hostname) you has to reconfigure the Oracle Grid Infrastructure, since the hostname has a big part in GI configuration.

When you start your VM you still have the old hostname. Before you can start with reconfiguring GI the hostname in OS level must be changed. The files /etc/hostname and /etc/hosts must be changed to the desired value. Afterwards the VM must be restarted.

At the next step you has to deconfigure the GI on the new machine with the different hostname.

Change current directory as root user in /u01/app/12.1.0/grid/crs/install and execute the following command:
[root@hostnew-vm03-local install]$ (12.1-ASM)> ./roothas.pl -deconfig -force
After running the command, you should get the following message:
CLSRSC-336: Successfully deconfigured Oracle clusterware stack on this node

Nex step would be following command:
[root@hostnew-vm03 install]$ (12.1-ASM)> ./rootcrs.pl -deconfig -force -lastnode
Output is the same like before:
CLSRSC-336: Successfully deconfigured Oracle clusterware stack on this node

Afterwards a System Reboot would be perfect.

After this three steps you already have deconfigured the Grid Infrastructure installation. To configure the GI new you have to do the following steps.
Execute root.sh located in /u01/app/11.2.0/grid folder:
[root@hostnew-vm03 grid]$ (12.1-ASM)> ./root.sh
Output for a successfull configuration:
CLSRSC-327: Successfully configured Oracle Grid Infrastructure for a Standalone Server

Subsequently you have to enable the automatic startup for the crs software.
The processes of the CRS (it is “HAS” for single instance) is again controlled by crsctl as it is in the RAC installations. You can use check, start, stop options to manage the processes as usual. A short note: CRS processes in the RAC installation is not installed for the single instance installations. For the single instance installations, there is the HAS processes stands for “High Availability Services” and covers the cssd and diskmon processes.

root@hostnew-vm03 grid]$ (12.1-ASM)> crsctl enable has
CRS-4622: Oracle High Availability Services autostart is enabled.

[root@hostnew-vm03 grid]$ (12.1-ASM)> crsctl start res ora.cssd
CRS-2672: Attempting to start ‘ora.cssd’ on ‘hostnew-vm03’
CRS-2672: Attempting to start ‘ora.diskmon’ on ‘hostnew-vm03’
CRS-2676: Start of ‘ora.diskmon’ on ‘hostnew-vm03’ succeeded
CRS-2676: Start of ‘ora.cssd’ on ‘hostnew-vm03’ succeeded

The Server Control (SRVCTL) utility is installed on each node by default. You can use SRVCTL to start and stop the database and instances, manage configuration information, and to move or remove instances and services. You can also use SRVCTL to add services. With the srvctl command line tool we want to add listener, asm and database as a cluster service.

[root@hostnew-vm03 grid]$ (12.1-ASM)> srvctl add listener
[root@hostnew-vm03 grid]$ (12.1-ASM)> srvctl start listener

Before we have the possibility to add ASM as a service to the clusterware we should get run the ASM instance manually.

[oracle@hostnew-vm03 ~]$ (12.1-ASM)>sqlplus / as sysasm

SQL*Plus: Release 12.1.0.1.0 Production on Fri Sep 13 16:34:01 2013

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

Connected to an idle instance.

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

Total System Global Area 1135747072 bytes
Fixed Size 2297344 bytes
Variable Size 1108283904 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted

So we must look for the ASM Parameterfile – But where can i find it?
The asm_diskstring parameter is not set, so no asm disks can be mounted 😦

SQL> show parameter asm;

NAME                                                               TYPE            VALUE
————————————                           ———–       ——————————
asm_diskgroups string
asm_diskstring string
asm_power_limit integer 1
asm_preferred_read_failure_groups

Set the asm_diskstring parameter with the value of the asm disk location in operating system environment.

SQL> alter system set asm_diskstring=’/dev/disk/by-id/ASM*’ scope=memory;

System altered.

SQL> select name, state from v$asm_diskgroup;

NAME                             STATE
—————————— ———–
ORADATA                      DISMOUNTED

SQL> alter diskgroup ORADATA mount;

Diskgroup altered.

With the asmcmd command line utility we can navigate in the asm diskgroups like we know in unix operating systems.

[oracle@hostnew-vm03 ~]$ (12.1-ASM)> asmcmd
ASMCMD> ls
ORADATA/
ASMCMD> cd ORADATA
ASMCMD> ls
ASM/
KLM121/
ASMCMD> cd ASM
ASMCMD> ls -l
ASMPARAMETERFILE/
PASSWORD/
ASMCMD> cd ASMPARAMETERFILE
ASMCMD> ls
REGISTRY.253.825158103
ASMCMD> pwd
+ORADATA/ASM/ASMPARAMETERFILE
ASMCMD>exit

So we have the location of the ASM parameterfile, the asm disk string and a runninglistener we can add asm instance to the clusterware and start with following statement.

[root@hostnew-vm03 ~]$ (12.1-ASM)> srvctl add asm -l LISTENER -p ‘+ORADATA/ASM/ASMPARAMETERFILE/REGISTRY.253.825158103’ -d ‘/dev/disk/by-id/ASM*’

[root@hostnew-vm03 ~]$ (12.1-ASM)> srvctl start asm

So ASM is successfully running we can add the database instance to the clusterware – we also need the spfile for the instance, this we can find with asmcmd too.

[oracle@hostnew-vm03 ~]$ (12.1-ASM)> asmcmd
ASMCMD> ls
ORADATA/
ASMCMD> cd ORADATA
ASMCMD> ls
ASM/
KLM121/
ASMCMD> cd KLM121
ASMCMD> ls -l
ASMCMD> ls
spfileKLM121.ora
ASMCMD> pwd
+ORADATA/KLM121/
ASMCMD>exit

[oracle@hostnew-vm03 ~]$ (12.1-ASM)>  srvctl add database -d KLM121 -o /u01/app/oracle/product/12.1.0/db_1 -p ‘+ORADATA/KLM121/spfileKLM121.ora’

[oracle@hostnew-vm03 ~]$ (12.1-ASM)> srvctl start database -d KLM121

So the GI, ASM, Listener and Database are successfully running again 🙂

Last but not least i have to say thank you very much to my colleague Martin ( http://www.usn-it.de ) who supported me during all this steps!

Stay tuned!

Regards,
Benedikt

, ,

  1. #1 by sarveswara on 2015/03/03 - 18:30

    Hello
    Would metalink 1552810.1 work as well. I see the steps are similar with few minor differences.

    • #2 by bnahlovsky on 2015/03/04 - 10:27

      Hello,
      so far i didn’t know the metalink note and didn’t test it yet. But i think it should work as well.

      Regards,
      Benedikt

  2. #3 by Marco Giuricin on 2017/09/06 - 13:23

    This worked for but we had to add -init parameter at:

    crsctl start res ora.cssd -init

  3. #4 by Celine Chenoweth   on 2018/01/06 - 20:13

  1. Usn's IT Blog » Oracle 12c: Change hostname for Grid Infrastructure / Oracle restart

Leave a comment