Oracle Notification Services (ONS)
A publish andsubscribe service for communicating information about all FANevents.
Using the onsctlCommand
After configuring, use ORACLE_HOME/opmn/bin/onsctl
to start, stop, reconfigure, and monitor the ONS daemon.Table 27-1 is a summary of thecommands that onsctl
supports.
Table 27-1onsctl commands
Command | Effect | Output |
| Starts the ONS daemon |
|
| Stops the ONS daemon |
|
| Verifies whether the ONS daemon isrunning |
|
| Triggers a reload of the ONS configuration withoutshutting down the ONS daemon | |
| Prints a help summary message foronsctl | |
| Prints a detailed help message foronsctl |
Node1:
Checkons in paycore1:
-bash-3.2$onsctl ping (it is a wrong commmand tocheck ons,because the command is from $ORACLE_HOME, not$CRS_HOME ) Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Remoteport for local node in local config does not match that fromOCR. ons is not running ... -bash-3.2$pwd /oracle/app/oracle/crs/bin -bash-3.2$./onsctl ping Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Addingremote host paycore1:6200 1: {node =paycore2, port = 6200} Addingremote host paycore2:6200 ons is running ... -bash-3.2$pwd /oracle/app/oracle/crs/bin -bash-3.2$./onsctl debug Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Addingremote host paycore1:6200 1: {node =paycore2, port = 6200} Addingremote host paycore2:6200 HTTP/1.1200 OK Content-Length: 1432 Content-Type: text/html Response: ========ONS ======== Listeners: NAMEBIND ADDRESSPORTFLAGS SOCKET ---------------------- ----- -------- ------ Local127.000.000.001 6100000001427 Remote 192.168.130.0106200000001018 RequestNo listener Serverconnections: IDIPPORTFLAGSSENDQWORKER BUSYSUBS ------------------------- ----- -------- ---------- -------- ----------- 6 192.168.130.020 620000010025010 Clientconnections: IDIPPORTFLAGSSENDQWORKER BUSYSUBS ------------------------- ----- -------- ---------- -------- ----------- 2 127.000.000.001 61000001001a010 3 127.000.000.001 6100 0001001a010 4 127.000.000.001 61000001001a011 Pendingconnections: IDIPPORTFLAGSSENDQWORKER BUSYSUBS ------------------------- ----- -------- ---------- -------- ----------- 0 127.000.000.001 610000020812010 WorkerTicket: 7/7, Idle: 360 THREAD FLAGS -------- -------- 2 00000012 3 00000012 4 00000012 Resources: Notifications: Received: 3, in Receive Q: 0, Processed: 3, in Process Q:0 Pools: Message: 24/25 (1), Link: 25/25 (1), Subscription: 24/25(1) -bash-3.2$ -bash-3.2$ps -ef |grep ons root46090 May 05console0:02 /usr/lib/saf/ttymon -g -d /dev/console -l console -T vt100 -mldterm,ttcompat - oracle201410 May 05?0:00 /oracle/app/oracle/crs/opmn/bin/ons -d oracle2015 20140 May 05?0:31 /oracle/app/oracle/crs/opmn/bin/ons -d oracle 1519518068 0 10:14:26pts/10:00 grep ons -bash-3.2$ -bash-3.2$netstat -na|grep 6100 127.0.0.1.6100*.*00491520 LISTEN 127.0.0.1.39763127.0.0.1.6100491520491520 ESTABLISHED 127.0.0.1.39764127.0.0.1.6100491520491520 ESTABLISHED 127.0.0.1.6100127.0.0.1.39763491520492190 ESTABLISHED 127.0.0.1.39765127.0.0.1.6100491520491520 ESTABLISHED 127.0.0.1.6100127.0.0.1.39764491520492190 ESTABLISHED 127.0.0.1.6100127.0.0.1.39765491520492190 ESTABLISHED -bash-3.2$netstat -na|grep 6200 *.6200*.*00491520 LISTEN 192.168.130.10.6200 192.168.130.20.39632496400496400 ESTABLISHED -bash-3.2$telnet paycore2 6200 Trying192.168.130.20... Connectedto paycore2. Escapecharacter is '^]'. ^C^C -bash-3.2$telnet paycore1 6200 Trying192.168.130.10... Connectedto paycore1. Escapecharacter is '^]'. ^C |
ViewONS Configuration File
-bash-3.2$pwd
/oracle/app/oracle/crs/opmn/conf
-bash-3.2$ls -l
total4
-rw------- 1oracleoinstall54 Apr 16 21:53 ons.config
-rw-rw-r-- 1oracleoinstall71 Feb 21 2006 ons.config.tmp
-bash-3.2$cat ons.config
localport=6100
remoteport=6200
loglevel=3
useocr=on
-bash-3.2$
Stop/Start ONS by clusterware command
It ispossible to start/stop the ons daemon on one node via theclusterware commands:
-bash-3.2$ crs_startora.paycore1.ons
-bash-3.2$ crs_stopora.paycore2.ons
for debugging purposes.
-bash-3.2$crs_stop ora.paycore2.ons Attemptingto stop `ora.paycore2.ons` on member `paycore2` Stop of`ora.paycore2.ons` on member `paycore2` succeeded. -bash-3.2$crs_stop ora.paycore1.ons Attemptingto stop `ora.paycore1.ons` on member `paycore1` Stop of`ora.paycore1.ons` on member `paycore1` succeeded. -bash-3.2$crs_stat -t NameTypeTargetStateHost ------------------------------------------------------------ ora.newpay.dbapplicationONLINEONLINEpaycore1 ora....y1.instapplicationONLINEONLINEpaycore1 ora....y2.instapplicationONLINEONLINEpaycore2 ora....pay7.csapplicationONLINEONLINEpaycore1 ora....ay1.srvapplicationONLINEONLINEpaycore1 ora.paidit.dbapplicationONLINEONLINEpaycore2 ora....t1.instapplicationONLINEONLINEpaycore1 ora....t2.instapplicationONLINEONLINEpaycore2 ora....pay3.csapplicationONLINEONLINEpaycore2 ora....it2.srvapplicationONLINEONLINEpaycore2 ora....SM1.asmapplicationONLINEONLINEpaycore1 ora....E1.lsnrapplicationONLINEONLINEpaycore1 ora....re1.gsdapplicationONLINEONLINEpaycore1 ora....re1.onsapplicationOFFLINEOFFLINE ora....re1.vipapplicationONLINEONLINEpaycore1 ora....SM2.asmapplicationONLINEONLINEpaycore2 ora....E2.lsnrapplicationONLINEONLINEpaycore2 ora....re2.gsdapplicationONLINEONLINEpaycore2 ora....re2.onsapplicationOFFLINEOFFLINE ora....re2.vipapplicationONLINEONLINEpaycore2 -bash-3.2$ bash-3.2$crs_start ora.paycore1.ons Attemptingto start `ora.paycore1.ons` on member `paycore1` Start of`ora.paycore1.ons` on member `paycore1` succeeded. -bash-3.2$crs_start ora.paycore2.ons Attemptingto start `ora.paycore2.ons` on member `paycore2` Start of`ora.paycore2.ons` on member `paycore2` succeeded. -bash-3.2$ -bash-3.2$crs_stat -t NameTypeTargetStateHost ------------------------------------------------------------ ora.newpay.dbapplicationONLINEONLINEpaycore1 ora....y1.instapplicationONLINEONLINEpaycore1 ora....y2.instapplicationONLINEONLINEpaycore2 ora....pay7.csapplicationONLINEONLINEpaycore1 ora....ay1.srvapplicationONLINEONLINEpaycore1 ora.paidit.dbapplicationONLINEONLINEpaycore2 ora....t1.instapplicationONLINEONLINEpaycore1 ora....t2.instapplicationONLINEONLINEpaycore2 ora....pay3.csapplicationONLINEONLINEpaycore2 ora....it2.srvapplicationONLINEONLINEpaycore2 ora....SM1.asmapplicationONLINEONLINEpaycore1 ora....E1.lsnrapplicationONLINEONLINEpaycore1 ora....re1.gsdapplicationONLINEONLINEpaycore1 ora....re1.onsapplicationONLINEONLINEpaycore1 ora....re1.vipapplicationONLINEONLINEpaycore1 ora....SM2.asmapplicationONLINEONLINEpaycore2 ora....E2.lsnrapplicationONLINEONLINEpaycore2 ora....re2.gsdapplicationONLINEONLINEpaycore2 ora....re2.onsapplicationONLINEONLINEpaycore2 ora....re2.vipapplicationONLINEONLINEpaycore2 -bash-3.2$ |
Checkons service by clusterware command
-bash-3.2$crs_stat -p ora.paycore1.ons
NAME=ora.paycore1.ons TYPE=application ACTION_SCRIPT=/oracle/app/oracle/crs/bin/racgwrap ACTIVE_PLACEMENT=0 AUTO_START=always CHECK_INTERVAL=600 DESCRIPTION=CRS application for ONS on node FAILOVER_DELAY=0 FAILURE_INTERVAL=0 FAILURE_THRESHOLD=0 HOSTING_MEMBERS=paycore1 OPTIONAL_RESOURCES= PLACEMENT=restricted REQUIRED_RESOURCES= RESTART_ATTEMPTS=3 SCRIPT_TIMEOUT=600 START_TIMEOUT=0 STOP_TIMEOUT=0 UPTIME_THRESHOLD=7d USR_ORA_ALERT_NAME= USR_ORA_CHECK_TIMEOUT=0 USR_ORA_CONNECT_STR=/ as sysdba USR_ORA_DEBUG=0 USR_ORA_DISCONNECT=false USR_ORA_FLAGS= USR_ORA_IF= USR_ORA_INST_NOT_SHUTDOWN= USR_ORA_LANG= USR_ORA_NETMASK= USR_ORA_OPEN_MODE= USR_ORA_OPI=false USR_ORA_PFILE= USR_ORA_PRECONNECT=none USR_ORA_SRV= USR_ORA_START_TIMEOUT=0 USR_ORA_STOP_MODE=immediate USR_ORA_STOP_TIMEOUT=0 USR_ORA_VIP= |
-bash-3.2$
Stop/Start ONS by onsctl
The command used bythe clusterware to start/stop/ping the ons is 'onsctl start','onsctl stop' and 'onsctl ping'.
-bash-3.2$pwd
/oracle/app/oracle/crs/bin
-bash-3.2$./onsctl stop
onsctl: shuttingdown ons daemon ... Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Adding remote hostpaycore1:6200 1: {node =paycore2, port = 6200} Adding remote hostpaycore2:6200 |
-bash-3.2$ ps-ef|grep ons
root48590 May 05console0:02 /usr/lib/saf/ttymon -g -d /dev/console -l console -T vt100 -mldterm,ttcompat -
oracle 20804 20605 0 12:20:05pts/10:00 grep ons
-bash-3.2$
-bash-3.2$ ./onsctlstart
Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Adding remote hostpaycore1:6200 1: {node =paycore2, port = 6200} Adding remote hostpaycore2:6200 Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Adding remote hostpaycore1:6200 1: {node =paycore2, port = 6200} Adding remote hostpaycore2:6200 onsctl: onsstarted |
-bash-3.2$ ps-ef|grep ons
root48590 May 05console0:02 /usr/lib/saf/ttymon -g -d /dev/console -l console -T vt100 -mldterm,ttcompat -
oracle 21883 21882 0 12:22:07?0:00 /oracle/app/oracle/crs/opmn/bin/ons -d
oracle 22295 20605 0 12:22:52pts/10:00 grep ons
oracle218821 0 12:22:07?0:00 /oracle/app/oracle/crs/opmn/bin/ons -d
-bash-3.2$
-bash-3.2$pwd
/oracle/app/oracle/crs/bin
-bash-3.2$./onsctl ping
Number ofconfiguration nodes retrieved: 2
0: {node =paycore1, port = 6200}
Adding remote hostpaycore1:6200
1: {node =paycore2, port = 6200}
Adding remote hostpaycore2:6200
ons is running...
-bash-3.2$
-bash-3.2$
Listeners register
When the ons is started, the listeners will register to theons as client subscribers to all FAN and RLB events.
Parameter SUBSCRIBE_FOR_NODE_DOWN_EVENT_=ON need to be set in the
listener.ora files. When that parameter is set andTRACE_LEVEL_=16 is set,
then a problem to subscribe to the locally running ONS can beviewed in the listener.log via messages like.
Racogns command
The racogns command enables you to specify hosts andports on one node, then propagate your changes among all nodes in acluster. The command takes two forms:
./racgons add_config hostname:port[hostname:port] [hostname:port]...
./racgons remove_config hostname[:port][hostname:port] [hostname:port]...
"racgonsremove_config hostname1" permits to delete the ocr configuration (or replaceit
together with the "racgons add_config hostname1ort1" command)
-bash-3.2$pwd
/oracle/app/oracle/crs/bin
-bash-3.2$./racgons remove_config paycore1:6200paycore2:6200
-bash-3.2$./racgons add_config paycore1:6200paycore2:6200
-bash-3.2$./racgons add_config paycore1:6200 paycore2:6200
WARNING: paycore1:6200 already configured.
WARNING: paycore2:6200 already configured.
-bash-3.2$
WithOracle Database 10g Release 1, JDBCclients (both thick and thin driver) areintegratedwith FAN byproviding FCF. With Oracle Database 10g Release 2, ODP.NET and OCIclients have been added. note:433827.1 can be used to setup an FCFclient.
Node2:
Checkons by onsctl
-bash-3.2$./onsctl ping Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Addingremote host paycore1:6200 1: {node =paycore2, port = 6200} Addingremote host paycore2:6200 ons isrunning ... -bash-3.2$ -bash-3.2$./onsctl debug Number ofconfiguration nodes retrieved: 2 0: {node =paycore1, port = 6200} Addingremote host paycore1:6200 1: {node =paycore2, port = 6200} Addingremote host paycore2:6200 HTTP/1.1200 OK Content-Length: 1431 Content-Type: text/html Response: ========ONS ======== Listeners: NAMEBIND ADDRESSPORTFLAGS SOCKET ---------------------- ----- -------- ------ Local127.000.000.001 6100000001427 Remote 192.168.130.0206200000001018 RequestNo listener Serverconnections: IDIPPORTFLAGSSENDQWORKER BUSYSUBS ------------------------- ----- -------- ---------- -------- ----------- 1 192.168.130.010 620000010005010 Clientconnections: IDIPPORTFLAGSSENDQWORKER BUSYSUBS ------------------------- ----- -------- ---------- -------- ----------- 2 127.000.000.001 61000001001a011 3 127.000.000.001 61000001001a010 4 127.000.000.001 61000001001a010 Pendingconnections: IDIPPORTFLAGSSENDQWORKER BUSYSUBS ------------------------- ----- -------- ---------- -------- ----------- 0 127.000.000.001 610000020812010 WorkerTicket: 1/1, Idle: 60 THREAD FLAGS -------- -------- 2 00000012 3 00000012 4 00000012 Resources: Notifications: Received: 0, in Receive Q: 0, Processed: 0, in Process Q:0 Pools: Message: 24/25 (1), Link: 25/25 (1), Subscription: 24/25(1) -bash-3.2$ -bash-3.2$netstat -na |grep 6100 127.0.0.1.6100127.0.0.1.39714491520492650 TIME_WAIT 127.0.0.1.6100*.*00491520 LISTEN 127.0.0.1.39707127.0.0.1.6100491520491520 ESTABLISHED 127.0.0.1.6100127.0.0.1.39707491520491520 ESTABLISHED 127.0.0.1.39708127.0.0.1.6100491520491520 ESTABLISHED 127.0.0.1.6100127.0.0.1.39708491520491520 ESTABLISHED 127.0.0.1.39709127.0.0.1.6100491520491520 ESTABLISHED 127.0.0.1.6100127.0.0.1.39709491520491520 ESTABLISHED -bash-3.2$netstat -na |grep 6200 *.6200*.*00491520 LISTEN 192.168.130.20.39705 192.168.130.10.6200496400496400 ESTABLISHED -bash-3.2$ -bash-3.2$ps -ef|grep ons root48590 May 05console0:02 /usr/lib/saf/ttymon -g -d /dev/console -l console -T vt100 -mldterm,ttcompat - oracle 2188321882 0 12:22:07?0:00 /oracle/app/oracle/crs/opmn/bin/ons -d oracle 2727620605 0 12:32:06pts/10:00 grep ons oracle218821 0 12:22:07?0:00 /oracle/app/oracle/crs/opmn/bin/ons -d -bash-3.2$ |
-bash-3.2$pwd
/oracle/app/oracle/crs/opmn/conf
-bash-3.2$ls -l
total4
-rw------- 1oracleoinstall54 Apr 16 21:53 ons.config
-rw-rw-r-- 1oracleoinstall71 Feb 21 2006 ons.config.tmp
-bash-3.2$cat ons.config
localport=6100
remoteport=6200
loglevel=3
useocr=on
-bash-3.2$