ons服务无法online

[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE OFFLINE
ora.rac1.vip application ONLINE ONLINE rac1
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE OFFLINE
ora.rac2.vip application ONLINE ONLINE rac2
[root@rac1 bin]#


使用onsctl ping和onsctl debug确定错误信息,发现是无法取得本地机器的IP

 

[root@rac1 bin]# ./onsctl ping
Failed to get IP for localhost (2)
ons is not running ...
[root@rac1 bin]# ./onsctl debug
Failed to get IP for localhost (2)
[root@rac1 bin]#

 

查看机器的hosts文件,发现配置到本机localhost和条目没有了

 

[root@rac1 bin]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
::1 localhost6.localdomain6 localhost6


192.168.0.82 rac1
192.168.0.83 rac2
10.10.10.1 rac1-priv
10.10.10.2 rac2-priv
192.168.0.84 rac1-vip
192.168.0.211 rac2-vip
[root@rac1 bin]#

添加到本机(127.0.0.1)的条目
[root@rac1 bin]# vi /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
::1 localhost6.localdomain6 localhost6
127.0.0.1 localhost.localdomain localhost
192.168.0.82 rac1
192.168.0.83 rac2
10.10.10.1 rac1-priv
10.10.10.2 rac2-priv
192.168.0.84 rac1-vip
192.168.0.211 rac2-vip

 

在另一个节点也添加相同的条目

重新启动ons服务

 

[root@rac1 bin]# ./crs_start ora.rac1.ons
Attempting to start `ora.rac1.ons` on member `rac1`
Start of `ora.rac1.ons` on member `rac1` succeeded.
[root@rac1 bin]# ./crs_start ora.rac2.ons
Attempting to start `ora.rac2.ons` on member `rac2`
Start of `ora.rac2.ons` on member `rac2` succeeded.
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE UNKNOWN rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
[root@rac1 bin]#