Friday, November 2, 2012

Managing Resources in 11g RAC


Managing Resources


How to add resource using EM



This section includes the following topics:
  • Registering Application Resources
  • Starting Application Resources
  • Relocating Applications and Application Resources
  • Stopping Applications and Application Resources
  • Displaying Clusterware Application and Application Resource Status Information
Registering Application Resources
Each application that you manage with Oracle Clusterware is stored as a resource in OCR. Use the crsctl add resource command to register applications in OCR. For example, enter the following command to register the Apache Web server application from the previous example:
$ crsctl add resource myApache -type cluster_resource
-attr "ACTION_SCRIPT=/opt/cluster/scripts/myapache.scr, PLACEMENT=restricted,
SERVER_POOLS=server_pool_list,CHECK_INTERVAL=30,RESTART_ATTEMPTS=2,
START_DEPENDENCIES=hard(appsvip),STOP_DEPENDENCIES=hard(appsvip)"
If you modify a resource, then update OCR by running the crsctl modifies resource command.
Starting Application Resources
Start and stop resources with the crsctl start resource and crsctl stop resource commands. Manually starting or stopping resources outside of Oracle Clusterware can invalidate the resource status. In addition, Oracle Clusterware may attempt to restart a resource on which you perform a manual stop operation.
To start an application resource that is registered with Oracle Clusterware, use the crsctl start resource command. For example:
$ crsctl start resource myApache
The command waits to receive a notification of success or failure from the action program each time the action program is called. Oracle Clusterware can start application resources if they have stopped due to exceeding their failure threshold values. You must register a resource using crsctl add resource before you can start it.
Running the crsctl start resource command on a resource sets the resource TARGET value to ONLINE. Oracle Clusterware attempts to change the state to match the TARGET by running the action program with the start action.
If a cluster server fails while you are starting a resource on that server, then check the state of the resource on the cluster by using the crsctl status resource command.
Relocating Applications and Application Resources
Use the crsctl relocate resource command to relocate applications and application resources. For example, to relocate the Apache Web server application to a server named rac2, run the following command:
# crsctl relocate resource myApache -n rac2

./crsctl relocate resource ora.scan1.vip -n rac1 -f
Each time that the action program is called, the crsctl relocate resource command waits for the duration specified by the value of the SCRIPT_TIMEOUT resource attribute to receive notification of success or failure from the action program. A relocation attempt fails if:
  • The application has required resources that run on the initial server
  • Applications that require the specified resource run on the initial server
To relocate an application and its required resources, use the -f option with the crsctl relocate resource command. Oracle Clusterware relocates or starts all resources that are required by the application regardless of their state.
Stopping Applications and Application Resources
Stop application resources with the crsctl stop resource command. The command sets the resource TARGET value to OFFLINE. Because Oracle Clusterware always attempts to match the state of a resource to its target, the Oracle Clusterware subsystem stops the application. The following example stops the Apache Web server:
# crsctl stop resource myApache
You cannot stop a resource if another resource has a hard stop dependency on it, unless you use the force (-f) option. If you use the crsctl stop resource resource_name -f command on a resource upon which other resources depend, and if those resources are running, then Oracle Clusterware stops the resource and all of the resources that depend on the resource that you are stopping.
Displaying Clusterware Application and Application Resource Status Information
To display status information about applications and resources that are on cluster servers, use the crsctl status resource command. The following example displays the status information for the Apache Web server application:
# crsctl status resource myApache

NAME=myApache
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on server010
Other information this command returns includes the following:
  • How many times the resource has been restarted
  • How many times the resource has failed within the failure interval
  • The maximum number of times that a resource can restart or fail
  • The target state of the resource and the normal status information
Use the -f option with the crsctl status resource resource_name command to view full information of a specific resource.
Enter the following command to view information about all applications and resources in tabular format:
# crsctl status resource
Managing Automatic Restart of Oracle Clusterware Resources
You can prevent Oracle Clusterware from automatically restarting a resource by setting several resource attributes. You can also control how Oracle Clusterware manages the restart counters for your resources. In addition, you can customize the timeout values for the startstop, and check actions that Oracle Clusterware performs on resources.
This section includes the following topics:
  • Preventing Automatic Restarts
  • Automatically Manage Restart Attempts Counter for Resources
Preventing Automatic Restarts
When a server restarts, Oracle Clusterware attempts to start the resources that run on the server as soon as the server starts. Resource startup might fail, however, if system components on which a resource depends, such as a volume manager or a file system, are not running. This is especially true if Oracle Clusterware does not manage the system components on which a resource depends. To manage automatic restarts, use the AUTO_START resource attribute to specify whether Oracle Clusterware should automatically start a resource when a server restarts.
Note:
Regardless of the value of the AUTO_START resource attribute for a resource, the resource can start if another resource has a hard or weak start dependency on it or if the resource has a pullup start dependency on another resource.
Automatically Manage Restart Attempts Counter for Resources
When a resource fails, Oracle Clusterware attempts to restart the resource the number of times specified in the RESTART_ATTEMPTS resource attributes, regardless of how often the resource fails. The crsd process maintains an internal counter to track how often Oracle Clusterware restarts a resource. The number of times Oracle Clusterware has attempted to restart a resource is reflected in the RESTART_COUNT resource attribute. Oracle Clusterware can automatically manage the restart attempts counter based on the stability of a resource. The UPTIME_THRESHOLD resource attribute determines the time period that a resource must remain online, after which the RESTART_COUNT attribute gets reset to 0. In addition, the RESTART_COUNT resource attribute gets reset to 0 if the resource is relocated or restarted by the user, or the resource fails over to another server.






No comments:

Post a Comment