当前位置: 首页 > news >正文

RAC 修改IP (转)

原文地址: http://blog.chinaunix.net/space.php?uid=7761148&do=blog&id=2044461

今天准备打开我的debian下的oracle 10gR2来做一些java测试, 可是忘记了上次关机以来我的网络以及vmware都做了调整, 竟然无法直接访问. 就想把debian虚拟机使用的ip地址给改改. 主机名及修改前后的ip地址如下:
 
主机名 修改前的ip地址 修改后的ip地址 作用
rac1 192.168.0.181 192.168.1.181 rac1 eth0 native ip
rac2 192.168.0.182 192.168.1.182 rac2 eth0 native ip
rac1-vip 192.168.0.191 192.168.1.191 rac1 vip
rac2-vip 192.168.0.192 192.168.1.192 rac2 vip
rac1-priv 10.10.10.181 10.1.0.181 rac1 eth1 ip interconn
rac2-priv 10.10.10.182 10.1.0.182 rac2 eth1 ip interconn
 
思路如下, 停止所有oracle相关的进程, 然后修改操作系统的ip设置, 修改与oracle相关的ip地址的设定, 启动crs及相关服务.
 
具体操作步骤如下:
 
1 停止oracle相关的所有进程, 包括数据库, asm, node application, crs本身.
 
1.1 查看当前系统上crs运行的状态
 
oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ ./crs_stat
NAME=ora.orcl.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.orcl.orcl1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.orcl.orcl2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac1.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.LISTENER_RAC1.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac2.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.LISTENER_RAC2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
1.2 关闭数据库
 
oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ srvctl stop database -d orcl
 
1.3 关闭asm实例
 
oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ srvctl stop asm -n rac1
oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ srvctl stop asm -n rac2
 
1.4 关闭其他应用程序
 
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl stop nodeapps -n rac1
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl stop nodeapps -n rac2
 
1.5 关闭crs后台进程, 这一操作会在操作系统一级中止运行的crs后台进程, 必须在所有节点上运行.
 
rac1:/u01/app/oracle/product/10.2.0/crs/bin# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
 
2 修改操作系统的ip设置
 
debian的网络配置文件为/etc/network/interfaces和/etc/hosts, 其他linux发行版及unix网络配置文件位置可能并不一样. 以节点rac1为例, 修改前/etc/network/interfaces文件内容为:
 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
# The loopback network interface
auto lo
iface lo inet loopback
 
# The primary network interface
auto eth0 eth1
iface eth0 inet static
address 192.168.0.181
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.106.0.20
 
iface eth1 inet static
address 10.10.10.181
netmask 255.255.255.0
network 10.10.10.0
broadcast 10.10.10.255
 
修改后内容为:
 
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
# The loopback network interface
auto lo
iface lo inet loopback
 
# The primary network interface
auto eth0 eth1
iface eth0 inet static
address 192.168.1.181
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.106.0.20
 
iface eth1 inet static
address 10.1.0.181
netmask 255.255.255.0
network 10.1.0.0
broadcast 10.1.0.255
 
/etc/hosts文件内容为:
 
127.0.0.1 localhost.localdomain localhost
192.168.0.181 rac1
192.168.0.182 rac2
 
192.168.0.191 rac1-vip
192.168.0.192 rac2-vip
 
10.10.10.181 rac1-priv
10.10.10.182 rac2-priv
 
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
 
修改后:
 
127.0.0.1 localhost.localdomain localhost
192.168.1.181 rac1
192.168.1.182 rac2
 
192.168.1.191 rac1-vip
192.168.1.192 rac2-vip
 
10.1.0.181 rac1-priv
10.1.0.182 rac2-priv
 
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
 
集群中所有节点的hosts文件应该保持一致.
 
/etc/network/interfaces和/etc/hosts文件修改后可使用
 
/etc/init.d/networking restart
 
或者重启操作系统使设置生效.
 
3 启动crs, 设置oracle中ip地址相关的设置.
 
