Home > Oracle > Server-side FAN callouts

Server-side FAN callouts

Update: This is relevant to RAC environments.

Fast Application Notifications mechanism was introduced in 10g as development of TAF (Transparent Application Failover). While the most important benefits are from using FAN on the client side, it’s possible to receive notifications on the server and react appropriately. The beauty of it is simplicity.

Setting up custom server-side callout is very easy and doesn’t require writing any code with OCI or Java. It can be a simple shell or perl script. This script with executable permissions should be put in $ORA_CRS_HOME/racg/usrco. Note that you will most probably have to create this directory as it doesn’t exist after installation (well, at least in my case with 10.2 on Linux). The sample script I use just for logging:

#!/usr/bin/sh
HOST=`hostname`
FAN_LOGFILE=/opt/oracle/fan_log_${HOST}.log
echo $* "reported="`date` >>$FAN_LOGFILE

The script gets event attributes as command-line argiments and they can be processed however you want - emailing/paging DBA’s, logging events, relocating services, and any other automated action.

Categories: Oracle Tags:
  1. nehal
    March 4th, 2009 at 05:33 | #1

    what is this FAN exactly and when it triggers?

  2. March 4th, 2009 at 05:58 | #2

    Nehal,

    This is very RTFM question. You can find more info about FAN Events here.

    Good Luck!

  3. jc
    April 29th, 2009 at 10:42 | #3

    Alex,
    I am using Perl scripts for the callouts in our environment.
    I am not touching the database and not using any DBI modules. So far so good.

    Now, there’s a requirement for us to log every event into a database table.
    I would like to use the DBI that comes with the perl associated with Oracle installation (ORACLE_HOME/perl/bin)

    How do I ‘include’ that module in my current program?
    The thing with the dynamic libraries called out by the perl interpretor is determined by LD_LIBRARY_PATH.

    So, I am left with invoking a shell callout that exports these variables and in turn invokes the perl code.
    Is that my only option?

    ???????

  4. April 29th, 2009 at 17:25 | #4

    jc,

    This is Perl question and I’m far from Perl guru. :) See http://perldoc.perl.org/functions/require.html and http://perldoc.perl.org/perlvar.html#@INC

    I would be very careful accessing the database from callouts. At least, I assume that the database is external to this cluster, otherwise, there is clearly condition when database is not available.

    One good options would be to write events in the file and plug it into the DB as external table.
    Another idea would be to write events in a file and have another asyncronous process moving them into the DB.

    Cheers,
    Alex

  1. No trackbacks yet.