How to delete MGMTDB?

Introduction

MGMTDB is a repository database that saves Cluster Health Monitor (CHM) data. In Oracle 11g this information was stored in Berkley database ( .bdb files) but starting from Oracle database 12c it is configured as an Oracle single instance database.

In Oracle 12.1.0.1 – GIMR is optional. Whereas in Oracle 12.1.0.2 – it’s mandatory and it’s not supported to be turned off with the exception of Exadata.
I’ve searched a lot to find out why it is not supported to be turned off, but I still do not have that answer. I only know that TFA collects some information from MGMTDB and if we turn it off, it means TFA will not be able to retrieve that information. In 19c GIMR is optional again.

The reason why I want to turn it off is that there are several bugs related to MGMTDB. We have noticed that several customers had performance-related issues because of MGMTDB. The repository database was able to use almost 100% of CPU resources. In addition to this, one customer noticed that MGMTDB increased up to 60GB and exhausted GRID diskgroup where OCR and voting files were located (this size is not normal for 3-node cluster).

More information about Grid Infrastructure Management Repository (GIMR) can be found at 1568402.1

Steps

Please consider that for 12.1.0.2 deleting it is not supported by Oracle, which is not clear why, but it is better to ask Oracle support before doing this.

Instead of deleting a repository, it is better to apply all bug fixes that are related to it. And try to use its intelligence to proactively tune your database. But if you still want to delete it, or at least know how to delete it – then let’s do that, it is not harmful.

1. Update the dependency

CHA has a dependency on mgmtdb:

[root@rac1 ~]# crsctl stat res ora.chad -p | grep mgmt
START_DEPENDENCIES=hard(global:ora.mgmtdb) pullup(global:ora.mgmtdb)
STOP_DEPENDENCIES=hard(global:intermediate:ora.mgmtdb)

If you try to delete mgmtdb without updating the dependency you will get:

image

Clear the dependency by setting the following attributes:

[root@rac1 ~]# crsctl modify resource ora.chad -attr "START_DEPENDENCIES='', STOP_DEPENDENCIES=''" -unsupported

Verify the status:

[grid@rac1 ~]$ srvctl status cha
Oracle Cluster Health Analysis Service is enabled
Oracle Cluster Health Analysis Service is running on nodes: rac1, rac2

2. Delete MGMTDB using dbca

 Identify the node where mgmtdb is running:

[grid@rac1 ~]$ srvctl status mgmtdb
Database is enabled
Instance -MGMTDB is running on node rac1

Connect rac1 and run:

[grid@rac1 ~]$ dbca -silent -deleteDatabase -sourceDB -MGMTDB
[WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
Prepare for db operation
32% complete
Connecting to database
35% complete
39% complete
42% complete
45% complete
48% complete
52% complete
65% complete
Updating network configuration files
68% complete
Deleting instance and datafiles
84% complete
100% complete
Database deletion completed.

Make sure that MGMTDB was deleted

[grid@rac1 ~]$ srvctl status mgmtdb
PRCD-1120 : The resource for database _mgmtdb could not be found.
PRCR-1001 : Resource ora.mgmtdb does not exist

3. Delete the listener called MGMTLSNR 

[grid@rac1 ~]$ srvctl stop mgmtlsnr

[grid@rac1 ~]$ srvctl remove mgmtlsnr