-MGMTDB -Management Repository

!! 12c feature: Using Management Repository (-MGMTDB) !!
 NOTE     : As with any code, ensure to test this script in a development environment before attempting to run it in production.


Overview
.Management Repository is a single instance database that’s managed by Oracle Clusterware in 12c.
.In 11g this was being stored in berkley database but starting Oracle database 12c it is configured as  Oracle Database Instance
.If the option is selected during GI installation, the database will be configured and managed by GI.
.As it’s a single instance database, it will be up and running on one node in the cluster;
.As it’s managed by GI, in case the hosting node is down, the database will be automatically failed over to other node.
.Management Database will be the central repository to store Cluster Health Monitor (aka CHM/OS, ora.crf) and other data in 12c
.Management database uses the same shared storage as OCR/Voting File (  voting disk size >5G : ( 3.2G+ is being used by MGMTDB – 2G for CHM )
.If Management Database is not selected to be configured during installation/upgrade OUI, all features (Cluster Health Monitor (CHM/OS) etc)  that depend on it will be disabled. Note: there’s no supported procedure to enable Management Database once the GI stack is configured


How to start Management Database
Management Database is managed by GI and should be up and running all the time automatically. In case it’s down for some reason,  the following srvctl command can be used to start it:
Usage: srvctl start mgmtdb [-startoption <start_option>] [-node <node_name>]
Usage: srvctl start mgmtlsnr [-node <node_name>]


[oracle@RAC1]~% ps -ef|grep mdb_pmon
oracle    7580     1  0 04:57 ?        00:00:00 mdb_pmon_-MGMTDB


This is a Oracle single instance which is being managed by Grid Infrastructure and fails over to surviving node if existing node crashes.You can identify the current master using below command

-bash-4.1$ oclumon manage -get MASTER

Master = RAC1


This DB instance can be managed using srvctl commands. Current master can also be identified using status command

$srvctl status mgmtdb
Database is enabled
Instance -MGMTDB is running on node RAC1







We can look at mgmtdb config using

$srvctl config mgmtdb
Database unique name: _mgmtdb
Database name:
Oracle home: /home/oragrid
Oracle user: oracle
Spfile: +OCR/_mgmtdb/spfile-MGMTDB.ora
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Database instance: -MGMTDB
Type: Management


Replace config with start/stop to start/stop database.
Databases files for repository database are stored in same location as OCR/Voting disk

SQL> select file_name from dba_data_files union select member file_name from V$logfile;

FILE_NAME
------------------------------------------------------------
+OCR/_MGMTDB/DATAFILE/sysaux.258.819384615
+OCR/_MGMTDB/DATAFILE/sysgridhomedata.261.819384761
+OCR/_MGMTDB/DATAFILE/sysmgmtdata.260.819384687
+OCR/_MGMTDB/DATAFILE/system.259.819384641
+OCR/_MGMTDB/DATAFILE/undotbs1.257.819384613
+OCR/_MGMTDB/ONLINELOG/group_1.263.819384803
+OCR/_MGMTDB/ONLINELOG/group_2.264.819384805
+OCR/_MGMTDB/ONLINELOG/group_3.265.819384807



We can verify the same using oclumon command

-bash-4.1$ oclumon manage -get reppath

CHM Repository Path = +OCR/_MGMTDB/DATAFILE/sysmgmtdata.260.819384687




Since this is stored at same location as Voting disk, if you have opted for configuring Management database, you will need to use voting disk with size >5G (3.2G+ is being used by MGMTDB). During GI Installation ,I had tried adding voting disk of 2G but it failed saying that it is of insufficient size. Error didnot indicate that its needed for Management repository but now I think this is because of repository sharing same location as OCR/Voting disk.
Default (also Minimum) size for CHM repository is 2048 M . We can increase respository size by issuing following command

-bash-4.1$ oclumon manage -repos changerepossize 4000
The Cluster Health Monitor repository was successfully resized.The new retention is 266160 seconds.