在Oracle 12.1.0.1的Grid Infrastructure 的安裝中,可以選擇是否安裝Grid Infrastructure Management Repository (GIMR) 數據庫:MGMTDB. 如下圖:
在Grid Infrastructure 12.1.0.2 中,已經沒有改選項,MIMR 數據庫已經變成了強制選項。
在Oracle 12c 中Management Database 用來存儲Cluster HealthMonitor(CHM/OS,ora.crf) ,Oracle Database QoS Management,Rapid Home Provisioning和其他的數據。
ManagementRepository 是受12c Clusterware 管理的一個單實例,在Cluster 啟動的時會啟動MGMTDG並在其中一個節點上運行,並受GI 管理,如果運行MGMTDG的節點宕機了,GI 會自動把MGMTDB 轉移到其他的節點上。
默認情況,MGMTDB 數據庫的數據文件存放在共享的設備,如OCR/Voting 的磁盤組中,但後期可以移動位置。
在12.1.0.1 中,GIMR 是可選的,如果在安裝GI的時候,沒有選擇Management Database 數據庫,那麼所有依賴的特性,如ClusterHealth Monitor (CHM/OS) 就會被禁用。
當然,在12.1.0.2 中,可以忽略這個問題,因為是強制安裝GIMR了。
另外,對於MGMT 數據庫,在目前的版本中,也不需要手工對其進行備份。
[root@rac1 ~]# crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server Statedetails -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- …… ora.MGMTLSNR 1 ONLINE ONLINE rac2 169.254.142.79 192.1 68.57.6,STABLE ora.mgmtdb 1 ONLINE ONLINE rac2 Open,STABLE …… [root@rac1 ~]#
使用crsctl 命令可以看到ora.mgmtdb和ora.MGMTLSNR。
在操作系統層面,也可以查看到有2個對應的進程:
[root@rac2 ~]# ps -ef| grep pmon_-MGMTDB grid 7452 1 0 14:59 ? 00:00:00 mdb_pmon_-MGMTDB root 7756 7727 0 15:02 pts/4 00:00:00 grep pmon_-MGMTDB [root@rac2 ~]# ps -ef| grep MGMTLSNR grid 7411 1 014:58 ? 00:00:00/u01/gridsoft/12.1.0/bin/tnslsnr MGMTLSNR -no_crs_notify -inherit root 7758 7727 0 15:02 pts/4 00:00:00 grep MGMTLSNR [root@rac2 ~]#
正常情況下,MGMTDB 會在GI 啟動的時候,會自動啟動,但也可以手工管理,直接使用srvctl 操作即可:
Usage: srvctl start mgmtdb[-startoption <start_option>] [-node <node_name>]
一般情況下,是不需要查看MGMT DB的trace的,如果要查看,用如下命令:
[grid@rac2 _mgmtdb]$ pwd /u01/gridbase/diag/rdbms/_mgmtdb [grid@rac2 _mgmtdb]$ ls i_1.mif -MGMTDB [grid@rac2 _mgmtdb]$
進入$ORACLE_BASE下的trace目錄。但是進入-MGMTDB時,要注意,不能直接cd:
[grid@rac2 _mgmtdb]$ cd -MGMTDB -bash: cd: -M: invalid option cd: usage: cd [-L|-P] [dir] [grid@rac2 _mgmtdb]$
必須使用./-MGMTDB,如:
[grid@rac2 _mgmtdb]$ cd ./-MGMTDB [grid@rac2 -MGMTDB]$ ls alert hm incpkg lck metadata metadata_pv sweep cdump incident ir log metadata_dgif stage trace [grid@rac2 -MGMTDB]$ [grid@rac2 trace]$ pwd /u01/gridbase/diag/rdbms/_mgmtdb/-MGMTDB/trace [grid@rac2 trace]$ ls alert_-MGMTDB.log -MGMTDB_ckpt_4772.trm -MGMTDB_lgwr_7475.trc -MGMTDB_m001_10288.trm -MGMTDB_ora_10486.trc -MGMTDB_p001_5645.trm cdmp_20140807064254 -MGMTDB_ckpt_7477.trc -MGMTDB_lgwr_7475.trm -MGMTDB_m001_10330.trc -MGMTDB_ora_10486.trm -MGMTDB_p001_7523.trc cdmp_20141208110548 -MGMTDB_ckpt_7477.trm -MGMTDB_m000_10101.trc -MGMTDB_m001_10330.trm -MGMTDB_ora_10830.trc -MGMTDB_p001_7523.trm cdmp_20141208110550 -MGMTDB_dbrm_4764.trc -MGMTDB_m000_10101.trm -MGMTDB_m001_8055.trc -MGMTDB_ora_10830.trm -MGMTDB_rbal_10460.trc cdmp_20141208110553 -MGMTDB_dbrm_4764.trm -MGMTDB_m000_10202.trc -MGMTDB_m001_8055.trm -MGMTDB_ora_3770.trc -MGMTDB_rbal_10460.trm cdmp_20141208110555 -MGMTDB_dbrm_7469.trc -MGMTDB_m000_10202.trm -MGMTDB_mark_10484.trc -MGMTDB_ora_3770.trm -MGMTDB_rbal_4782.trc
MGMT DB 的日志和trace 都在這個裡。
前面說了,MGMTDB 是一個實例,實際上,MGMTDB是帶一個PDB的CDB庫,我們可以使用GI的命令直接去操作MGMTDB 對應的PDB。
--查看MGMTDB當前節點: [grid@rac2 /]$ oclumon manage -get master Master = rac1 --查看狀態: [grid@rac2 /]$ srvctl status mgmtdb Database is enabled Instance -MGMTDB is running on node rac2 --查看配置信息: [grid@rac2 /]$ srvctl config mgmtdb Database unique name: _mgmtdb Database name: Oracle home: /u01/gridsoft/12.1.0 Oracle user: grid Spfile:+OCR_VOTING/_mgmtdb/spfile-MGMTDB.ora Password file: Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Database instance: -MGMTDB Type: Management --連接MGMTDB實例 [grid@rac2 /]$ export ORACLE_SID=-MGMTDB [grid@rac2 /]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.1.0 Production onMon Dec 8 15:24:37 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise EditionRelease 12.1.0.1.0 - 64bit Production With the Partitioning, Automatic StorageManagement and Advanced Analytics options SQL> select file_name fromdba_data_files union select member file_name from V$logfile; FILE_NAME -------------------------------------------------------------------------------- +OCR_VOTING/_MGMTDB/DATAFILE/sysaux.258.854939615 +OCR_VOTING/_MGMTDB/DATAFILE/sysgridhomedata.261.854939891 +OCR_VOTING/_MGMTDB/DATAFILE/sysmgmtdata.260.854939737 +OCR_VOTING/_MGMTDB/DATAFILE/system.259.854939661 +OCR_VOTING/_MGMTDB/DATAFILE/undotbs1.257.854939605 +OCR_VOTING/_MGMTDB/ONLINELOG/group_1.263.854940051 +OCR_VOTING/_MGMTDB/ONLINELOG/group_2.264.854940053 +OCR_VOTING/_MGMTDB/ONLINELOG/group_3.265.854940057 8 rows selected.
這裡查詢的是MGMTDB的路徑,也可以直接用如下命令查詢:
[grid@rac2 /]$ oclumon manage -get reppath CHM Repository Path =+OCR_VOTING/_MGMTDB/DATAFILE/sysmgmtdata.260.854939737 [grid@rac2 /]$ --查詢MGMTDB用戶: SQL> select username,account_status fromdba_users where username like 'CH%'; USERNAME ACCOUNT_STATUS ------------- ---------------- CHM OPEN CHA OPEN