修改 Oracle11g rac 集群私有 IP 的步骤

修改 Oracle11g rac 集群私有 IP 的步骤

1、查看 CRS 服务的状态(两个节点)

在 grid 用户下执行:

# 节点1
[grid@rac1 ~]$ olsnodes -s -n -i
rac1	1	rac1-vip	Active
rac2	2	rac2-vip	Active

# 节点2
[grid@rac2 ~]$ olsnodes -s -n -i
rac1	1	rac1-vip	Active
rac2	2	rac2-vip	Active
2、修改 Private IP 配置信息

在 grid 用户下执行:

(1)如果只修改 Private IP 而不更改私有 IP 对应的网卡设备,使用如下命令:

# 查看 Private IP 的信息
[grid@rac1 ~]$ oifcfg getif
ens34  192.168.1.0  global  public
ens35  172.168.1.0  global  cluster_interconnect

# 添加新的 Private IP
[grid@rac1 ~]$ oifcfg setif -global ens35/10.1.1.0:cluster_interconnect

# 删除旧的 Private IP
[grid@rac1 ~]$ oifcfg delif -global ens35/172.168.1.0

# 查看 Private IP 的信息
[grid@rac1 ~]$ oifcfg getif
ens34  192.168.1.0  global  public
ens35  10.1.1.0  global  cluster_interconnect

(2)如果需要更改私有 IP 对应的网卡设备(把私有网卡由 ens35 修改为 ens36),使用如下命令:

# 查看 Private IP 的信息
[grid@rac1 ~]$ oifcfg getif
ens34  192.168.1.0  global  public
ens35  172.168.1.0  global  cluster_interconnect

# 在新网卡(ens36)上添加新的 Private IP
[grid@rac1 ~]$ oifcfg setif -global ens36/10.1.1.0:cluster_interconnect

# 删除旧的 Private IP
[grid@rac1 ~]$ oifcfg delif -global en35
3、关闭集群

切换到 root 用户:

[root@rac2 ~]# cd /u01/app/11.2.0/grid/bin

[root@rac2 bin]# ./crsctl stop cluster -all
CRS-2673: Attempting to stop 'ora.crsd' on 'rac2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac2'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'rac2'
CRS-2673: Attempting to stop 'ora.hisdb.db' on 'rac2'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac2'
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.rac2.vip' on 'rac2'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2677: Stop of 'ora.hisdb.db' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.BAK.dg' on 'rac2'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac2'
CRS-2677: Stop of 'ora.rac2.vip' on 'rac2' succeeded
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1'
CRS-2673: Attempting to stop 'ora.oc4j' on 'rac1'
CRS-2673: Attempting to stop 'ora.cvu' on 'rac1'
CRS-2673: Attempting to stop 'ora.OCR.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.hisdb.db' on 'rac1'
CRS-2677: Stop of 'ora.BAK.dg' on 'rac2' succeeded
CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac1'
CRS-2677: Stop of 'ora.DATA.dg' on 'rac2' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.rac1.vip' on 'rac1'
CRS-2677: Stop of 'ora.rac1.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.scan1.vip' on 'rac1' succeeded
CRS-2677: Stop of 'ora.OCR.dg' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.cvu' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'rac2'
CRS-2677: Stop of 'ora.ons' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac2'
CRS-2677: Stop of 'ora.net1.network' on 'rac2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac2' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac2'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac2'
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.evmd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac2'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac2'
CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.OCR.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.hisdb.db' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.BAK.dg' on 'rac1'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac1'
CRS-2675: Stop of 'ora.oc4j' on 'rac1' failed
CRS-2679: Attempting to clean 'ora.oc4j' on 'rac1'
CRS-2677: Stop of 'ora.DATA.dg' on 'rac1' succeeded
CRS-2677: Stop of 'ora.BAK.dg' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2681: Clean of 'ora.oc4j' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'rac1'
CRS-2677: Stop of 'ora.ons' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'rac1'
CRS-2677: Stop of 'ora.net1.network' on 'rac1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
4、 修改私有网络物理网卡对应的 IP 地址
# 节点1
[root@rac1 bin]# cd /etc/sysconfig/network-scripts/
[root@rac1 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@rac1 network-scripts]# vi ifcfg-ens36

TYPE=Ethernet
BOOTPROTO=none
PEERDNS=no
NM_CONTROLLED=no
IPV4_FAILURE_FATAL=no

IPADDR=10.1.1.101
PREFIX=24

NAME=ens36
UUID=e035a6c2-77ad-4510-bee5-fe0a06992d51
DEVICE=ens36
ONBOOT=yes


# 重启网络服务
[root@rac1 network-scripts]# systemctl restart network

# 节点2
[root@rac2 bin]# cd /etc/sysconfig/network-scripts/
[root@rac2 network-scripts]# pwd
/etc/sysconfig/network-scripts
[root@rac2 network-scripts]# vi ifcfg-ens36

