crsctl add resource

Use the crsctl add resource command to register a resource to be managed by Oracle Clusterware. A resource can be an application process, a database, a service, a listener, and so on.

Syntax

crsctl add resource resource_name -type resource_type [-file file_path |
   -attr "attribute_name=attribute_value,attribute_name=attribute_value,..."]
  [-i] [-f]

Parameters

Table E-2 crsctl add resource Command Parameters

Parameter Description
resource_name

A short, descriptive name for the resource.

-type resource_type

The type of resource that you are adding preceded by the -type flag.

-file file_path

Path name (either absolute or relative) for a text file containing line-delimited attribute name-value pairs that define the resource.

-attr "attribute_name=
attribute_value

You can specify attributes for a resource you are adding in two different ways:

  • Following the -attr flag, you can specify one or more comma-delimited attribute name-value pairs enclosed in double quotations marks (""). For example:

    -attr "CHECK_INTERVAL=30,START_TIMEOUT=25"

    Some attributes can have multiple values. In those cases, separate the values with a space and enclose the list of values in single quotation marks. For example:

    -attr "SERVER_POOL_NAMES=
    'ora.pool1 ora.pool2',START_TIMEOUT=25"
  • Additionally, you can specify attribute values for resource instances with a particular cardinality value, and with a particular degree value. This method can be useful for applications that are tied to a particular server. Following the -attr flag, the syntax is as follows:

    attribute_name{@SERVERNAME(server_name)
    [@DEGREEID(did)] | @CARDINALITYID(cid)
    [@DEGREEID(did)]}=attribute_value

    If you specify the @SERVERNAME(server_name) syntax, then the attribute value you specify for the attribute you specify is limited to resource instances residing on the server you specify.

    Alternatively, if you specify the @CARDINALITYID(cid) syntax, then the attribute value you specify for the attribute you specify is limited to resource instances with a specific cardinality ID (cid).

    Optionally, you can combine the @DEGREEID(did) syntax with either the SERVERNAME or CARDINALITYID syntax, or both, to limit the attribute value to resources with the specific DEGREE.

    Examples:

    CHECK_INTERVAL@SERVERNAME(node1)=45
    STOP_TIMEOUT@CARDINALITYID(2)=65
    STOP_TIMEOUT@SERVERNAME(node1)@DEGREEID(2)=65
    STOP_TIMEOUT@CARDINALITYID(3)@DEGREEID(2)=65
-i

If you specify -i, then the command returns an error if processing this command requires waiting for Oracle Clusterware to unlock the resource or its dependents. Sometimes, Oracle Clusterware locks resources or other objects to prevent commands from interfering with each other.

-f

Use the force parameter:

  • To add a resource that has dependencies on other resources that do not yet exist. The force parameter overrides checks that would prevent a command from being completed.

  • To add a resource if the resource has hard dependencies on other resources and the owner of the resources does not execute permissions on one or more of the dependencies. If you do not specify the force parameter in this case, an error displays.

  • To add resources of application type because you may need to move servers into the Generic server pool. If the servers currently host resources that must be stopped, then the force parameter is required

See Also:

Oracle Clusterware Resource Reference for more information about resources and resource attributes

Usage Notes

  • Both the resource_name and -type resource_type parameters are required. You can create an associated resource type using the crsctl add type command.

  • Any user can create a resource but only clusterware administrators can create resources of type local_resource or resources of type cluster_resource that have SERVER_POOLS=*.

    Once a resource is defined, its ACL controls who can perform particular operations with it. The Oracle Clusterware administrator list is no longer relevant.

    On Windows, a member of the Administrators group has full control over everything.

    See Also:

    "crsctl setperm resource" for more information about setting ACLs

  • If an attribute value for an attribute name-value pair contains commas, then the value must be enclosed in single quotation marks ('').

  • Following is an example of an attribute file:

    PLACEMENT=favored
    HOSTING_MEMBERS=node1 node2 node3
    RESTART_ATTEMPTS@CARDINALITYID(1)=0
    RESTART_ATTEMPTS@CARDINALITYID(2)=0
    FAILURE_THRESHOLD@CARDINALITYID(1)=2
    FAILURE_THRESHOLD@CARDINALITYID(2)=4
    FAILURE_INTERVAL@CARDINALITYID(1)=300
    FAILURE_INTERVAL@CARDINALITYID(2)=500
    CHECK_INTERVAL=2
    CARDINALITY=2
    
  • Do not use this command for any resources with names that begin with ora because these resources are Oracle resources.

Examples

Example 1

To register a VIP as a resource with Oracle Clusterware:

$ crsctl add resource app.appvip -type app.appvip.type -attr "RESTART_ATTEMPTS=2,
START_TIMEOUT=100,STOP_TIMEOUT=100,CHECK_INTERVAL=10,
USR_ORA_VIP=172.16.0.0,
START_DEPENDENCIES=hard(ora.net1.network)pullup(ora.net1.network),
STOP_DEPENDENCIES=hard(ora.net1.network)"

Example 2

To register a resource based on the test_type1 resource type:

$ crsctl add resource r1 -type test_type1 -attr "PATH_NAME=/tmp/r1.txt"
$ crsctl add resource r1 -type test_type1 -attr "PATH_NAME=/tmp/r2.txt"

Example 3

To register a Samba server resource of the generic_application resource type, using the EXECUTABLE_NAMES attribute:

# crsctl add resource my_samba -type generic_application -attr
"EXECUTABLE_NAMES=smbd,START_PROGRAM='/etc/rc.d/init.d/smb start',
STOP_PROGRAM='/etc/rc.d/init.d/smb stop'"

Example 4

To register a DNS server of the generic_application resource type, using the EXECUTABLE_NAMES attribute:

# crsctl add resource my_dns -type generic_application -attr
"EXECUTABLE_NAMES=named,START_PROGRAM='/etc/rc.d/init.d/named start',
STOP_PROGRAM='/etc/rc.d/init.d/named stop'"

Example 5

To register an Apache web server of the generic_application resource type using the PID_FILES attribute:

# crsctl add resource my_apache -type generic_application -attr
"START_PROGRAM='/usr/sbin/httpd -k start',STOP_PROGRAM='/usr/sbin/httpd -k stop',
PID_FILES=/etc/httpd/run/httpd.pid"

Example 6

To register an application of generic_application resource type using environment variables:

# crsctl add resource my_app -type generic_application -attr
"START_PROGRAM='/opt/my_app start', EXECUTABLE_NAMES=my_app,
ENVIRONMENT_VARS='USE_NETAPP=no,USE_BACKUP=yes,CLEAN_ON_KILL=yes'"