Oracle 12c RAC MGMTDB 说明
注:本文谢绝转载。
1 MGMTDB 说明
在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 数据库,在目前的版本中,也不需要手工对其进行备份。
2 MGMTDB 基本操作
2.1 查看Management DB 相关的资源:
[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 ~]#
2.2 启动和关闭MGMT
正常情况下,MGMTDB 会在GI 启动的时候,会自动启动,但也可以手工管理,直接使用srvctl 操作即可:
Usage: srvctl start mgmtdb[-startoption <start_option>] [-node <node_name>]
Usage: srvctl start mgmtlsnr [-node <node_name>]
2.3 查看Management Database 的log 和trace 文件
一般情况下,是不需要查看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 都在这个里。
3 MGMTDB是带一个PDB的CDB数据库
前面说了,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
--------------------------------------------------------------------------------------------
版权所有,文章禁止转载,否则追究法律责任!
AboutDave:
--------------------------------------------------------------------------------------------
QQ: 251097186
Email: [email protected]
Blog: http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
Linkedin: http://cn.linkedin.com/in/tianlesoftware
Dave 的QQ群:
--------------------------------------------------------------------------------------------
注意:加群必须注明表空间和数据文件关系 | 不要重复加群
CNDBA_1: 104207940 (满) CNDBA_2: 62697716 (满) CNDBA_3: 283816689
CNDBA_4: 391125754 CNDBA_5: 62697850 CNDBA_6: 62697977 CNDBA_7: 142216823(满)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。