How to change IP address in Oracle RAC ?

Let's do the exercise to change the IP address of RAC.

Note that due to the change of the public IP address the virtual IP address (VIP) may be required to change as well as it must remain in the same subnet as the public IP address.

Current Configuration

NetworkHostCurrent IP AddressChanged IP Address
Public IP host1192.168.10.101 192.168.20.121
Public IPhost2192.168.10.100 192.168.20.120
VIPhost1-vip192.168.10.111 192.168.20.111
VIPhost2-vip192.168.10.110 192.168.20.110

Basic Steps
The change of the private IP address is performed in the following basic steps
1) Shut down everything except the CRS stack
2) Change the public interface
3) Modify the VIP address
4) Shut down CRS
5) Modify IP address on OS level and reconfigure /etc/hosts, listener,..
6) Restart

Shutdown Everything Except the CRS Stack
The database and nodeapps (on all nodes) are stopped.
[oracle@host1 ~]$ srvctl stop database -d mydb
[oracle@host1 ~]$ srvctl stop asm -n nodename -s +ASM1
[oracle@host1 ~]$ srvctl stop asm -n nodename -s +ASM2
[oracle@host1 ~]$ srvctl stop nodeapps -n host1

[oracle@host1 ~]$ srvctl stop nodeapps -n host2
After that we verify the status.

[oracle@host1 ~]$ srvctl status database -d mydb
Instance MYDB1 is not running on node host2
Instance MYDB2 is not running on node host1

[oracle@host1 ~]$ srvctl status nodeapps -n host1
VIP is not running on node: host1
GSD is not running on node: host1
Listener is not running on node: host1
ONS daemon is not running on node: host1

[oracle@host1 ~]$ srvctl status nodeapps -n host2
VIP is not running on node: host2
GSD is not running on node: host2
Listener is not running on node: host2
ONS daemon is not running on node: host2
Everything is OK, we can go to the next step.

Change the public interface (if required) and public ip address with the following commands
First let us have a look on the actual status

[oracle@host1 ~]$ oifcfg getif
eth0 192.168.10.0 global public
eth1 192.168.20.0 global cluster_interconnect
We need to change the interface eth0.
As there is no modify command, we will delete and redefine the interface.

[oraclu@host1 ~]$ oifcfg delif -global eth0
[oraclu@host1 ~]$ oifcfg setif -global eth0/192.168.20.0:public

[oracle@host1 ~]$ oifcfg getif
eth0 192.168.20.0 global public
eth1 192.168.20.0 global cluster_interconnect

Modify the VIP Address
As already mentioned, due to the fact that we changed the subnet of the public IP address, we must change the VIP address as well.
The following modify statement should be used.
[root@host1 ~]# /appl/oracle/product/10.2.0/db_1/bin/srvctl modify nodeapps -n host2 -A 192.168.20.110/255.255.255.0/eth0

[root@host1 ~]# /appl/oracle/product/10.2.0/db_1/bin/srvctl modify nodeapps -n host1 -A 192.168.20.111/255.255.255.0/eth0
Note that the root user should be used for this action.
The variable ORACLE_HOHE must be initialised.
Otherwise one of the following errors will be raised.
PRKO-2117 : This command should be executed as the system privilege user.

****ORACLE_HOME environment variable not set!
ORACLE_HOME should be set to the main
directory that contains Oracle products.
Set and export ORACLE_HOME, then re-run.

Shutdown CRS 
The stop command must be performed on all nodes:
crsctl stop crs

Modify the IP address on OS level
Modify the public IP address (eth0). In Centos with application / system setting / network
Perform the change on all nodes.
Modify /etc/hosts and listener.ora files if required.

Let’s have a final look at the status of the RAC.

[oracle@host1 ~]$ srvctl status database -d mydb
Instance MYDB1 is running on node host2
Instance MYDB2 is running on node host1

[oracle@host1 ~]$ srvctl status nodeapps -n host1
VIP is running on node: host1
GSD is running on node: host1
Listener is running on node: host1
ONS daemon is running on node: host1

[oracle@host2 ~]$ srvctl status database -d mydb
Instance MYDB1 is running on node host2
Instance MYDB2 is running on node host1

[oracle@host2 ~]$ srvctl status nodeapps -n host1
VIP is running on node: host1
GSD is running on node: host1
Listener is running on node: host1
ONS daemon is running on node: host1

No comments:

Post a Comment