Oracle - Day 22
Oracle - Day 22
Oracle Real Application Clusters (RAC) presents unique challenges and opportunities in backup and
recovery due to its multi-instance architecture. Proper strategies ensure data consistency, minimize
downtime, and protect against data loss in a clustered environment.
a. Types of Backups
o A comprehensive backup of all datafiles, control files, and optionally, archived redo
logs.
2. Incremental Backup:
o Backs up only blocks changed since the last backup (level 1) or since the last full
backup (level 0).
o Essential for recovery. SPFILE and control files should be backed up frequently.
b. Backup Locations
c. Backup Frequency
• Depends on RTO (Recovery Time Objective) and RPO (Recovery Point Objective).
• RMAN is RAC-aware and coordinates backups across all instances in the cluster.
• Automatic Channel Allocation: Allocates channels across all RAC instances for parallelism.
1
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
BACKUP DATABASE PLUS ARCHIVELOG;
}
a. Instance Recovery
• Recovery Process:
o Surviving instances apply redo logs for uncommitted changes from the failed
instance.
b. Media Recovery
• Recovery Process:
RESTORE DATAFILE 3;
RECOVER DATAFILE 3;
c. RAC-Specific Challenges
• Redo Log Coordination: All instances write to a common set of redo log files.
• Clusterwide Data Consistency: Recovery must ensure consistency across all nodes.
2
4. Flashback Technology and Its Usage in RAC
Flashback features allow for fast recovery from logical errors, such as accidental deletes or updates.
a. Flashback Database
• Command:
b. Flashback Query
• Example:
c. Flashback Table
• Example:
• Shared Storage Dependency: Requires sufficient shared storage for the FRA.
b. Cross-Site Clusters
• Extended RAC clusters span multiple data centers for site-level redundancy.
c. Backup Validation
• Command:
3
RESTORE DATABASE VALIDATE;
Real-Time Scenarios
RESTORE DATAFILE 5;
RECOVER DATAFILE 5;
Summary
Oracle RAC provides robust mechanisms for backup and recovery, ensuring high availability and data
integrity in a clustered environment. Key features like RMAN, Flashback Technology, and Data Guard
integration enable efficient handling of failures and logical errors. Proper planning, frequent
validations, and regular disaster recovery drills are essential for maintaining a resilient RAC
environment.
4
Oracle RAC Performance Tuning
Oracle RAC (Real Application Clusters) environments offer high availability and scalability by running
a single database across multiple nodes. However, due to the distributed architecture, tuning RAC for
optimal performance requires attention to specific components such as interconnects, global cache
management, memory, CPU, and storage.
a. Common Bottlenecks
1. Interconnect Latency:
3. I/O Bottlenecks:
4. CPU Starvation:
5. Memory Issues:
b. Symptoms of Bottlenecks
• Tracks ownership and access permissions for database blocks in the buffer cache.
5
o Indicates contention while acquiring a block for modification.
o Occurs when another node is modifying a block and hasn’t released it.
3. gc cr request:
d. Tuning Strategies
• Object Partitioning:
• Affinity-based Services:
o Assign specific services to nodes to localize workload and reduce inter-node traffic.
• Proper Indexing:
o Ensure indexes reduce the number of rows scanned and thus minimize block
transfers.
a. Memory Tuning
• Monitor and adjust the size of the SGA (System Global Area) and PGA (Program Global
Area).
b. CPU Tuning
a. Monitoring Interconnect
• Use the oradebug ipc command to view interconnect traffic and diagnostics.
6
SELECT event, total_waits, time_waited
FROM gv$system_event
WHERE event LIKE 'gc%';
b. Tuning Interconnect
1. Hardware:
2. Network Configuration:
3. Oracle Configuration:
a. Shared Storage
• Use ASM (Automatic Storage Management) for better performance and management.
b. I/O Distribution
c. Monitoring I/O
d. Tuning I/O
7
o Use multiple TEMP tablespaces to distribute temporary I/O load.
3. ASM Striping:
Real-Time Scenarios
• Solution:
• Problem: One RAC node shows higher CPU usage than others.
• Solution:
• Solution:
Summary
Oracle RAC performance tuning requires a holistic approach to optimize interconnects, global cache
management, memory, CPU, and storage. By addressing bottlenecks, ensuring efficient resource
distribution, and using RAC-specific features like Oracle Resource Manager, affinity-based services,
and ASM, you can achieve a balanced and highly performant RAC environment.
8
Oracle RAC Administration and Maintenance
Administering and maintaining an Oracle RAC (Real Application Clusters) environment involves tasks
related to managing instances, clusterware, storage, patching, service management, and monitoring.
RAC environments are more complex than single-instance databases due to their distributed nature,
requiring specialized tools and techniques.
• Oracle Enterprise Manager provides a centralized console to manage RAC databases and
infrastructure.
3. Instance Management:
o Start/stop instances across the RAC cluster using the "Instances" tab.
3. Voting Disks:
b. Maintenance Tasks
9
1. Verifying Clusterware Health:
o Backup OCR:
ocrconfig -manualbackup
o Restore OCR:
1. Patch Compatibility:
2. Applying a Patch:
o Rolling patches allow patching one node at a time, ensuring database availability.
The SRVCTL (Server Control Utility) is used to manage Oracle RAC services and instances.
10
srvctl start instance -d <db_name> -i <instance_name>
2. Manage Services:
o Add a service:
o Start a service:
4. Enable/Disable Services:
1. Clusterware Logs:
/u01/app/11.2.0/grid/log/<hostname>/alert<hostname>.log
o CRS logs:
/u01/app/11.2.0/grid/crs/log/<hostname>/
2. ASM Logs:
/u01/app/oracle/diag/asm/+asm/<instance_name>/trace/
/u01/app/oracle/diag/rdbms/<db_name>/<instance_name>/alert.log
• Set up custom alert thresholds in OEM for metrics like interconnect latency, I/O
performance, and instance availability.
c. Common Scenarios
1. Node Eviction:
11
/u01/app/grid/log/<node>/alert<node>.log
2. Interconnect Latency:
1. Automate Maintenance:
2. Use Redundancy:
4. Monitor Proactively:
Oracle RAC administration and maintenance require a combination of tools (OEM, SRVCTL, CRSCTL)
and best practices to ensure high availability, performance, and scalability. Proper patch
management, monitoring, and service configuration are essential to maintain a robust RAC
environment.
12