TYPE=Ethernet
BOOTPROTO=none
PEERDNS=no
NM_CONTROLLED=no
IPV4_FAILURE_FATAL=no

IPADDR=10.1.1.102
PREFIX=24

NAME=ens36
UUID=e035a6c2-77ad-4510-bee5-fe0a06992d51
DEVICE=ens36
ONBOOT=yes

# 重启网络服务
[root@rac2 network-scripts]# systemctl restart network

5、修改 hosts 文件
# 节点1
[root@rac1 network-scripts]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Public Network (bond1)——公用IP

192.168.1.101 rac1
192.168.1.102 rac2

#Private Interconnect (bond2)——私有IP

10.1.1.101 rac1-priv       # 节点1的 private IP
10.1.1.102 rac2-priv       # 节点2的 private IP

#Virtual IP——虚拟 IP,与 bond1 必须在同一网段
192.168.1.111 rac1-vip
192.168.1.112 rac2-vip

#scan IP
192.168.1.221 my-racscan

# 节点2
[root@rac2 network-scripts]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#Public Network (bond1)——公用IP

192.168.1.101 rac1
192.168.1.102 rac2

#Private Interconnect (bond2)——私有IP

10.1.1.101 rac1-priv       # 节点1的 private IP
10.1.1.102 rac2-priv       # 节点2的 private IP

#Virtual IP——虚拟 IP,与 bond1 必须在同一网段
192.168.1.111 rac1-vip
192.168.1.112 rac2-vip

#scan IP
192.168.1.221 my-racscan
6、重新启动集群
[root@rac2 bin]# ./crsctl start cluster -all
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac2'
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1'
CRS-2676: Start of 'ora.cssdmonitor' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac2'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac2'
CRS-2676: Start of 'ora.diskmon' on 'rac2' succeeded
CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'rac1'
CRS-2672: Attempting to start 'ora.diskmon' on 'rac1'
CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded
CRS-2676: Start of 'ora.cssd' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.ctssd' on 'rac2'
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'rac2'
CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.ctssd' on 'rac1'
CRS-2672: Attempting to start 'ora.cluster_interconnect.haip' on 'rac1'
CRS-2676: Start of 'ora.ctssd' on 'rac2' succeeded
CRS-2676: Start of 'ora.ctssd' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.evmd' on 'rac1'
CRS-2676: Start of 'ora.evmd' on 'rac1' succeeded
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'rac2'
CRS-2676: Start of 'ora.cluster_interconnect.haip' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'rac1'
CRS-2676: Start of 'ora.asm' on 'rac2' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'rac2'
CRS-2676: Start of 'ora.crsd' on 'rac2' succeeded
CRS-2676: Start of 'ora.asm' on 'rac1' succeeded
CRS-2672: Attempting to start 'ora.crsd' on 'rac1'
CRS-2676: Start of 'ora.crsd' on 'rac1' succeeded
7、查看监听状态
[grid@rac2 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 11-JUL-2022 13:22:43

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                11-JUL-2022 13:19:00
Uptime                    0 days 0 hr. 3 min. 43 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/11.2.0/grid/log/diag/tnslsnr/rac2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.102)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.112)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "hisdb" has 1 instance(s).
  Instance "hisdb2", status READY, has 1 handler(s) for this service...
Service "hisdbXDB" has 1 instance(s).
  Instance "hisdb2", status READY, has 1 handler(s) for this service...
The command completed successfully
8、查看集群状态
[grid@rac2 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.BAK.dg     ora....up.type ONLINE    ONLINE    rac1        
ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac1        
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1        
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac2        
ora.OCR.dg     ora....up.type ONLINE    ONLINE    rac1        
ora.asm        ora.asm.type   ONLINE    ONLINE    rac1        
ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac2        
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora.hisdb.db   ora....se.type ONLINE    ONLINE    rac1        
ora....network ora....rk.type ONLINE    ONLINE    rac1        
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    rac2        
ora.ons        ora.ons.type   ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    OFFLINE   OFFLINE               
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    OFFLINE   OFFLINE               
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac2        

9、测试
[oracle@rac1 ~]$ sqlplus sys/oracle@192.168.1.221/hisdb as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Jul 11 13:25:29 2022

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> conn scott/tiger;
Connected.
SQL> select * from tab;

TNAME			       TABTYPE	CLUSTERID
------------------------------ ------- ----------
AA			       VIEW
BB			       VIEW
BONUS			   TABLE
CC			       VIEW
COURSE			   TABLE
DEPT			   TABLE
EE			       VIEW
EMP			       TABLE
SALGRADE		   TABLE
SCORE			   TABLE
STUDENT 		   TABLE
TEACHER 		   TABLE

12 rows selected.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

睿思达DBA_WGX

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值