Creating Resources that Use the generic_application Resource Type

Use the crsctl add resource command to create resources using the generic_application resource type to model any type of application requiring high availability without having to create any action scripts. This section includes two examples for Linux/UNIX platforms of creating resources that use the generic_application resource type.

See Also:

"Oracle Clusterware Resource Types" for more information about the generic_application resource type

In the following command example, a Samba server resource is created for high availability:

$ crsctl add resource samba1 -type generic_application -attr
  "START_PROGRAM='/etc/init.d/smb start',
   STOP_PROGRAM='/etc/init.d/smb stop',
   CLEAN_PROGRAM='/etc/init.d/smb stop',
   PID_FILES='/var/run/smbd.pid,/var/run/nmbd.pid'"

In the preceding example, the attributes that define the resource are configured, as follows:

  • START_PROGRAM='/etc/init.d/smb start': This attribute contains the complete path and arguments to the script that starts the Samba server

  • STOP_PROGRAM='/etc/init.d/smb stop': This attribute contains the complete path and arguments to the script that stops the Samba server

  • CLEAN_PROGRAM='/etc/init.d/smb stop': This attribute contains the complete path and arguments to the script that forcefully terminates and cleans up the Samba server in case there is any failure in starting or stopping the server

  • PID_FILES='/var/run/smbd.pid,/var/run/nmbd.pid': This attribute contains the paths to the text files listing the process IDs (PIDs) that must be monitored to ensure that the Samba server and all its components are running

Note:

  • If script-based monitoring is required for this Samba server configuration, then you can use the CHECK_PROGRAMS attribute instead of the PID_FILES attribute, as follows:

    CHECK_PROGRAMS='/etc/init.d/smb status'
    
  • You can specify standard Oracle Clusterware placement and cardinality properties by configuring the HOSTING_MEMBERS, SERVER_POOLS, PLACEMENT, and CARDINALITY attributes of the Samba server resource.

In the second command example, a database file server (DBFS) resource is created for high availability. The DBFS provides a Filesystem in Userspace (FUSE) file system to access data stored in an Oracle Database.

See Also:

Oracle Database SecureFiles and Large Objects Developer's Guide for more information about DBFS

You can use the generic_application resource type to define a resource that corresponds to the DBFS file system. You can use this DBFS resource to start, stop, monitor, and failover the DBFS file system mount point. The command syntax to create this resource is as follows:

$ crsctl add resource dbfs1 -type generic_application -attr
  "START_PROGRAM='/app/oracle/12.1/bin/dbfs_client -o wallet 
   /@inst1 /scratch/mjkeenan/data/dbfs_mount',
   STOP_PROGRAM='/bin/fusermount -u /scratch/mjkeenan/data/dbfs_mount',
   CHECK_PROGRAMS='ls /scratch/mjkeenan/data/dbfs_mount/dbfsdata1',
   ENVIRONMENT_VARS='ORACLE_HOME=/app/oracle/12.1,
         LD_LIBRARY_PATH=/app/oracle/12.1/lib:/app/oracle/12.1/rdbms/lib,
         TNS_ADMIN=/app/oracle/12.1/network/admin',
   CLEAN_PROGRAM='/bin/fusermount -u -z /scratch/mjkeenan/data/dbfs_mount',
   START_DEPENDENCIES='hard(ora.inst1_srv.svc)',
   STOP_DEPENDENCIES='hard(ora.inst1_srv.svc)'"

In addition to the mandatory START_PROGRAM, STOP_PROGRAM, CHECK_PROGRAMS, and CLEAN_PROGRAM attributes, the above example also includes the following:

  • The ENVIRONMENT_VARS attribute specifies custom environment variables that are passed when starting or stopping the program

  • The START_DEPENDENCIES and STOP_DEPENDENCIES dependency attributes create a start and stop dependency on the database service that is the underlying database store of the DBFS file system

    You can create dependencies on to the DBFS resource for higher-level application resources based on the application requirements of the DBFS file system.

Note:

  • The ORACLE_HOME directory shown in the preceding syntax is an example.

  • You can specify standard Oracle Clusterware placement and cardinality properties by configuring the HOSTING_MEMBERS, SERVER_POOLS, PLACEMENT, and CARDINALITY attributes of the DBFS file system resource.