3.1 启动crs, 并关闭随crs启动的应用程序
 
rac1:/u01/app/oracle/product/10.2.0/db_1/network/admin# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
 
由于oracle所有应用设置为自动启动, 所以在crs启动时会试图启动所有的服务, 但是在对oracle相关的ip地址进行设置时需要crs处于运行状态而数据库, asm和node application处于停止状态, 所以需要我们参考1.2, 1.3, 1.4的内容关闭数据库, asm和node application.
 
3.2 使用oifcfg修改网卡设置, oifconfig可以被用来设置和查看网卡被oracle使用的方式.
 
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.0.0 global public
eth1 10.10.10.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg setif -global eth0/192.168.1.0:public   oifcfg set if -global eth0/172.17.21.0:public
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg iflist
eth0 192.168.1.0
eth0 192.168.0.0
eth1 10.1.0.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg delif -global eth0/192.168.0.0    oifcfg delif -global eth0/172.21.29.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg iflist
eth0 192.168.1.0
eth1 10.1.0.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.10.10.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./lifcfg setif -global eth1:/10.1.0.0:cluster_interconnect
-bash: ./lifcfg: No such file or directory
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg setif -global eth1:/10.1.0.0:cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.10.10.0 global cluster_interconnect
eth1: 10.1.0.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg setif -global eth1/10.1.0.0:cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.10.10.0 global cluster_interconnect
eth1 10.1.0.0 global cluster_interconnect
eth1: 10.1.0.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg delif -global eth1:
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg delif -global eth1/10.10.10.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.1.0.0 global cluster_interconnect
 
oifcfg iflist会显示当前使用的网卡及其子网设置, 而oifcfg getif -global 则会显示配置文件中的信息.
 
3.3 修改vip地址
 
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl modify nodeapps -n rac1 -A 192.168.1.191/255.255.255.0/eth0    srvctl modify nodeapps -n ccit01rac1 -A 172.17.21.206/255.255.255.0/eth0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl modify nodeapps -n rac2 -A 192.168.1.192/255.255.255.0/eth0    srvctl modify nodeapps -n ccit01rac2 -A 172.17.21.207/255.255.255.0/eth0
 
3.4 设置listener.ora和tnsnames.ora, 检查这些文件中是否有指定原来ip的地方, 修改为更改后的ip地址, 在rac1的配置文件中listener.ora包含了 192.168.0.181我修改成了192.168.1.181, rac2上的 listener.ora也做了相应的修改.
 
3.5 启动node applications, asm, 数据库
 
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start nodeapps -n rac1
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start nodeapps -n rac2
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start asm -n rac2
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start asm -n rac1
rac2:/u01/app/oracle/product/10.2.0/crs/bin#
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start database -d orcl
 
3.6 进入数据库 修改local_listener参数
sqlplus / as sysdba
Alter SYSTEM SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.21.206)(PORT = 1521))' SID = 'ccit011';
Alter SYSTEM SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.21.207)(PORT = 1521))' SID = 'ccit012';
 
 
3.7 来看看我们的成果:
 
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:0D:FE:0F
inet addr:192.168.1.182 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:142242 errors:0 dropped:0 overruns:0 frame.:0
TX packets:140057 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:83167889 (79.3 MiB) TX bytes:87987399 (83.9 MiB)
Interrupt:19 Base address:0x1480
 
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:0D:FE:0F
inet addr:192.168.1.192 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:19 Base address:0x1480
 
eth1 Link encap:Ethernet HWaddr 00:0C:29:0D:FE:19
inet addr:10.1.0.182 Bcast:10.1.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29781 errors:0 dropped:0 overruns:0 frame.:0
TX packets:26710 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19667330 (18.7 MiB) TX bytes:11573375 (11.0 MiB)
Interrupt:16 Base address:0x1800
 
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:21796 errors:0 dropped:0 overruns:0 frame.:0
TX packets:21796 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6238339 (5.9 MiB) TX bytes:6238339 (5.9 MiB)
 
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./crs_stat
NAME=ora.orcl.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.orcl.orcl1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.orcl.orcl2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac1.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.LISTENER_RAC1.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1
 
