Skip to content

Srvctl Remove Database Example

  • by

Srvctl Remove Database

Command srvctl remove database removes the database configuration from the cluster only, it won't remove the datafiles and dependencies in the storage. Most likely, you may want to re-add the database later.

Let's see how we remove a database configuration from the cluster.

Check Database

First of all, let's see what we have in the database configuration.

[oracle@primary01 ~]$ srvctl config database -d orclcdb
Database unique name: ORCLCDB
Database name: ORCLCDB
Oracle home: /u01/app/oracle/product/19.0.0/db_1
Oracle user: oracle
Spfile: +DATA/ORCLCDB/spfile
Password file: +DATA/ORCLCDB/pwfile
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
OSDBA group: dba
OSOPER group: oper
Database instances: ORCLCDB1,ORCLCDB2
Configured nodes: primary01,primary02
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed

It seems OK, but the problem is that the RAC database is still running.

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

PRKO-03141 will be thrown if we're trying to remove a running database

Stop Database

Since we cannot remove a running database from the cluster, so we need to stop it before removing.

[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

Remove Database

Since the database is stop, we can safely remove it from the cluster.

[oracle@primary01 ~]$ srvctl remove database -d orclcdb
Remove the database orclcdb? (y/[n]) y

We type a y to confirm it. Since it just removes the database configuration from the cluster, the terminal control returns to us in a few seconds.

Check Database

Let's see whether it's existing or not.

[oracle@primary01 ~]$ srvctl config database -d orclcdb
PRCD-1120 : The resource for database orclcdb could not be found.
PRCR-1001 : Resource ora.orclcdb.db does not exist

There's nothing left.

Since all database files are preserved in the storage, you can add database back to the cluster by srvctl whenever you need it.

Leave a Reply

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