RAC srvctl and crsctl useful commands

RAC SRVCTL and CRSCTL useful commands-

Below are some of the commands which we have used regularly in our RAC system. There are many more RAC commands for 11gR2/12c Clusterware and Grid Home you must need to know as a DBA..!

srvctl –help
srvctl –h — a complete list
srvctl modify database -d p20cr120 -s ‘MOUNT’

show parameter CLUSTER_DATABASE
if it is true it is running in RAC
false –no RAC

or

BEGIN
IF dbms_utility.is_cluster_database THEN
dbms_output.put_line(‘Running in SHARED/RAC mode.’);
ELSE
dbms_output.put_line(‘Running in EXCLUSIVE mode.’);
END IF;
END;
/

select instance_name, host_name, archiver, thread#, status from gv$instance
Create the dictionary views needed for RAC by running catclust.sql

SQL> START ?/rdbms/admin/catclust.sql

Database Related Commands:

srvctl start instance -d <db_name> -i <inst_name> —>Starts an instance
srvctl start database -d <db_name> —–>Starts all instances
srvctl stop database -d <db_name> — —->Stops all instances, closes database
srvctl stop instance -d <db_name> -i <inst_name> —–>Stops an instance
srvctl start service -d <db_name> -s <service_name> –>Starts a service
srvctl stop service -d <db_name> -s <service_name> —->Stops a service
srvctl status service -d <db_name> ——>Checks status of a service
srvctl status instance -d <db_name> -i <inst_name> —>Checks an individual instance
srvctl status database -d <db_name> —–>Checks status of all instances
srvctl start nodeapps -n <node_name> –>Starts gsd, vip, listener, and ons
srvctl stop nodeapps -n <node_name> —>Stops gsd, vip and listener

Cluster Related Commands:

crs_stat -t —- Shows HA resource status (hard to read)
crsstat —- Ouptut of crs_stat -t formatted nicely
ps -ef|grep d.bin —– crsd.bin evmd.bin ocssd.bin
crsctl check crs —- CSS,CRS,EVM appears healthy
crsctl stop crs —–Stop crs and all other services
crsctl disable crs* —- Prevents CRS from starting on reboot
crsctl enable crs* —– Enables CRS start on reboot
crs_stop -all — Stops all registered resources
crs_start -all —- Starts all registered resources

Disable/enable Oracle HAS.(High availabilty services)
crsctl enable/disable has —>command to disable automatic startup of the Oracle High Availability Services stack when the server bounce.

check the current settings :
crsctl config has

Stop the Oracle clusterware stack:
With root user:
crsctl stop crs or crsctl stop has

crsctl start crs or crsctl start has

To start all Oracle RAC instances for a database-
$ORACLE_HOME/bin/srvctl start database -d db_name

To shut down all Oracle RAC instances for a database:

$ORACLE_HOME/bin/srvctl stop database -d db_name

Start/stop the Oracle Instance:
$ORACLE_HOME/bin/srvctl start/stop instance –d db_name –i instance_name

Stop/Start Listener-SCAN_LISTENER:

srvctl stop/start listener -n node1
srvctl stop/start listener -n node2
srvctl stop scan_listener

Stop ASM-

srvctl stop asm [-o stop_options] [-f]
srvctl stop asm -n node1

RAC regular commands:

STOP SEQUENCE

COMMAND DESCRIPTION
——————————————————————————————
srvctl stop database -d ORCL STOP DATABASE
srvctl stop instance -d ORCL -i ORCL1 STOP first INSTANCE (skip it if running ‘stop database’ as that will stop both instances)
srvctl stop instance -d ORCL -i ORCL2 STOP second INSTANCE (skip it if running ‘stop database’ as that will stop both instances)
srvctl stop asm -n NODE1 STOP ASM INSTANCES on NODE 1 (In 11G , we have OCR on ASM so we cannot stop ASM, but if you have OCR in NON-ASM you should stop it)
srvctl stop asm -n NODE2 STOP ASM INSTANCES on NODE 2 (In 11G , we have OCR on ASM so we cannot stop ASM, but if you have OCR in NON-ASM you should stop it)
srvctl stop nodeapps -n NODE1 STOP NODEAPPS on NODE 1
srvctl stop nodeapps -n NODE2 STOP NODEAPPS on NODE 2
/etc/init.d/init.crs stop STOP CRS PROCESSES (AS ROOT USER)

START SEQUENCE-

COMMAND DESCRIPTION
——————————————————————————————-
/etc/init.d/init.crs start START CRS PROCESS (AS ROOT USER)
srvctl start asm -n NODE1 START ASM INSTANCE on node 1
srvctl start asm -n NODE2 START ASM INSTANCE on node 2
srvctl start database -d ORCL START DATABASE
srvctl start instance -d ORCL -i ORCL1 START first INSTANCE (skip it if running ‘start database’ as that will start both instances)
srvctl start instance -d ORCL -i ORCL2 START second INSTANCE (skip it if running ‘start database’, as taht will start both instances)
srvctl start nodeapps -n NODE1 START NODEAPPS on NODE1
srvctl start nodeapps -n NODE2 START NODEAPPS ON NODE2

OTHER USEFUL COMMANDS-

COMMAND DESCRIPTION
———————————————————————
crsctl status resource -t Clusterware Resource Status Check
srvctl status database -d ORCL STATUS OF DATABASE
srvctl stop listener -l LISTENER_NAME STOP A LISTENER
srvctl start listener -l LISTENER_NAME START A LISTENER
crsctl stop has stop all the clusterware services/ resources on a specific node (including DB and listener) (run as root)
crsctl start has start all the clusterware services/ resources on a specific node (including DB and listener) (run as root)
crsctl stop cluster -all to stop csr services on all nodes of clusterware (run as root)
crsctl start cluster -all to start crs services on all nodes of clusterware (run as root)
crsctl check has to check if ohasd is running/ stopped (run as root)
crsctl enable has enable Oracle High Availability Services to autostart (run as root)
crsctl disable has disable Oracle High Availability Services autostart (run as root)
crsctl config has check if Oracle High Availability Services autostart is enabled/ disabled (run as root)
srvctl status nodeapps to check the status of services on all nodes
crsctl stop crs stop all the clusterware services/ resources ON THAT NODE! (run as root)
crsctl start crs start all the clusterware services/ resources ON THAT NODE! (run as root)
cluvfy comp scan -verbose Verifying scan status scan_listener
srvctl config scan_listener Verifying scan port
srvctl relocate scan -i 1 -n NODE1 Relocate scan listener 1 to the mentioned node

Leave a Reply

Your email address will not be published. Required fields are marked *