Pythian Blog: Technical Track

How to Stop All Database Instances Running From ORACLE_HOME

At times, there may be a requirement to stop database instances, for example, to perform patching. When there is only one database instance running on the server, it is sufficient to stop the instance using srvctl stop instance -d db_unique_name -i instance_names. However, when there are many instances running from the same ORACLE_HOME, it becomes inefficient to stop all the instances one by one. In this case, srvctl stop home can and should be used.
### Usage: srvctl stop home
Usage: srvctl stop home -oraclehome -statefile -node [-stopoption ] [-force]
  -oraclehome Oracle home path
  -statefile Specify a file path for the 'srvctl stop home' command to store the state of the resources
  -node Node name
  -stopoption Stop options for the database. Examples of shutdown options are NORMAL, TRANSACTIONAL, IMMEDIATE, or ABORT.
  -force Force stop
  -help Print usage
 [oracle@ol7-19-rac1 ~]$
 
### Check ALL DB status running from same ORACLE_HOME for NODE:
[oracle@ol7-19-rac1 ~]$ srvctl status database -d cdbrac -v
 Instance cdbrac1 is running on node ol7-19-rac1. Instance status: Open.
 Instance cdbrac2 is running on node ol7-19-rac2. Instance status: Open.
 
 [oracle@ol7-19-rac1 ~]$ srvctl status home -o $ORACLE_HOME -s $ORACLE_HOME/statushome.txt -node ol7-19-rac1
 Database cdbrac is running on node ol7-19-rac1
 
 [oracle@ol7-19-rac1 ~]$ cat $ORACLE_HOME/statushome.txt
 db-cdbrac
 [oracle@ol7-19-rac1 ~]$
 
### STOP ALL DB running from same ORACLE_HOME for NODE:
[oracle@ol7-19-rac1 ~]$ srvctl status database -d cdbrac -v
 Instance cdbrac1 is running on node ol7-19-rac1. Instance status: Open.
 Instance cdbrac2 is running on node ol7-19-rac2. Instance status: Open.
 
 [oracle@ol7-19-rac1 ~]$ srvctl status home -o $ORACLE_HOME -s $ORACLE_HOME/statushome.txt -node ol7-19-rac1
 Database cdbrac is running on node ol7-19-rac1
 
 [oracle@ol7-19-rac1 ~]$ cat $ORACLE_HOME/statushome.txt
 db-cdbrac
 [oracle@ol7-19-rac1 ~]$
 
### START ALL DB running from same ORACLE_HOME for NODE:
[oracle@ol7-19-rac1 ~]$ srvctl start home -o $ORACLE_HOME -s $ORACLE_HOME/stophome.txt -node ol7-19-rac1
 
 [oracle@ol7-19-rac1 ~]$ srvctl status database -d cdbrac -v
 Instance cdbrac1 is running on node ol7-19-rac1. Instance status: Open.
 Instance cdbrac2 is running on node ol7-19-rac2. Instance status: Open.
 [oracle@ol7-19-rac1 ~]$
 
In summary, srvctl stop home can be more efficient when stopping many instances at the same time. In addition, there will be less typing and fewer chances for errors.

Comments (1)

Subscribe by email