From 12c onwards, MGMTDB which is known as GRID INFRASTRUCTURE MANAGEMENT REPOSITORY( GIMR) , stores diagnostic and performance related data for GRID infrastructure.

This MGMTDB is created as part of oracle grid installation. However there might be some instances where mgmtdb gets corrupted or requirement is to move the database to another diskgroup, then solution is to drop the mgmtdb and create the same again. Below steps can be followed sequentially to achieve the solution.

ENVIRONMENT    -> 2 node 12.1.0.2 GRID setup.(hostdb1-6,hostdb2-6)
GRID_OWNER     -> oracle
GRID_HOME      -> /gridapp/app/oracle/product/grid12c
MGMT_DISKGROUP -> +MGMT

1. Find on which node mgmt db is running:

MGMT always runs only on one node.

[email protected]:~$ srvctl status mgmtdb
Database is enabled
Instance -MGMTDB is running on node hostdb1-6

2. Stop and disable CRF component as root user. ( on both the nodes)

-- ON NODE 1:
[email protected]# echo $ORACLE_HOME
/gridapp/app/oracle/product/grid12c


[email protected]:~# cd /gridapp/app/oracle/product/grid12c/bin

[email protected]:/gridapp/app/oracle/product/grid12c/bin# ./crsctl stop res ora.crf -init
CRS-2673: Attempting to stop 'ora.crf' on 'hostdb1-6'
CRS-2677: Stop of 'ora.crf' on 'hostdb1-6' succeeded

[email protected]:/gridapp/app/oracle/product/grid12c/bin# ./crsctl modify res ora.crf -attr ENABLED=0 -init




-- ON NODE 2:

[email protected]:~# cd /gridapp/app/oracle/product/grid12c/bin

[email protected]:/gridapp/app/oracle/product/grid12c/bin#  ./crsctl stop res ora.crf -init
CRS-2673: Attempting to stop 'ora.crf' on 'hostdb2-6'
CRS-2677: Stop of 'ora.crf' on 'hostdb2-6' succeeded

[email protected]:/gridapp/app/oracle/product/grid12c/bin#  ./crsctl modify res ora.crf -attr ENABLED=0 -init

3. Delete the mgmt db ( from grid owner)

- In our setup grid owner is oracle

[email protected]:~$ cd $ORACLE_HOME/bin

[email protected]:...app/oracle/product/grid12c/bin$ dbca -silent -deleteDatabase -sourceDB -MGMTDB
Connecting to database
4% complete
9% complete
14% complete
19% complete
23% complete
28% complete
47% complete
Updating network configuration files
48% complete
52% complete
Deleting instance and datafiles
76% complete
100% complete
Look at the log file "/gridapp/app/grid/cfgtoollogs/dbca/_mgmtdb0.log" for further details.
[email protected]:...app/oracle/product/grid12c/bin$

4. Now create the NEW MGMT container DB ( ONLY ONE ONE NODE)

dbca -silent -createDatabase -sid -MGMTDB -createAsContainerDatabase true -templateName MGMTSeed_Database.dbc -gdbName _mgmtdb
-storageType ASM -diskGroupName +MGMTDB -datafileJarLocation /gridapp/app/oracle/product/grid12c/assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -skipUserTemplateCheck

[email protected]:...app/oracle/product/grid12c/bin$ dbca -silent -createDatabase -sid -MGMTDB -createAsContainerDatabase true -templateName MGMTSeed_Database.dbc -gdbName _mgmtdb
-storageType ASM -diskGroupName +MGMTDB -datafileJarLocation /gridapp/app/oracle/product/grid12c/assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -skipUserTemplateCheck


Registering database with Oracle Grid Infrastructure
5% complete
Copying database files
7% complete
9% complete
16% complete
23% complete
30% complete
37% complete
41% complete
Creating and starting Oracle instance
43% complete
48% complete
49% complete
50% complete
55% complete
60% complete
61% complete
64% complete
Completing Database Creation
68% complete
79% complete
89% complete
100% complete
Look at the log file "/gridapp/app/grid/cfgtoollogs/dbca/_mgmtdb/_mgmtdb4.log" for further details.