NAME=ora.rac2.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.LISTENER_RAC2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
NAME=ora.rac2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2
 
rac2:/u01/app/oracle/product/10.2.0/crs/bin# su - oracle
oracle@rac2:~$ lsnrctl stat
 
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-AUG-2006 23:23:47
 
Copyright (c) 1991, 2005, Oracle. All rights reserved.
 
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER_RAC2
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 23-AUG-2006 22:24:44
Uptime 0 days 0 hr. 59 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener_rac2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.192)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.182)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 2 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Instance "orcl2", status READY, has 2 handler(s) for this service...
Service "orclXDB" has 2 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Instance "orcl2", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 2 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Instance "orcl2", status READY, has 2 handler(s) for this service...
The command completed successfully
 
以上操作大部分使用root进行, 实时上, 使用svrctl进行的操作可以使用root用户完成也可以使用oracle用户完成, 而修改vip则必须使用root用户完成使用crs_stat -ls可以查看各个资源的所有者, 属组, 以及相应的权限.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11780477/viewspace-705078/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/11780477/viewspace-705078/

相关文章:

  • oracle oem 启动不起来(半解决)
  • 还是oem
  • 又是oem
  • isqlplus 连接标识符 (奇怪的问题)--(解决)
  • 天津rac总结1
  • 天津rac总结2
  • 天津rac总结3
  • 0209天津rac问题总结1
  • 0209天津问题总结2
  • 10.2.0.1升级10.2.0.3
  • ORA-04043: object dba_data_files does not exist
  • 10G 库rman迁移到11G
  • solaris ASM
  • oracle10g solaris
  • how_to_Secure_and_Audit_Oracle(1)
  • 【162天】黑马程序员27天视频学习笔记【Day02-上】
  • 2017年终总结、随想
  • CEF与代理
  • CODING 缺陷管理功能正式开始公测
  • Docker容器管理
  • JS 面试题总结
  • PAT A1092
  • vue-router的history模式发布配置
  • 对象引论
  • 工作手记之html2canvas使用概述
  • 基于webpack 的 vue 多页架构
  • 记录一下第一次使用npm
  • 简析gRPC client 连接管理
  • 区块链分支循环
  • 入门到放弃node系列之Hello Word篇
  • 一个6年java程序员的工作感悟,写给还在迷茫的你
  • 译米田引理
  • CMake 入门1/5:基于阿里云 ECS搭建体验环境
  • Hibernate主键生成策略及选择
  • ​​快速排序(四)——挖坑法,前后指针法与非递归
  • ​VRRP 虚拟路由冗余协议(华为)
  • ​第20课 在Android Native开发中加入新的C++类
  • "无招胜有招"nbsp;史上最全的互…
  • (04)Hive的相关概念——order by 、sort by、distribute by 、cluster by
  • (Mirage系列之二)VMware Horizon Mirage的经典用户用例及真实案例分析
  • (二)基于wpr_simulation 的Ros机器人运动控制,gazebo仿真
  • (附源码)springboot人体健康检测微信小程序 毕业设计 012142
  • (附源码)计算机毕业设计高校学生选课系统
  • (算法)Game
  • (算法二)滑动窗口
  • (一)UDP基本编程步骤
  • .bat批处理(五):遍历指定目录下资源文件并更新
  • .MyFile@waifu.club.wis.mkp勒索病毒数据怎么处理|数据解密恢复
  • .net core 源码_ASP.NET Core之Identity源码学习
  • .net6使用Sejil可视化日志
  • .NET关于 跳过SSL中遇到的问题
  • .net连接oracle数据库
  • .NET中GET与SET的用法
  • .net中生成excel后调整宽度
  • @Transactional注解下,循环取序列的值,但得到的值都相同的问题