Oracle HAS setup after Hostname and IP change
On my laptop, I have my virtual machines for oracle ASM and oracle RAC. I cloned one of the ASM single instance virtual machine and changed its hostname and IP address to a new one. After I made the change the database and the asm instance did not start. I learned that I had to reconfigure the Oracle High Availability Services. It is true even if you have a stand alone installation. lets see how it works…
How to Reconfigure Oracle Restart [ID 986740.1]
BEFORE the change of hostname and IP
[oracle@rhel5 ~]$ srvctl config asm
ASM home: /oracle/app/oracle/product/11.2.0/grid
ASM listener: LISTENER
Spfile: /oracle/app/oracle/product/11.2.0/grid/dbs/spfile+ASM.ora
ASM diskgroup discovery string:
[oracle@rhel5 ~]$ srvctl config listener
Name: LISTENER
Home: /oracle/app/oracle/product/11.2.0/grid
End points: TCP:1521
[oracle@rhel5 ~]$ srvctl config database
TEST11G
[oracle@rhel5 ~]$ srvctl config database -d TEST11G
Database unique name: TEST11G
Database name: TEST11G
Oracle home: /oracle/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/TEST11G/spfileTEST11G.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: TEST11G
Disk Groups: DATA,FRA
Services:
MAKE the change of hostname and IP
You can chenge the IP and the hostname for a server using the command gui system-config-network. Also change the /etc/hosts file for the new IP and hostname.
old IP : 192.168.254.128 ----------new IP : 192.168.254.129
old hostname : rhel5 ----------new hostname : stndby
After we reboot the server, we see that HAS features are not functioning properly. High availabilty services has to be reconfigured.
[oracle@stndby ~]$ crsctl check has
CRS-4639: Could not contact Oracle High Availability Services
[oracle@stndby ~]$ srvctl start asm
PRCR-1070 : Failed to check if resource ora.asm is registered
Cannot communicate with crsd
Reconfigure HAS
Goto $GRID_HOME/crs/install directory and run the roothas.pl script for deconfiguration. It has to be run by the root user.
Goto $GRID_HOME/crs/install directory and run the roothas.pl script for deconfiguration. It has to be run by the root user.
[root@stndby install]# ./roothas.pl -deconfig -force
Using configuration parameter file: ./crsconfig_params
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Delete failed, or completed with errors.
CLSU-00100: Operating System function: opendir failed with error data: 2
CLSU-00101: Operating System error message: No such file or directory
CLSU-00103: error location: scrsearch1
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4544: Unable to connect to OHAS
CRS-4000: Command Stop failed, or completed with errors.
Successfully deconfigured Oracle Restart stack
Goto $GRID_HOME/crs/install directory and run the roothas.pl script for reconfiguration. It has to be run by the root user.
[root@stndby install]# ./roothas.pl
Using configuration parameter file: ./crsconfig_params
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'dba'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node stndby successfully pinned.
Adding Clusterware entries to inittab
stndby 2013/01/31 04:07:34 /oracle/app/oracle/product/11.2.0/grid/cdata/stndby/backup_20130131_040734.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
Now lets check the configuration. As you can see, has has been enabled but the resources are not started, ASM and database are not registered as a resource.
[oracle@stndby ~]$ . .grid_env
[oracle@stndby ~]$ crsctl config has
CRS-4622: Oracle High Availability Services autostart is enabled.
[oracle@stndby ~]$ crs_stat
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.ons
TYPE=ora.ons.type
TARGET=OFFLINE
STATE=OFFLINE
Register and start the resources
[oracle@stndby ~]$ crsctl start resource "ora.cssd"
CRS-2672: Attempting to start 'ora.cssd' on 'stndby'
CRS-2672: Attempting to start 'ora.diskmon' on 'stndby'
CRS-2676: Start of 'ora.diskmon' on 'stndby' succeeded
CRS-2676: Start of 'ora.cssd' on 'stndby' succeeded
[oracle@stndby ~]$ crs_stat
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.ons
TYPE=ora.ons.type
TARGET=OFFLINE
STATE=OFFLINE
lets add the listener as a resource but before we do that we need to change the listening IP of the listener.
before :
after
[oracle@stndby ~]$ cat /oracle/app/oracle/product/11.2.0/grid/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rhel5)(PORT = 1521))
)
)
after
[oracle@stndby ~]$ cat /oracle/app/oracle/product/11.2.0/grid/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = stndby)(PORT = 1521))
)
)
now we can add the listener as a resource and after that we can start it
[oracle@stndby ~]$ srvctl add listener -l LISTENER
[oracle@stndby ~]$ srvctl start listener
[oracle@stndby ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): stndby
[oracle@stndby ~]$ crs_stat ora.LISTENER.lsnr
NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on stndby
now we can add the asm we do not need to create spfile for asm. we can use the one before.
[oracle@stndby ~]$ srvctl add asm -l LISTENER -p "/oracle/app/oracle/product/11.2.0/grid/dbs/spfile+ASM.ora"
[oracle@stndby ~]$ srvctl start asm
[oracle@stndby ~]$ srvctl status asm
ASM is running on stndby
Finally we can add or database TEST11G
[oracle@stndby ~]$ srvctl add database -d TEST11G -o /oracle/app/oracle/product/11.2.0/dbhome_1 -p +DATA/TEST11G/spfileTEST11G.ora -r PRIMARY -s open -t immediate -a "DATA,FRA"
[oracle@stndby ~]$ srvctl start database -d TEST11G
[oracle@stndby ~]$ srvctl status database -d TEST11G
Database is running.
After the addition of all resources
[oracle@stndby ~]$ crs_stat
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.FRA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on stndby
NAME=ora.ons
TYPE=ora.ons.type
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.test11g.db
TYPE=ora.database.type
TARGET=ONLINE
STATE=ONLINE on stndby