This is an excerpt from the bestselling book
Oracle Grid & Real Application Clusters. To get immediate
access to the code depot of working RAC scripts, buy it
directly from the publisher and save more than 30%.
Many applications require large
batch jobs to make changes or to update the database system. These
batch jobs usually run during the off-peak hours. Many of these jobs
are run to upload data feeds into the database, and also to extract
data as required for internal or external business users.
The RAC system, by providing
multiple instances, allows a specific instance to be allotted to do
batch jobs, without affecting the performance levels of the other
Using Parallel Instance
Besides the physical connection
to a specific instance, there is another interesting facility that
allows control over which instances allocate parallel execution
server processes with instance groups. Each active instance can be
assigned to at least one or more instance service groups. By
activating a particular service group of instances, the instances
that spawn parallel processes can be dynamically controlled.
Instance group membership can be
established on an instance-by-instance basis by setting the
instance_groups initialization parameter to a name representing one
or more instance groups. For example, on an 8-node system owned by
both marketing and HR departments, half the nodes can be assigned to
one department and the other half to the other one. Either the old
method of instance group assignment or the new 10g service
assignments can be used.
To do this using groups, nodes
1-4 are assigned to the marketing department using the following
parameter syntax in the initialization parameter file:
Nodes 5-8 are then assigned to
HR using the following syntax in the parameter file:
The nodes owned by HR are
activated to spawn a parallel execution server process by entering
SET PARALLEL_INSTANCE_GROUP = 'HR';
In response, Oracle allocates
parallel execution server processes to nodes 5-8. The default value
for parallel_instance_group is all active instances.
Services in Oracle Database
Oracle Database 10g allows the
user to define RAC instances as services. The services can then be
individually managed and controlled. Applications are defined as a
service, and the RAC instances are then assigned to the individual
services. This allows the application to show affinity for a node or
set of nodes.
The use of services allows for
the replacement of the primary/secondary metaphor from 9i RAC with
one in 10g where the primary database becomes the preferred instance
while the secondary instance becomes an available instance.
The srvctl utility is used to
configure the services in a RAC grid configuration. For example:
database ?d v10g ?o $ORACLE_HOME ?s $ORACLE_HOME/dbs/v10g_spfile
srvctl add instance ?d v10g ?I v10g1 ?n aultlinux1
srvctl add instance ?d v10g ?I v10g2 ?n aultlinux2
srvctl add instance ?d v10g ?I v10g3 ?n aultlinux3
srvctl add instance ?d v10g ?I v10g4 ?n aultlinux4
srvctl add service ?d v10g ?s CRM ?r V10g1,v10g2 ?a v10g3,v10g4
srvctl add service ?d v10g ?s AR ?r v10g3,v10g4 ?a v10g1,v10g2
This would add the v10g database
and its four instances, v10g1, v10g2, v10g3, and v10g4, create two
services, CRM and AR, where the CRM service uses instances v10g1 and
v10g2 as its preferred instances with v10g3 and v10g4 as its
available instances. Service AR uses the reverse of these
The v$active_services view
provides the information on what services are currently running.
Once configured, the service
name can be used to define TAF and load balance configurations to
allow user connections to be sent to the proper instances.