很多時候,由於網絡環境的變化需要修改子網掩碼,本文將介紹在Oracle10G RAC環境下修改子網掩碼。
修改前後子網掩碼列表:
主機名
修改前子網掩碼
修改後子網掩碼
Node1
255.255.255.0
255.255.254.0
Node2
在2個節點做同樣操作,把2個實例都關閉
[oracle@node2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Dec 22 23:03:19 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
sSQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@node2 ~]$ srvctl stop nodeapps -n NODE1
[oracle@node2 ~]$ srvctl stop nodeapps -n NODE2
必須確保該節點的所有資源都已停止
[oracle@node2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....e1.inst application OFFLINE OFFLINE
ora....e2.inst application OFFLINE OFFLINE
ora.dave.db application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....E1.lsnr application OFFLINE OFFLINE
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application OFFLINE OFFLINE
ora.node1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....E2.lsnr application OFFLINE OFFLINE
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application OFFLINE OFFLINE
ora.node2.vip application OFFLINE OFFLINE
2個節點都需要修改
原ifcfg-eth0信息如下:
[root@node2 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82540EM Gigabit Ethernet Controller
HWADDR=08:00:27:bc:36:49
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.15.255
IPADDR=192.168.15.20
NETMASK=255.255.255.0
NETWORK=192.168.15.0
ONBOOT=yes
修改為:
[root@node2 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82540EM Gigabit Ethernet Controller
HWADDR=08:00:27:bc:36:49
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.15.255
IPADDR=192.168.15.20
NETMASK=255.255.254.0
NETWORK=192.168.15.0
ONBOOT=yes
修改完成之後重啟網卡
[root@node1 ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0
[ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1: [ OK ]
查看網絡信息,子網掩碼為修改後的255.255.254.0
[root@node1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:DF:34:C4
inet addr:192.168.15.10 Bcast:192.168.15.255 Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:197 errors:0 dropped:0 overruns:0 frame:0
TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:21983 (21.4 KiB) TX bytes:10650 (10.4 KiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:C2:B7:07
inet addr:10.10.10.1 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:167565 errors:0 dropped:0 overruns:0 frame:0
TX packets:184108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:110808826 (105.6 MiB) TX bytes:129047139 (123.0 MiB)
只需要在一個節點執行,且必須以root用戶
[root@node1 ~]# cd /u01/ora10g/10.2.0/db_1/bin/
[root@node1bin]# ./srvctl modify nodeapps -n node1 -A 192.168.15.11/255.255.254.0/eth0 -o /u01/ora10g/10.2.0/db_2
[root@node1bin]#./srvctl modify nodeapps -n node2 -A 192.168.15.22/255.255.254.0/eth0 -o /u01/ora10g/10.2.0/db_2
重啟crs:
[root@node1 bin]# ./crs_start –all
檢查狀態:
所有資源狀態為Online,一切正常。
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....e1.inst application ONLINE ONLINE node1
ora....e2.inst application ONLINE ONLINE node2
ora.dave.db application ONLINE ONLINE node2
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
至此,子網掩碼修改完成。