Oracle RAC useful commands: these commands help DBAs to maintain the Oracle RAC environment.
Clusterware (CRSCTL) Commands
crsctl check crs– Checks the status of the Oracle Clusterware stack on the local node.crsctl stat res -t– Displays the status of all cluster resources in tabular format.crsctl stat res -p– Shows detailed configuration of cluster resources.crsctl start crs– Starts Oracle Clusterware on the local node.crsctl stop crs– Stops Oracle Clusterware on the local node.crsctl check cluster -all– Verifies cluster status on all nodes.crsctl get cluster name– Displays the cluster name.
Server Control (SRVCTL) Commands
srvctl config database -d <db_name>– Displays the configuration of a RAC database.srvctl status database -d <db_name>– Shows the status of all instances in the RAC database.srvctl start database -d <db_name>– Starts all instances of the RAC database.srvctl stop database -d <db_name>– Stops all instances of the RAC database.srvctl config instance -d <db_name>– Displays configuration of database instances.srvctl status instance -d <db_name> -i <instance_name>– Shows the status of a specific RAC instance.srvctl start instance -d <db_name> -i <instance_name>– Starts a specific RAC instance.srvctl stop instance -d <db_name> -i <instance_name>– Stops a specific RAC instance.srvctl config nodeapps– Displays configuration of node applications (VIP, GSD, ONS).srvctl status nodeapps– Shows the status of node applications.srvctl start nodeapps– Starts node applications on the local node.srvctl stop nodeapps– Stops node applications on the local node.
ASM (Automatic Storage Management) Commands
srvctl status asm– Displays ASM instance status on all nodes.srvctl start asm– Starts ASM instance on the local node.srvctl stop asm– Stops ASM instance on the local node.asmcmd lsdg– Lists ASM disk groups and their status.asmcmd ls– Lists files in ASM disk groups.asmcmd pwd– Displays current ASM directory path.
SQL Commands for RAC Monitoring
SELECT instance_name, host_name FROM gv$instance;– Lists all RAC instances and their host nodes.SELECT * FROM gv$active_instances;– Displays active RAC instances.SELECT inst_id, status FROM gv$instance;– Shows the status of each instance in the cluster.SELECT * FROM gv$session WHERE inst_id=<n>;– Displays sessions running on a specific instance.SELECT * FROM gv$lock;– Shows global locks across all RAC instances.SELECT * FROM gv$ges_enqueue;– Displays Global Enqueue Service lock information.SELECT * FROM gv$gc_element;– Shows Global Cache elements information.
Diagnostic & Troubleshooting Commands
oifcfg getif– Displays network interface configuration used by Clusterware.olsnodes -n– Lists cluster nodes with their node numbers.olsnodes -s– Shows status of cluster nodes.cluvfy comp cluster -all– Verifies cluster configuration and health.adrci– Launches Automatic Diagnostic Repository command-line tool.
Top Wait Events
SELECT * FROM (SELECT inst_id, event, total_waits, time_waited FROM gv$system_event ORDER BY time_waited DESC) WHERE ROWNUM <= 10; – Shows top wait events across cluster.Blocking & Sessions
-Identifies blocking sessions in RAC.
SELECT inst_id, blocking_instance, sid, serial#, wait_class, seconds_in_wait FROM gv$session WHERE blocking_instance IS NOT NULL;
– Displays sessions holding blocking locks.
SELECT * FROM gv$lock WHERE block = 1;