Oracle RAC 环境下修改主机名


先看Oracle 官方文档上的两段说明:

 (1)Can I change the public hostname in my Oracle Database 10g Cluster using Oracle Clusterware?

Hostname changes are not supported in Oracle Clusterware (CRS), unless you want to perform a deletenode followed by a new addnode operation.
The hostname is used to store among other things the flag files and Oracle Clusterware stack will not start if hostname is changed.

(2)Does the hostname have to match the public name or can it be anything else?

When there is no vendor clusterware, only Oracle Clusterware, then the public node name must match the host name. When vendor clusterware is present, it determines the public node names, and the installer doesn't present an opportunity to change them. So, when you have a choice, always choose the hostname.

From: Metalink Note 220970.1 RAC Frequently Asked Questions:

根据官网上的这2段文字,我们可以看出2点:

(1). RAC 环境一旦安装好后, 主机名就不能修改,除非先删除节点,修改Hostname, 在添加节点。

(2). 主机名必须和public 名一致。这一点在安装文档中有特别强调。

在Oracle 的Metalink 上没有找到相关的修改方法,除了上面提到的删除节点在添加节点。 其实还有一种很简单的方法,就是重新运行CRS的配置文件(/u01/app/oracle/product/crs/install/rootconfig),重新格式化OCR和Voting disk,然后重新创建CRS的资源。

这些操作需要先关闭CRS。 所以在生产库上,一般不会去做这样的操作。 生产系统维护稳定第一。 但作为一个知识点,我们可以学习一下。

测试平台:RedHat 5.4 + Multipath + RAW + ASM + Oracle 10gR2 

相关操作如下:

一. 停止CRS

使用$ORA_CRS_HOME/bin/crsctl stop crs 命令即可。 

执行完该命令后, 所有的database,listeners,和其他注册在CRS里的resource都将停止。

二. 修改主机名

原来的主机名:

[root@rac1 bin]# hostname

rac1

[root@rac2 bin]# hostname

rac2

 

将主机名修改为racdb1 和 racdb2。

 

在节点1修改成如下:

[root@rac1 bin]# hostname racdb1

[root@rac1 bin]# hostname

racdb1

[root@rac1 bin]# cat /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=racdb1

GATEWAY=192.168.6.254

[root@rac1 bin]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost

# Public Network - (eth0)

192.168.6.223    racdb1

192.168.6.226    racdb2

# Private Interconnect - (eth1)

192.168.6.224    racdb1-priv

192.168.6.227    racdb2-priv

# Public Virtual IP (VIP) addresses - (eth0:1)

192.168.6.225    racdb1-vip

192.168.6.228    racdb2-vip

在节点2与节点1一样。

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 下一页

相关内容