Skip to content
Home » Oracle Database » How Srvctl Stop Database

How Srvctl Stop Database

There're 4 levels that can stop a RAC database, each level has different effect on the RAC system. As for stopping a single-instance database, it may be easier than this.

  1. Instance Level
  2. Database Level
  3. Cluster Level
  4. Server Level

Instance Level

Several ways that can stop on one node's instance.

  1. srvctl stop instance
  2. dbshut
  3. shutdown immediate

srvctl stop instance

The formal way to shutdown only one instance of a RAC database, we use srvctl stop instance command, one of Server Control Utility (SRVCTL) commands. For example, we'd like to stop the database service on node 2.

[oracle@primary01 ~]$ srvctl stop instance -d orclcdb -i ORCLCDB2
[oracle@primary01 ~]$ srvctl status database -d orclcdb
Instance ORCLCDB1 is running on node primary01
Instance ORCLCDB2 is not running on node primary02

We can specify any instance, no matter it's local or remote.

Please note that, the instance name in the command is case-sensitive, you should be careful about it, otherwise, you'll get error PRKO-3032.

dbshut

The traditional command dbshut still works, but you have to make sure /etc/oratab has been configured correctly.

[oracle@primary01 ~]$ vi /etc/oratab
...
ORCLCDB1:/u01/app/oracle/product/19.0.0/db_1:Y

In which, ORCLCDB1 is the local instance name (ORACLE_SID) and /u01/app/oracle/product/19.0.0/db_1 is the ORACLE_HOME. Furthermore, we need a Y in the 3rd field to indicate that the instance can be startup or shutdown through dbstart or dbshut.

We can use it to shutdown the local instance.

[oracle@primary01 ~]$ dbshut
Since ORACLE_HOME is not set, cannot auto-stop Oracle Net Listener
Usage: /u01/app/oracle/product/19.0.0/db_1/bin/dbshut ORACLE_HOME
Processing Database instance "ORCLCDB1": log file /u01/app/oracle/product/19.0.0/db_1/rdbms/log/shutdown.log

The message "ORACLE_HOME is not set" can be ignored, because we don't want to close the local listener.

shutdown immediate

The traditional SQL command can also work here.

SQL> shutdown immediate;

It stops the local instance.

Database Level

srvctl stop database

The formal way to stop a RAC database, we use srvctl stop database command.

[oracle@primary01 ~]$ srvctl stop database -d orclcdb
[oracle@primary01 ~]$ srvctl status database -d orclcdb
Instance ORCLCDB1 is not running on node primary01
Instance ORCLCDB2 is not running on node primary02

All instances of the database are stop by the default stop option. For various situations, you can choose the following stop options:

NORMAL Option

[oracle@primary01 ~]$ srvctl stop database -d orclcdb -o normal

IMMEDIATE Option

[oracle@primary01 ~]$ srvctl stop database -d orclcdb -o immediate

If your default stop option is already IMMEDIATE, then you can omit the option.

ABORT Option

Sometimes, you need a stronger way to stop the database.

[oracle@primary01 ~]$ srvctl stop database -d orclcdb -o abort

Cluster Level

crsctl stop cluster

To shutdown not only the database but also the whole cluster, we can do it at cluster-level.

[root@primary01 ~]# . /home/grid/.bash_profile
[root@primary01 ~]# crsctl stop cluster -all
CRS-2673: Attempting to stop 'ora.crsd' on 'primary01'
CRS-2673: Attempting to stop 'ora.crsd' on 'primary02'
...

The command brings the database down as well as cluster services, but it leaves Oracle High Availability Services (OHAS) online. OHAS can be considered as a heartbeat between nodes.

Server Level

crsctl stop crs

If you want to shutdown all cluster services including OHAS, you should use the following command at server-level. It's the same effect as server shutdown. For example:

Node 1

[root@primary01 ~]# . /home/grid/.bash_profile
[root@primary01 ~]# crsctl stop crs
...

Node 2

[root@primary02 ~]# . /home/grid/.bash_profile
[root@primary02 ~]# crsctl stop crs
...

No service is left.

Leave a Reply

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