RAC
Real Application Clusters (RAC) is an clustering solution whereby multiple Oracle instances can communicate with one database located on shared storage.
Datafiles and controlfiles are shared but each instance will have its own redo log files and undo tablespace.
Contents
RAC components
Virtual IP
A virtual IP address is an IP address setup to "float" between the real IP addresses associated with each instance in the cluster. If the IP address assigned to the virtual IP becomes unavailable, the IP address from the still available instance will be assigned to the virtual IP thus maintaining database availability for the users.
Voting Disk
A Voting Disk is a file on a shared filesystem. It maintains a list of available cluster nodes and can resolve split-brain scenarios.
All instances write to the voting disk to indicate that they are still active.
luster Registry
The Cluster Registry (OCR) is used to store cluster wide settings and status information such as node names, IP and VIP addresses, voting disk locations, node applications, database names, instance names, listener names, etc.
Clusterware processes
A RAC cluster consists of the following daemons
- crsd – Cluster Resource Services Daemon
- cssd – Cluster Synchronisation Services Daemon
- evmd – Event Manager Daemon
RAC commands
Stop and start the clusterware services
export ORA_CRS_HOME=/u01/app/12.1.0.2/grid $ORA_CRS_HOME/bin/crsctl start $ORA_CRS_HOME/bin/crsctl stop
Stop one instance of a RAC database
srvctl stop instance –d <db_name> –i <instance_name>
Stop all instances of a RAC database
srvctl stop instance –d <db_name>
Stop ASM on a RAC node
srvctl stop asm –n <rac node>
Stop all node applications on a RAC node
srvctl stop nodeapps –n <rac node>
How to tell if database is a RAC cluster
This will be TRUE if RAC database
show parameter cluster
or, the GV$ views will show more than 1 record
select * from gv$instance;
INST_ID INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION STARTUP_T STATUS PAR THREAD# ARCHIVE LOG_SWITCH_WAIT LOGINS SHU DATABASE_STATUS INSTANCE_ROLE ACTIVE_ST BLO CON_ID INSTANCE_MO EDITION FAMILY
---------- --------------- ---------------- ---------------------------------------------------------------- ----------------- --------- ------------ --- ---------- ------- --------------- ---------- --- ----------------- ------------------ --------- --- ---------- ----------- ------- --------------------------------------------------------------------------------
2 2 DEV32 oda02-rac 12.1.0.2.0 20-JUL-16 OPEN YES 2 STARTED ALLOWED NO ACTIVE PRIMARY_INSTANCE NORMAL NO 0 REGULAR EE
1 1 DEV31 oda01-rac 12.1.0.2.0 13-OCT-16 OPEN YES 1 STARTED ALLOWED NO ACTIVE PRIMARY_INSTANCE NORMAL NO 0 REGULAR EE
2 rows selected.
or
set serverout on
begin
if dbms_utility.is_cluster_database then
dbms_output.put_line('Running in RAC mode.');
else
dbms_output.put_line('Running in EXCLUSIVE mode.');
end if;
end;
/
or
select * from v_$active_instances;
or
select * from v_$thread;
Show session distribution across the RAC nodes
select inst_id , count(*) sessions from gv$session where type = 'USER' group by inst_id /