1.什么是管理资料库(Management Repository)

管理资料库是12c中oracle clusterware管理的一个单实例数据库。对应的数据库名是MGMTDB。
因为是一个单实例数据库,所以在集群环境中,会运行在其中一个节点上。
该实例由GI管理,当其所在节点down机后,会fail over到其它节点。

2.MGMTDB数据库的用途

MGMTDB是12c中用来存储cluster health monitor(chm/os、ora.crf)数据和其它数据。

3.MGMTDB数据文件存放位置
在12.1中,MGMTDB数据库数据文件默认和OCR/Voting disks文件放在相同的存储。

在12.1.0.1中,GIMR是可选项,如果在安装GI的时候没有选中该选件,之后也不可以再进行配置该功能;
在12.1.0.2中,GIMR选件是必须安装的,安装后不支持取消该功能。

4.查看管理数据库(MGMTDB)的相关资源
(即ora.mgmtdb、ora.MGMTLSNR)

$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRS.dg
ONLINE ONLINE rac12c1 STABLE
ONLINE ONLINE rac12c2 STABLE
ora.DATA.dg
ONLINE ONLINE rac12c1 STABLE
ONLINE ONLINE rac12c2 STABLE
ora.FRA.dg
ONLINE ONLINE rac12c1 STABLE
ONLINE ONLINE rac12c2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE rac12c1 STABLE
ONLINE ONLINE rac12c2 STABLE
ora.asm
ONLINE ONLINE rac12c1 Started,STABLE
ONLINE ONLINE rac12c2 Started,STABLE
ora.net1.network
ONLINE ONLINE rac12c1 STABLE
ONLINE ONLINE rac12c2 STABLE
ora.ons
ONLINE ONLINE rac12c1 STABLE
ONLINE ONLINE rac12c2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac12c1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE rac12c1 169.254.78.212 10.10
.18.141,STABLE
ora.cvu
1 ONLINE ONLINE rac12c1 STABLE
ora.mgmtdb
1 ONLINE ONLINE rac12c1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE rac12c1 STABLE
ora.rac12c.db
1 ONLINE ONLINE rac12c1 Open,STABLE
2 ONLINE ONLINE rac12c2 Open,STABLE
ora.rac12c1.vip
1 ONLINE ONLINE rac12c1 STABLE
ora.rac12c2.vip
1 ONLINE ONLINE rac12c2 STABLE
ora.scan1.vip
1 ONLINE ONLINE rac12c1 STABLE
--------------------------------------------------------------------------------

在OS层查看MGMTDB数据库和监听:

# ps -ef|grep pmon_-MGMTDB
oragrid 24964 1 0 10:48 ? 00:00:00 mdb_pmon_-MGMTDB
# ps -ef|grep MGMTLSNR
oragrid 7236 1 0 10:43 ? 00:00:00 /u01/app/12.1.0/grid/bin/tnslsnr MGMTLSNR -no_crs_notify -inherit

5.如何启动MGMTDB
MGMTDB是由GI管理,应该自动启动并一直运行。
如果由于某种原因down了,使用srvctl工具启动:

$ srvctl start mgmtdb [-startoption <start_option>] [-node <node_name>]
$ srvctl start mgmtlsnr [-node <node_name>] 帮助命令:
$ srvctl start mgmtdb -help Starts the management database. Usage: srvctl start mgmtdb [-startoption <start_option>] [-node <node_name>]
-startoption <start_options> Options to startup command (e.g. OPEN, MOUNT, or "READ ONLY")
-node <node_name> Node name
-help Print usage
$

6.是否有调优、备份MGMTDB的必要
目前官方建议没有必要

7.应该为MGMTDB分配多少磁盘空间
采用外部冗余时:
最小需要:5.2GB(4.5 MGMTGB + 300 MB voting files + 400 MB OCR)。超出4个节点后,每增加一个节点相应需要增加600MB。

更多信息参考:http://docs.oracle.com/database/121/CWLIN/storage.htm#CHDDCAHD

8.操作MGMTDB数据库

#查看MGMTDB当前节点:

$ oclumon manage -get master

Master = rac12c1

#查看状态:

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

#查看配置信息:

$ srvctl config mgmtdb
Database unique name: _mgmtdb
Database name:
Oracle home: <CRS home>
Oracle user: oragrid
Spfile: +CRS/_MGMTDB/PARAMETERFILE/spfile.271.921062487
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Type: Management
PDB name: rac12c_cluster
PDB service: rac12c_cluster
Cluster name: rac12c-cluster
Database instance: -MGMTDB

#连接MGMTDB实例:

$ export ORACLE_SID=-MGMTDB
$ sqlplus / as sysdba
SQL> select file_name from dba_data_files union select member file_name from v$logfile; FILE_NAME
--------------------------------------------------------------------------------
+CRS/_MGMTDB/DATAFILE/sysaux.260.921062323
+CRS/_MGMTDB/DATAFILE/system.261.921062335
+CRS/_MGMTDB/DATAFILE/undotbs1.262.921062349
+CRS/_MGMTDB/ONLINELOG/group_1.264.921062389
+CRS/_MGMTDB/ONLINELOG/group_2.265.921062389
+CRS/_MGMTDB/ONLINELOG/group_3.266.921062389 6 rows selected. SQL>

#查询MGMTDB的路径:

$  oclumon manage -get reppath

CHM Repository Path = +CRS/_MGMTDB/FD9B43BF6A646F8CE043B6A9E80A2815/DATAFILE/sysmgmtdata.272.921062615

  

05-06 05:03