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
- 1 RAC components
- 2 RAC commands
- 3 Prevent cluster services from starting up on boot
- 4 Re-enable cluster services
- 5 List the resources under cluster control
- 5.1 Stop one instance of a RAC database
- 5.2 Start an ASM instance on a specific node
- 5.3 Stop all instances of a RAC database
- 5.4 Stop ASM on a RAC node
- 5.5 Stop all node applications on a RAC node
- 5.6 Status of an ASM instance on a RAC node
- 5.7 Status of an ASM instance on a RAC node
- 5.8 How to tell if database is a RAC cluster
- 5.9 Show session distribution across the RAC nodes
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.
Cluster 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
To find the correct home, can also search /etc/oratab for the relevant ASM instance and use . oraenv
export ORA_CRS_HOME=/u01/app/12.1.0.2/grid $ORA_CRS_HOME/bin/crsctl start crs $ORA_CRS_HOME/bin/crsctl stop crs
Prevent cluster services from starting up on boot
$ORA_CRS_HOME/bin/crsctl disable crs
Re-enable cluster services
$ORA_CRS_HOME/bin/crsctl enable crs
List the resources under cluster control
$ORA_CRS_HOME/bin/crs_stat -t
Stop one instance of a RAC database
srvctl stop instance –d <db_name> –i <instance_name>
Start an ASM instance on a specific node
srvctl start instance –n <node_name> e.g. srvctl start prodctl –n asmnode1
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> e.g. srvctl stop asm –n asmnode1 -o immediate
Stop all node applications on a RAC node
srvctl stop nodeapps –n <rac node>
Status of an ASM instance on a RAC node
srvctl status asm -n oranode1
Status of an ASM instance on a RAC node
srvctl status asm -n oranode1 srvctl status asm -n oranode2
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 /