The Oracle Real Application Cluster (RAC) is a robust solution that allows an Oracle database to run across multiple servers, providing high availability, scalability, and performance. This system is essential for organizations requiring continuous system availability and scalable resources. Understanding Oracle RAC Architecture, components, installation, configuration, and best practices for management and optimization is crucial for database administrators. RAC Tips are critical for effective management and optimization of these clusters. The Oracle RAC Architecture and Components are designed to provide a resilient database environment that ensures data consistency and reliability across multiple nodes.
Oracle Real Application Clusters (RAC) is a critical technology for enhancing database performance, availability, and scalability. This blog will provide a detailed overview of the architecture and key components of Oracle RAC. Additionally, we will discuss examples of how Oracle Database, including RAC, is utilized in various industries.
Understanding Oracle RAC Architecture
Oracle RAC Architecture allows multiple instances of Oracle Database to run on different servers while accessing a single database. This setup ensures high availability and scalability.
Cluster Nodes: These are multiple servers (nodes) running Oracle Database software and configured to work together. Each node in the cluster has its own memory and processing power but shares the storage with other nodes.
Shared Storage: A shared storage subsystem is accessible by all cluster nodes. It holds the data and log files, ensuring that all nodes can access the same data simultaneously.
Cluster Interconnect: A high-speed network connects all nodes, allowing them to communicate and coordinate their activities. This interconnect is crucial for maintaining the integrity and performance of the cluster.
Oracle Clusterware: This software infrastructure enables clustering and managing the cluster nodes and resources. It is essential for the proper functioning of the RAC environment.
Key Components of Oracle RAC
Oracle RAC Architecture consists of several key components that work together to provide high availability and scalability features:
Oracle RAC Database Instances: Multiple instances of Oracle Database running on different nodes. Each instance has its own memory and processes but shares the database stored in the shared storage.
Global Resource Directory (GRD): A distributed directory that keeps track of the resources used by each instance in the cluster. It ensures data consistency and prevents conflicts by coordinating access to shared resources.
Cache Fusion: A mechanism that allows nodes to share data blocks directly from their cache. This process reduces disk I/O and improves performance by enabling faster data access.
Automatic Workload Management: This feature dynamically balances workloads across all nodes in the cluster. It ensures efficient use of resources and maintains high performance even during peak loads.
Oracle RAC Components in Different Industries
Oracle RAC Architecture and components are leveraged across various industries to improve operational efficiency and reliability. Here are a few examples:
Finance: In the finance sector, Oracle RAC manages high transaction volumes and ensures continuous availability of financial data. Banks and financial institutions rely on RAC to process transactions efficiently and provide real-time data access.
Healthcare: Healthcare providers use Oracle RAC to support electronic health records (EHR) systems. This ensures that patient data is always accessible, improving the quality of care and operational efficiency.
Retail: Retailers use Oracle RAC to manage customer data, inventory, and sales transactions. By ensuring high availability and scalability, RAC helps retailers provide seamless shopping experiences and analyze customer behavior effectively.
Benefits of Oracle RAC Architecture and Components
The architecture of Oracle RAC provides several benefits that enhance the performance and reliability of database systems:
High Availability: Oracle RAC ensures that the database remains operational even if one or more nodes fail. The remaining nodes continue to function, providing uninterrupted access to data. This is crucial for businesses that require constant availability to maintain operations and customer satisfaction.
Scalability: Oracle RAC allows for horizontal scaling by adding more nodes to the cluster. As demand for database resources grows, additional servers can be added to handle the increased load. This flexibility enables businesses to scale their database infrastructure in response to changing needs.
Load Balancing: RAC distributes workloads across all available nodes, ensuring efficient use of resources. This prevents any single node from becoming a bottleneck, enhancing overall performance and reliability.
Improved Performance: The use of shared storage and cache fusion allows for faster data access and reduced disk I/O. This results in improved performance and quicker response times for database operations.
Managing Oracle RAC Architecture
Effective management of Oracle Real Application Cluster includes monitoring performance, managing faults, and performing regular maintenance.
Performance Monitoring and Tuning
Using tools like Oracle Enterprise Manager, administrators can monitor the performance of the cluster and make necessary adjustments to optimize performance. For instance, to check the status of the database, you can use:
srvctl status database -d exampledb
This command provides the current status of the specified database, helping administrators monitor its health and performance. Regular performance monitoring and tuning are essential to maintain the efficiency of the Oracle RAC Architecture.
Fault Management
Implementing fault tolerance and recovery strategies is crucial for ensuring high availability. Administrators can check the status of the cluster using the following command:
crsctl check cluster -all
This command checks the health of all cluster components, ensuring that the system is functioning correctly and identifying any potential issues. In an Oracle RAC Architecture, fault management ensures that the system can recover quickly from failures.
Cluster Maintenance
Regular maintenance tasks include applying updates and patches to the Oracle Real Application Cluster software. The following command can be used to apply a patch:
opatch auto <patch_id>
This command applies the specified patch to the entire cluster, ensuring that all nodes are updated simultaneously, minimizing downtime and maintaining system consistency. Regular maintenance is essential to keep the Oracle RAC Architecture running smoothly and securely.
RAC Administration
Show database configurations, including SPFILE and PASSWORD FILE:
srvctl config database -db exampledb
This command shows the current configuration of the database, including the SPFILE and PASSWORD FILE. It is useful for administrators to review and verify the configuration settings of the Oracle RAC Architecture.
Starting and stopping instances:
Start an instance in an Oracle Real Application Cluster environment:
srvctl start instance -db db_unique_name -node node_name -instance instance_name_list
This command starts a specific instance on a particular node within the Oracle RAC Architecture. For example:
srvctl start instance -db orcl -instance orcl1,orcl2
Stop an instance:
srvctl stop instance -db orcl -instance orcl1,orcl2
This command stops a specific instance in the Oracle RAC Architecture. It is useful for maintenance tasks or shutting down instances that are not needed.
Start the database:
srvctl start database -db orcl -startoption open
This command starts the entire database in the Oracle RAC Architecture, making it available for user connections and operations.
Starting a pluggable database and service across servers:
Add a service linked to the server pool and containing the PDB:
srvctl add service -db exampledb -pdb pdbexample -service plug -serverpool prdpool
This command adds a new service to the Oracle RAC Architecture that is linked to a server pool and a pluggable database (PDB). It ensures that the PDB is accessible through the specified service.
Start the service:
srvctl start service -db exampledb -service plug
This command starts the specified service in the Oracle RAC Architecture, making the PDB accessible to users.
Stop the service:
srvctl stop service -db exampledb -service plug
This command stops the specified service in the Oracle RAC Architecture, preventing access to the PDB through that service.
Check configuration:
srvctl config database -db exampledb -a
This command provides a detailed configuration report for the specified database in the Oracle RAC Architecture. It includes information about instances, services, and other database settings.
Check resources running in ORACLE_HOME:
srvctl status home -oraclehome /u01/app/oracle/19.0.0 -statefile ~/stat1.dmp -node host1
This command checks the status of all resources running in the specified ORACLE_HOME directory on a specific node. It is useful for monitoring the health and status of the Oracle RAC Architecture environment.
Stop and start resources in ORACLE_HOME:
Stop resources:
srvctl stop home -oraclehome /u01/app/oracle/19.0.0 -statefile ~/stat1.dmp -node host1
This command stops all resources in the specified ORACLE_HOME directory and saves their current state to a state file. It is useful for maintenance and troubleshooting tasks.
Start resources based on state file:
srvctl start home -oraclehome /u01/app/oracle/19.0.0 -statefile ~/stat1.dmp -node host1
This command starts all resources in the specified ORACLE_HOME directory based on the state saved in the state file. It ensures that the Oracle RAC Architecture environment is restored to its previous state.
Change Management Policy for planned maintenance:
srvctl modify database -db exampledb -policy manual
This command changes the management policy of the specified database to manual, preventing automatic startup and shutdown during planned maintenance windows. It is useful for controlling the behavior of the Oracle RAC Architecture during maintenance.
Modifying Parameters
Each Oracle RAC Architecture instance uses a PFILE on the local node, which points to the SPFILE located in shared storage:
[oracle@host1 dbs]$ pwd
/u01/app/oracle/19.0.0/dbs
[oracle@host1 dbs]$ cat initexampledb1.ora
SPFILE='+DATA/exampledb/spfileexampledb.ora'
Modify parameters:
Set a parameter temporarily:
ALTER SYSTEM SET parameter=value SCOPE=MEMORY SID='<sid|*>';
This command sets a parameter value temporarily in memory for a specific instance or all instances in the Oracle RAC Architecture.
Reset a parameter to default temporarily:
ALTER SYSTEM RESET parameter SCOPE=MEMORY SID='<sid>';
This command resets a parameter to its default value temporarily in memory for a specific instance in the Oracle RAC Architecture.
Reset a parameter to default in the SPFILE:
ALTER SYSTEM RESET parameter SCOPE=SPFILE SID='<sid>';
This command resets a parameter to its default value in the SPFILE for a specific instance in the Oracle RAC Architecture. It ensures that the change is persistent across instance restarts.
Quiesce the Database
Restricting the database to prevent DML operations, connections, backups, etc.:
ALTER SYSTEM QUIESCE RESTRICTED;
This command restricts the database, preventing Data Manipulation Language (DML) operations, new connections, and backups. Only DBA users can log in during this state. It is useful for maintenance tasks that require a stable and consistent database state.
Deactivate quiesce mode:
ALTER SYSTEM UNQUIESCE;
This command deactivates the quiesce mode, allowing normal database operations, connections, and backups to resume.
Using GV$ Views to Manage RAC Architecture and its components
For example, to kill a session:
ALTER SYSTEM DISCONNECT SESSION '140,3340,@2';
This command disconnects a specific session in the Oracle RAC Architecture. The ‘@2’ indicates the instance number where the session is running. It is useful for managing and troubleshooting problematic sessions.
Checkpoint in RAC Architecture
Affect only the current instance:
ALTER SYSTEM CHECKPOINT LOCAL;
This command triggers a checkpoint operation in the current instance of the Oracle RAC Architecture, ensuring that the system writes all modified data blocks to disk.
Affect all instances in the cluster:
ALTER SYSTEM CHECKPOINT;
This command triggers a checkpoint operation across all instances in the Oracle RAC Architecture, ensuring that the system writes all modified data blocks to disk on all nodes.
Switch Logfile in RAC
Affect only the current instance:
ALTER SYSTEM SWITCH LOGFILE;
This command switches the log file for the current instance in the Oracle RAC Architecture, forcing a log file switch and archival of the current redo log file.
Force a global switch:
ALTER SYSTEM ARCHIVE LOG CURRENT;
This command forces a global log file switch across all instances in the Oracle RAC Architecture, ensuring that all redo log files are archived.
Convert RAC One Node Database to RAC
srvctl convert database -db exampledb -dbtype RAC -node node1
This command converts a RAC One Node database to a full RAC database, adding the specified node to the cluster. It is useful for scaling the database environment to multiple nodes.
Add instances:
srvctl add instance -db exampledb -instance exampledb_2 -node node2
This command adds a new instance to the specified database on the given node in the Oracle RAC Architecture, increasing its capacity and fault tolerance.
RAC and Multitenant
Starting and Stopping Pluggable Databases
Start a PDB on a specific instance:
ALTER PLUGGABLE DATABASE pdb2 OPEN INSTANCES = ('instance2');
This command opens the specified pluggable database (PDB) on the given instance within the Oracle RAC Architecture. If instances are not specified, it opens the PDB only on the current instance.
Start a PDB on all instances:
ALTER PLUGGABLE DATABASE ALL OPEN INSTANCE=ALL;
This command opens all pluggable databases in the container database (CDB) on all instances of the Oracle RAC Architecture, ensuring that all PDBs are accessible across the cluster.
Stop a PDB on all instances:
ALTER PLUGGABLE DATABASE ALL CLOSE INSTANCE=ALL;
This command closes all pluggable databases in the container database (CDB) on all instances of the Oracle RAC Architecture, preventing access to the PDBs.
Stop a PDB in the current instance and open it in another:
ALTER PLUGGABLE DATABASE pdb2 CLOSE RELOCATE TO 'instance2';
This command closes the specified pluggable database (PDB) in the current instance and opens it in the specified instance within the Oracle RAC Architecture, effectively relocating the PDB.
Create a PDB from SEED or Clone in CDB
Create:
CREATE PLUGGABLE DATABASE pdb2 ADMIN USER admin1 IDENTIFIED BY "password" ROLES = (CONNECT) FILE_NAME_CONVERT = ('PDB$SEEDdir', 'PDB2dir');
This command creates a new pluggable database (PDB) from the seed template in the container database (CDB). The new PDB is created with the specified administrative user and file name conversion settings.
Clone:
CREATE PLUGGABLE DATABASE pdb2 FROM pdb1;
This command clones an existing pluggable database (PDB) to create a new PDB. The source PDB needs to be in READ ONLY mode in all instances before cloning.
Drop a PDB from a CDB RAC
Remove dynamic services:
srvctl remove service -db cdb1 -service mypdb1serv
This command removes a specified service associated with a pluggable database (PDB) in the container database (CDB). Removing services is a necessary step before dropping a PDB.
Close the PDB in all instances:
ALTER PLUGGABLE DATABASE pdb1 CLOSE INSTANCES = ALL;
This command closes the specified pluggable database (PDB) in all instances of the Oracle RAC Architecture, ensuring no one uses it before dropping it.
Drop the PDB:
DROP PLUGGABLE DATABASE pdb1 INCLUDING DATAFILES;
This command drops the specified pluggable database (PDB) and removes all its associated data files from the container database (CDB). This action is irreversible and should be performed with caution.
RAC One Node Database Administration
Show database configurations, including SPFILE and PASSWORD FILE:
srvctl config database -db exampledb
This command shows the current configuration of the database, including the SPFILE and PASSWORD FILE. It is useful for administrators to review and verify the configuration settings of the Oracle RAC Architecture.
Convert RAC database to RAC One Node:
Check the status of the RAC database:
srvctl status database -db orcl
This command checks the status of the specified RAC database, providing information about the instances and their current state.
Stop instances of the RAC database (leave only one active):
srvctl stop instance -f -d orcl -node host2
This command stops a specific instance in the Oracle RAC Architecture, leaving only one instance active. It is a necessary step before converting a RAC database to RAC One Node.
Check the status again:
srvctl status database -db orcl
This command checks the status of the specified RAC database components again to ensure that only one instance is active.
Create a dynamic service:
srvctl add service -db orcl -s SERV1 -serverpool orcldb
This command adds a new dynamic service to the specified database in the Oracle RAC Architecture, associating it with a server pool.
Convert the RAC database to RAC One Node:
srvctl convert database -db orcl -c RACONENODE
This command converts the specified RAC database to a RAC One Node configuration, making it a single-node active-passive cluster.
Check the database configuration:
srvctl config database -db orcl
This command shows the current configuration of the database, confirming the conversion to RAC One Node.
Check the status again:
srvctl status database -db orcl
This command checks the status of the specified RAC One Node database, providing information about the instances and their current state.
Perform online relocation:
srvctl relocate database -db orcl -node host2 -w 15 -verbose
This command performs an online relocation of the specified RAC One Node database to another node. The -w 15
option specifies a 15-minute wait time for active sessions to be relocated.
Convert RAC One Node to RAC:
Stop the database:
srvctl stop database -db orcl
This command stops the specified RAC One Node database, preparing it for conversion back to a full RAC configuration.
Convert the database:
srvctl convert database -db orcl -dbtype RAC
This command converts the specified RAC One Node database back to a full RAC configuration, enabling multiple active instances.
Start the database:
srvctl start database -db orcl
This command starts the specified RAC database, making it available for user connections and operations.
Check the status:
srvctl status database -db orcl
This command checks the status of the specified RAC database, providing information about the instances and their current state.
Add an instance to existing nodes if necessary:
srvctl add instance -db orcl -instance orcl3 -node host3
This command adds a new instance to the specified database on the given node in the Oracle RAC Architecture, increasing its capacity and fault tolerance.
Server Pool Management
Remove the server pool:
srvctl remove srvpool -serverpool orcldb
This command removes the specified server pool from the Oracle RAC Architecture, freeing up resources and simplifying management.
Check the status of the server pool:
srvctl status srvpool
This command checks the status of the specified server pool, providing information about its current state and the resources it manages.
Convert Single-Instance to RAC
Using DBCA, Enterprise Manager, or RCONFIG, convert a single-instance database to RAC.
Conclusion
Oracle Real Application Clusters provide a robust solution offering high availability, scalability, and performance for critical database environments. Proper implementation and management of Oracle Real Application Cluster are essential to fully leverage the benefits of this technology. Effective use of RAC Tips ensures the system’s efficiency, stability, and responsiveness.
See more on Oracle’s website!
Be Oracle RAC certified, this world is full of opportunities for qualified DBAs!