6: Configuring and Managing Oracle RAC Instances

In this chapter, we will cover the essentials of configuring and managing Oracle Real Application Clusters (RAC) instances. Oracle RAC allows multiple instances of a database to run on different nodes in a cluster, providing high availability, scalability, and fault tolerance. We will explain key topics like starting and stopping RAC instances, managing workloads across RAC nodes, configuring and managing services, and using srvctl to manage Oracle RAC instances with examples and commands.


1. Overview of RAC Instances and Oracle RAC Database

Oracle RAC is designed to allow multiple instances (Oracle processes and memory structures) to access a single database. Each node in the RAC cluster runs a separate Oracle instance, and these instances work together to share the database, providing fault tolerance and scalability.

Key Components of an Oracle RAC Instance:

  • Instance: An instance is a set of Oracle background processes and memory structures (SGA) that access a RAC database.
  • Shared Storage: The RAC database resides on shared storage accessible by all instances.
  • Interconnect: Oracle RAC uses a private interconnect between nodes to coordinate and manage cache coherence and data consistency.

Oracle RAC ensures data consistency across all instances by using Cache Fusion to synchronize data blocks across the nodes.

Command to Check Oracle RAC Instance Status:

# Check the status of all RAC instances
srvctl status database -d <dbname>

2. Starting and Stopping RAC Instances

Managing RAC instances requires ensuring that the instances are started and stopped correctly across all nodes. Oracle RAC provides multiple ways to start and stop instances, including using the srvctl utility and SQL*Plus.

Starting and Stopping RAC Instances Using srvctl:

  • Start all RAC instances in the database:
srvctl start database -d <dbname>

Stop all RAC instances in the database:

srvctl stop database -d <dbname>

Start a specific instance on a specific node:

srvctl start instance -d <dbname> -i <instance_name> -n <node_name>

Stop a specific instance on a specific node:

srvctl stop instance -d <dbname> -i <instance_name> -n <node_name>

Check the status of RAC instances:

srvctl status database -d <dbname>

Starting and Stopping RAC Instances Using SQL*Plus:

If you prefer using SQL*Plus for instance management:

  • Connect to an instance and start it:
sqlplus / as sysdba
SQL> startup;

Shut down an instance:

SQL> shutdown immediate;

Example:

To start all RAC instances on all nodes in the cluster for a database named racdb, run:

srvctl start database -d racdb

3. Managing Workloads Across RAC Nodes

One of the main benefits of Oracle RAC is its ability to manage workloads dynamically across multiple nodes in the cluster. Workload management ensures that queries and transactions are efficiently distributed, and that in case of a node failure, the workload can be transferred to other active nodes.

Load Balancing in RAC:

  • Connection Load Balancing: Oracle RAC uses a combination of client-side and server-side load balancing. With server-side load balancing, Oracle Net listener routes connections based on load and availability.To enable server-side load balancing, add the following parameter to your listener.ora:
LOAD_BALANCE = ON

Dynamic Workload Management with Services:

Oracle RAC uses services to allocate specific workloads to nodes. Services allow for grouping workloads and routing them to specific RAC instances. For example, OLTP transactions may be routed to one set of nodes, while reporting queries may be routed to another set.

4. Configuring and Managing Services in Oracle RAC

Services are critical for managing workloads and load balancing across RAC nodes. Oracle services allow you to assign specific application workloads to specific instances, ensuring better performance and resource utilization.

Creating and Managing Services:

  • Create a service and assign it to RAC instances:
srvctl add service -d <dbname> -s <service_name> -r <preferred_instances> -a <available_instances>

Example:

srvctl add service -d racdb -s oltp_service -r racdb1,racdb2 -a racdb3

In this example, the service oltp_service is created, with racdb1 and racdb2 as the preferred instances, and racdb3 as the available (failover) instance.

Start a service:

srvctl start service -d <dbname> -s <service_name>

Example:

srvctl start service -d racdb -s oltp_service

Stop a service:

srvctl stop service -d <dbname> -s <service_name>

Check the status of services:

srvctl status service -d <dbname>

Failover Configuration:

You can configure Oracle RAC services for automatic failover. When a node fails, the service can automatically fail over to an available node.

Example to configure failover policy:

srvctl modify service -d racdb -s oltp_service -z 120 -w 60

In this example, the service oltp_service will wait 60 seconds before attempting failover and will retry every 120 seconds.

5. Using srvctl to Manage Oracle RAC Instances

Oracle provides the srvctl utility to manage Oracle RAC instances and services. With srvctl, you can start, stop, configure, and check the status of RAC databases, instances, and services.

Common srvctl Commands:

  • Start and Stop RAC Databases:
srvctl start database -d <dbname>
srvctl stop database -d <dbname>

Start and Stop Specific RAC Instances:

srvctl start instance -d <dbname> -i <instance_name> -n <node_name>
srvctl stop instance -d <dbname> -i <instance_name> -n <node_name>

List the Status of RAC Databases and Instances:

srvctl status database -d <dbname>
srvctl status instance -d <dbname> -i <instance_name>

Create or Remove a RAC Instance:

srvctl add instance -d <dbname> -n <node_name> -i <instance_name>
srvctl remove instance -d <dbname> -n <node_name> -i <instance_name>

Add or Modify a Service:

srvctl add service -d <dbname> -s <service_name> -r <preferred_instances> -a <available_instances>
srvctl modify service -d <dbname> -s <service_name> -r <preferred_instances> -a <available_instances>

Example of Managing RAC Instances Using srvctl:

  • Start a specific instance (racdb1) on the node node1:
srvctl start instance -d racdb -i racdb1 -n node1

Stop all instances for the RAC database racdb:

srvctl stop database -d racdb

Add a service reporting_service to RAC database racdb, assigning it to instances racdb1 and racdb2:

srvctl add service -d racdb -s reporting_service -r racdb1,racdb2

Start the service reporting_service:

srvctl start service -d racdb -s reporting_service

Conclusion

This chapter covered the fundamental concepts and tasks associated with configuring and managing Oracle RAC instances. By using tools such as srvctl and SQL*Plus, you can manage RAC instances and services efficiently, ensuring proper workload distribution, high availability, and fault tolerance. Through proper configuration and management of services, you can route specific workloads to specific instances, optimizing the performance and resource utilization of your Oracle RAC environment.

2 thoughts on “6: Configuring and Managing Oracle RAC Instances

  1. Pingback: Mastering Oracle Real Application Clusters (RAC): A Complete Guide to High Availability and Scalability | Smart way of Technology

  2. Pingback: Mastering Oracle Real Application Clusters (RAC): A Complete Guide to High Availability and Scalability | SmartTechWays – Innovative Solutions for Smart Businesses

Leave a Reply