Sunday, November 17, 2013

FAN VS ONS

FAN (Fast Application Notification)
FAN is a notification mechanism that RAC uses to notify other processes about configuration and service levelinformation such as includes service status changes, such as UP or DOWN events. Applications can respond to FAN events and take immediate action. FAN UP and DOWN events can apply to instances, services, and nodes.
RAC publishes the FAN events the minute any changes are made to the cluster. So, instead of waiting for the application to check on individual nodes to detect an anomaly, the applications are notified by FAN events and are able to react immediately.
FAN also publishes load balancing advisory (LBA) events. Applications are in a position to take full advantage of the LBA FAN events to facilitate a smooth transition of connections to healthier nodes in a cluster. 

One can take advantage of FAN is the following ways:
    1. When using integrated Oracle Client, the applications can use FAN with no programming whatsoever. Oracle 11g JDBC, ODP.NET and OCI would be considered as the components of the integrated clients.
    2. Programmatic changes in ONS API make it possible for applications to still subscribe to the FAN events and can execute the event handling actions appropriately.
    3. FAN can be implemented with server-side callouts on your database tier.
    For instance, a typical DOWN event will prevent any further disruption of service by cleanly terminating the sessions on that failed node and notifying the user. Moreover, a typical UP event can address and allocate extra resources for new incoming requests/ connections. There are however several additional benefits with the server-side callouts

    Main utilization of  FAN is:
      1. Logging
      2. Paging/SMS the DBA and/or to open trouble tickets when the resources fail to (re)start
      3. Change resource plans or to shut down services when the number of available instances decreases, thus preventing further load on the cluster and keeping the RAC running until another healthy node is added to the cluster.
      Automate the fail service back to PREFERRED instances when required. 
       





      ONS (Oracle Notification Services)

      ONS allows users to send SMS messages, e-mails, voice notifications, and fax messages in an easy-to-access manner. Oracle Clusterware uses ONS to send notifications about the state of the database instances to mid-tier applications that use this information for load-balancing and for fast failure detection. ONS is a daemon process that communicates with other ONS daemons on other nodes which inform each other of the current state of the database components on the database server.
      To add additional members or nodes that should receive notifications,  the hostname or IP address of the node should be added to the ons.config file.
      The ONS configuration file is located in the $ORACLE_HOME/opmn/conf  directory and has the 
      Example:

      Oracle Notification Server Local Port
      6100
      6100 -6199
      Oracle Notification Server Remote Port
      6200
      6200 -6299
      Oracle Notification Server Request 
      6003
      6003 -6099
      port referece here

      [oracle@racdb4 oracle]$ cat $ORACLE_HOME/opmn/conf/ons.config
      localport=6101
      remoteport=6201
      loglevel=3
      useocr=on
      nodes=racdb1.cluster.oracle.com:6101,racdb2.cluster.oracle.com:6101,
      racdb3.cluster.oracle.com:6201,racdb4.cluster.oracle.com:6201,
      onsclient1.cluster.oracle.com :6200,onsclient2.cluster.oracle.com :6200

      1. The localport is the port that ONS binds to on the local host interface to talk to local clients.
      2. The remoteport is the port that ONS binds to on all interfaces to talk to other ONS daemons.
      3. The loglevel indicates the amount of logging that should be generated. Oracle supports logging levels from 1 through 9.
      4. ONS logs are generated in the $ORACLE_HOME/opmn/logs directory on the respective instances.
      5. The useocr parameter (valid values are on/off) indicates whether ONS should use the OCR to determine which instances and nodes are participating in the cluster.
      6. The nodes listed in the nodes line are all nodes in the network that will need to receive or send event notifications. This includes client machines where ONS is also running to receive FAN events for applications.
      How do you monitor and track when these events are fired?
      Oracle has provided options where a script or utility or application (called server-side callouts), if placed in the $ORA_CRS_HOME/racg/usrco directory, will be executed automatically.
      For example, 
      the following shell script, when placed in this directory will write out events generated by the Event Manager to the file defined by the symbol FAN_LOGFILE in the script:
      [oracle@oradb4 oracle]$ CAT callout.sh
      #! /bin/ksh
      FAN_LOGFILE=/usr/app/oracle/product/11.2.0/crs/evm/admin/log/racdb4_FANuptime.log
      echo >> $FAN_LOGFILE &

      No comments:

      Post a Comment