5. Now create the NEW MGMT pluggable DB ( ONLY ONE ONE NODE)

dbca -silent -createPluggableDatabase -sourceDB -MGMTDB -pdbName preom -createPDBFrom RMANBACKUP -PDBBackUpfile /gridapp/app/oracle/product/grid12c/assistants/dbca/templates/mgmtseed_pdb.dfb -PDBMetadataFile /gridapp/app/oracle/product/grid12c/assistants/dbca/templates/mgmtseed_pdb.xml -createAsClone true

[email protected]:...app/oracle/product/grid12c/bin$ dbca -silent -createPluggableDatabase -sourceDB -MGMTDB -pdbName preom -createPDBFrom RMANBACKUP -PDBBackUpfile /gridapp/app/oracle/product/grid12c/assistants/dbca/templates/mgmtseed_pdb.dfb -PDBMetadataFile /gridapp/app/oracle/product/grid12c/assistants/dbca/templates/mgmtseed_pdb.xml -createAsClone true


[Finalizer] [ 2020-08-13 19:40:10.915 AST ] [ClusterUtil.finalize:117]  ClusterUtil: finalized called for [email protected]
Creating Pluggable Database
4% complete
12% complete
21% complete
38% complete
55% complete
85% complete
Completing Pluggable Database Creation
100% complete
Look at the log file "/gridapp/app/grid/cfgtoollogs/dbca/_mgmtdb/preom/_mgmtdb2.log" for further details.
[email protected]:...app/oracle/product/grid12c/bin$


6. Check the MGMTDB status:

[email protected]:...app/oracle/product/grid12c/bin$ srvctl status mgmtdb
Database is enabled
Instance -MGMTDB is running on node hostdb1-6

7 . Run the mgmtca config tool: ( only on node node)

[email protected]:...app/oracle/product/grid12c/bin$ which mgmtca
/gridapp/app/oracle/product/grid12c/bin/mgmtca
[email protected]:...app/oracle/product/grid12c/bin$ mgmtca

8 . Start and enable the CRF component ( ON BOTH NODES)- Run as root user

-- ON NODE 1:

[email protected]:~#  cd /gridapp/app/oracle/product/grid12c
[email protected]:/gridapp/app/oracle/product/grid12c# cd bin
[email protected]:/gridapp/app/oracle/product/grid12c/bin# ./crsctl modify res ora.crf -attr ENABLED=1 -init
[email protected]:/gridapp/app/oracle/product/grid12c/bin# ./crsctl start res ora.crf -init
CRS-2672: Attempting to start 'ora.crf' on 'hostdb1-6'
CRS-2676: Start of 'ora.crf' on 'hostdb1-6' succeeded


-- ON NODE 2:

[email protected]:~#  cd /gridapp/app/oracle/product/grid12c
[email protected]:/gridapp/app/oracle/product/grid12c# cd bin
[email protected]:/gridapp/app/oracle/product/grid12c/bin# ./crsctl modify res ora.crf -attr ENABLED=1 -init
[email protected]:/gridapp/app/oracle/product/grid12c/bin# ./crsctl start res ora.crf -init
CRS-2672: Attempting to start 'ora.crf' on 'hostdb2-6'
CRS-2676: Start of 'ora.crf' on 'hostdb2-6' succeeded


9 . Do post check:

[email protected]:~$ export ORACLE_SID=-MGMTDB
[email protected]:~$ s

SQL*Plus: Release 12.1.0.2.0 Production on Thu Aug 13 21:36:41 2020

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management and Advanced Analytics options

SQL> select comp_id,status from dba_registry;

COMP_ID                        STATUS
------------------------------ --------------------------------------------
OWM                            VALID
XDB                            VALID
CATALOG                        VALID
CATPROC                        VALID
RAC                            OPTION OFF

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PREOM                          READ WRITE NO


MGMT ORACLE 12CORACLE RAC