Onsctl
Onsctl这个命令是用来管理ONS(Oracle Notification Service)是OracleClustser实现FAN Event Push模型的基础。
在RAC环境下,需要使用$CRS_HOME下的ONS,而不是$ORACLE_HOME下的ONS,这点需要注意。配置文件位于$CRS_HOME/opmn/conf/ons.config。
[oracle@felix2 conf]$ pwd
/u01/oracle/10.2.0/crs_1/opmn/conf
[oracle@felix2 conf]$ cat ons.config
localport=6113
remoteport=6200
loglevel=3
useocr=on
[oracle@felix2 conf]$ netstat -ano | grep 6200
tcp 0 0 0.0.0.0:6200 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 192.168.10.102:8471 192.168.10.101:6200 ESTABLISHED off (0.00/0/0)
[oracle@felix2 conf]$ netstat -ano | grep 6113
tcp 0 0 127.0.0.1:6113 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 127.0.0.1:42331 127.0.0.1:6113 ESTABLISHED keepalive (2251.34/0/0)
tcp 0 0 127.0.0.1:42328 127.0.0.1:6113 ESTABLISHED keepalive (2185.99/0/0)
tcp 0 0 127.0.0.1:6113 127.0.0.1:42331 ESTABLISHED off (0.00/0/0)
tcp 0 0 127.0.0.1:6113 127.0.0.1:42328 ESTABLISHED off (0.00/0/0)
unix 3 [ ] STREAM CONNECTED 6113
[oracle@felix2 conf]$
配置ONS:
添加ONS:
[oracle@felix2 conf]$ racgons add_configfelix11:6200 felix22:6200
删除ONS:
[oracle@felix2 conf]$ racgons remove_configfelix11:6200 felix22:6200
[oracle@felix2 conf]$
Onsctl命令:
使用onsctl命令可以启动、停止、调试ONS,并重新载入配置文件,其命令格式如下:
注意:
ONS进程运行,并不一定代表ONS正常工作,需要使用ping命令来确认。
[oracle@felix2 conf]$ onsctl
usage: /u01/oracle/10.2.0/db_1/bin/onsctlstart|stop|ping|reconfig|debug
start - Start opmn only.
stop - Stop ons daemon
ping - Test to see ifons daemon is running
debug - Display debuginformation for the ons daemon
reconfig - Reload the onsconfiguration
help - Print a shortsyntax description (this).
detailed - Print a verbosesyntax description.
(1)在os级别查看进程
[oracle@felix2 conf]$ ps -ef | grep ons
root 2530 1 0 20:19 ? 00:00:00 sendmail: acceptingconnections
oracle 5223 1 0 20:22 ? 00:00:00/u01/oracle/10.2.0/crs_1/opmn/bin/ons -d
oracle 5224 5223 0 20:22 ? 00:00:00 /u01/oracle/10.2.0/crs_1/opmn/bin/ons-d
oracle 10833 29589 0 21:59 pts/2 00:00:00 grep ons
[oracle@felix2 conf]$
(2)确认ONS服务的状态
[oracle@felix2 conf]$ onsctl ping
Number of configuration nodes retrieved: 2
0: {node = felix1, port = 6200}
Adding remote host felix1:6200
1: {node = felix2, port = 6200}
Remote port for local node in local config doesnot match that from OCR.
ons is not running ...
[oracle@felix2 conf]$
从输出的信息课件,ONS服务是停止的。
(3)启动ONS服务
[oracle@felix2 conf]$ onsctl start
Number of configuration nodes retrieved: 2
0: {node = felix1, port = 6200}
Adding remote host felix1:6200
1: {node = felix2, port = 6200}
……
……
【参考大话RAC--张晓明】