Difference between revisions of "RAC"

From dbawiki
Jump to: navigation, search
(Stop and start the clusterware services)
(Stop and start the clusterware services)
Line 17: Line 17:
 
===RAC commands===
 
===RAC commands===
 
====Stop and start the clusterware services====
 
====Stop and start the clusterware services====
To find the correct home, can also search /etc/oratab for the relevant ASM instance
+
To find the correct home, can also search /etc/oratab for the relevant ASM instance and use . oraenv
 
<pre>
 
<pre>
 
export ORA_CRS_HOME=/u01/app/12.1.0.2/grid
 
export ORA_CRS_HOME=/u01/app/12.1.0.2/grid
$ORA_CRS_HOME/bin/crsctl start
+
$ORA_CRS_HOME/bin/crsctl start crs
$ORA_CRS_HOME/bin/crsctl stop
+
$ORA_CRS_HOME/bin/crsctl stop crs
 +
</pre>
 +
===Prevent cluster services from starting up on boot===
 +
<pre>
 +
$ORA_CRS_HOME/bin/crsctl disable crs
 +
</pre>
 +
===Re-enable cluster services===
 +
<pre>
 +
$ORA_CRS_HOME/bin/crsctl enable crs
 +
</pre>
 +
===List the resources under cluster control===
 +
<pre>
 +
$ORA_CRS_HOME/bin/crs_stat -t
 
</pre>
 
</pre>
  

Revision as of 11:00, 9 January 2017

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.

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>

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
/