Database AdministrationUnit 109 min read
Oracle RAC, ASM, and Data Guard: High Availability & Scalability
Unit 10 of Database Administration explores Oracle’s advanced high-availability solutions—Real Application Clusters (RAC), Automatic Storage Management (ASM), and Data Guard—covering architecture, implementation, and real-world use cases like Ncell’s 9x7 call-center database or NEPSE’s stock-trading systems.
Core Concepts & Definitions
1. Oracle Real Application Clusters (RAC)
Definition: Oracle RAC is a cluster database architecture that allows a single Oracle database to run across multiple servers (nodes) while presenting a single system image to applications. It enables scalability (horizontal growth) and high availability (failover protection) by distributing database workloads across nodes.
Key Components:
classDiagram
class Node {
+CPU, RAM, OS
+Oracle Instance
}
class Clusterware {
+VIP (Virtual IP)
+CSS (Cluster Synchronization Services)
+GNS (Global Naming Service)
}
class Database {
+Shared Storage (ASM)
+Global Cache (for data consistency)
}
Node "1..*" -- "1" Clusterware : Managed by
Clusterware -- "1" Database : Coordinates
Database -- "1" SharedStorage : UsesHow It Works:
- Shared Storage: All nodes access the same datafiles (via ASM or shared disks).
- Global Cache: Ensures data consistency across nodes using cache fusion (blocks are copied between instances via the interconnect).
- Instance Groups: Each node runs an Oracle instance, but they coordinate via the clusterware (e.g., Oracle Clusterware or Grid Infrastructure).
Example: Ncell’s 9x7 Call-Center Database Ncell uses RAC to handle millions of daily transactions (billing, customer queries) without downtime. If one node fails, the workload shifts seamlessly to others, ensuring zero call drops during peak hours (e.g., Diwali sales).
2. Oracle Automatic Storage Management (ASM)
Definition: ASM is a volume manager and filesystem that simplifies storage administration by pooling disks into disk groups. It automatically strips, mirrors, and balances data across disks for performance and redundancy.
Key Features:
- Disk Groups: Logical storage units (e.g.,
DATA,RECO,FRA). - Redundancy: Supports normal (mirrored), high (triple-mirrored), or external redundancy.
- Automatic Management: Handles rebalancing, failover, and growth without manual intervention.
ASM Architecture:
Example: Daraz’s Order Processing System Daraz uses ASM to store millions of product catalogs and orders across multiple servers. If a disk fails, ASM automatically rebalances data, ensuring no downtime during Black Friday sales.
3. Oracle Data Guard
Definition: Data Guard provides disaster recovery and high availability by maintaining one or more standby databases that can take over if the primary database fails. It uses log shipping or real-time replication to keep standbys synchronized.
Key Components:
classDiagram
class PrimaryDatabase {
+Redo Logs
+Archived Logs
}
class StandbyDatabase {
+Managed Recovery Process (MRP)
+Apply Logs
}
class DataGuardBroker {
+Configuration Management
+Failover Automation
}
PrimaryDatabase --> StandbyDatabase : "Ships redo logs"
StandbyDatabase --> PrimaryDatabase : "Applies logs (MRP)"
DataGuardBroker ..> PrimaryDatabase : "Manages"
DataGuardBroker ..> StandbyDatabase : "Manages"Modes of Data Guard:
| Mode | Description | Use Case |
|---|---|---|
| Physical Standby | Block-level replication (highest performance). | Disaster recovery. |
| Logical Standby | SQL-level replication (supports queries). | Reporting/offloading reads. |
| Snapshot Standby | Read-only standby (can apply redo logs). | Testing patches. |
| Active Data Guard | Real-time read access on standby (Oracle Enterprise Edition only). | High-availability reporting. |
Example: NEPSE’s Stock Trading Database NEPSE uses Data Guard to replicate trading data to a standby site in Lalitpur. If the primary database crashes (e.g., due to a power outage), the standby takes over in <30 seconds, ensuring no trading halts.
Comparative Analysis: RAC vs. ASM vs. Data Guard
| Feature | Oracle RAC | Oracle ASM | Oracle Data Guard |
|---|---|---|---|
| Purpose | Scalability & high availability | Storage management & redundancy | Disaster recovery & failover |
| Key Technology | Clusterware, global cache | Disk groups, redundancy | Redo transport, MRP |
| Use Case | High-throughput OLTP (e.g., banks) | Simplified storage for RAC/standbys | Backup site for critical databases |
| Cost | High (multiple servers) | Low (uses existing disks) | Medium (standby hardware) |
| Complexity | High (cluster setup) | Medium (disk group management) | Medium (configuration) |
Worked Example: Configuring RAC with ASM for a Bank’s Loan Processing System
Scenario: A bank in Nepal wants to deploy a loan processing system that:
- Handles 10,000 transactions/hour.
- Ensures zero downtime during peak hours (e.g., loan disbursement days).
- Uses shared storage for cost efficiency.
Solution:
- Set up RAC with 3 nodes (each with 16 CPU cores).
- Configure ASM disk groups:
-- Create a disk group for data CREATE DISKGROUP DATA EXTERNAL REDUNDANCY FAILGROUP fg1 DISK '/dev/sdb', '/dev/sdc' FAILGROUP fg2 DISK '/dev/sdd', '/dev/sde'; - Create a RAC database with ASM storage:
CREATE DATABASE loan_db USER SYS IDENTIFIED BY password CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCAL DATAFILE '/u01/app/oracle/oradata/DATA/loan_db/system01.dbf' SIZE 10G SYSAUX DATAFILE '/u01/app/oracle/oradata/DATA/loan_db/sysaux01.dbf' SIZE 5G ... MAXINSTANCES 3; -- Supports 3 nodes - Add Data Guard for disaster recovery:
-- Configure a physical standby DGMGRL> CREATE CONFIGURATION dg_config AS PRIMARY DATABASE IS loan_db_connect; ADD DATABASE loan_standby AS CONNECT IDENTIFIER IS loan_standby;
Result:
- Scalability: The bank can add more nodes during Diwali loan seasons.
- High Availability: If a node fails, transactions automatically reroute.
- Disaster Recovery: The standby database in Kathmandu takes over if the primary site (Lalitpur) fails.
In the Real World
Ncell (Telecom):
- Technology: RAC + ASM
- How it’s used: Ncell’s billing and customer service database runs on RAC to handle millions of daily transactions (top-ups, complaints). ASM ensures data redundancy across multiple servers in Chabahil and Bhaktapur.
- Impact: Zero call drops during network congestion (e.g., during IPL matches).
NEPSE (Stock Exchange):
- Technology: Data Guard
- How it’s used: NEPSE’s trading database has a standby in Lalitpur that syncs in real-time. If the primary database crashes (e.g., due to a cyberattack), the standby takes over in <30 seconds.
- Impact: No trading halts during market volatility (e.g., during budget announcements).
Khalti (Fintech):
- Technology: RAC + ASM
- How it’s used: Khalti’s payment processing system uses RAC to handle 10,000+ transactions per second during Dashain/Tihar. ASM ensures fast disk I/O for transaction logs.
- Impact: No payment failures even during peak festival shopping.
Exam Tip
Diagrams are Mandatory:
- Always draw RAC architecture (nodes + shared storage).
- Show Data Guard modes (physical vs. logical standby).
- Sketch ASM disk groups with redundancy levels.
Command-Based Questions:
- Be ready to write SQL commands for:
- Creating ASM disk groups.
- Configuring RAC instances.
- Setting up Data Guard standby.
- Be ready to write SQL commands for:
Scenario-Based Answers:
- Exams often ask: "How would you design a high-availability system for [X]?"
- Template:
"For [X], I would use [RAC/ASM/Data Guard] because [reason]. The architecture would include [nodes/disk groups/standby sites]. Commands would be [SQL snippets]."
Common Pitfalls:
- Don’t confuse RAC (scalability) with Data Guard (disaster recovery).
- ASM is not a backup tool—use it with RMAN for backups.
- Data Guard’s "Apply Lag" is critical—explain how it affects recovery time.
Based on the TU BIT syllabus for Database Administration (BIT352), unit 10.
Discussion
Loading…