适用范围
适用于Oracle 19c 19.27以前版本数据库
方案概述
重建Management Repository GIMR和启用MGMTDB
实施步骤
1、前置准备
1.1 准备脚本
在官网下载mdbutil.pl脚本并上传到oracle数据库服务器grid用户下。
1.2 检查ASM磁盘组空间
ASM磁盘组有至少80G空间,使用现有ASM磁盘组或者新建ASM磁盘组+MGMTDG
[grid@host01 ~]$ asmcmd lsdg
2、实施步骤
2.1检查集群状态和版本
[grid@host01 ~]$crsctl stat res -t
[grid@host01 ~]$ crsctl status res ora.crf -init
NAME=ora.crf
TYPE=ora.crf.type
TARGET=OFFLINE
STATE=OFFLINE
--检查节点1
[grid@host01 ~]$ crsctl query crs softwareversion
Oracle Clusterware version on node [host01] is [19.0.0.0.0]
[grid@host01 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [19.0.0.0.0]
[grid@host01 ~]$ crsctl query crs softwarepatch
Oracle Clusterware patch level on node host01 is [1944883066].
--检查节点2
[grid@host02 ~]$ crsctl query crs softwareversion
Oracle Clusterware version on node [host02] is [19.0.0.0.0]
[grid@host02 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [19.0.0.0.0]
[grid@host02 ~]$ crsctl query crs softwarepatch
Oracle Clusterware patch level on node host02 is [1944883066].
2.2关闭ora.crs资源
使用root用户在每个节点执行以下命令
[root@host01 ~]# <GI_HOME>/bin/crsctl stop res ora.crf -init
[root@host01 ~]# <GI_HOME>/bin/crsctl modify res ora.crf -attr ENABLED=0 -init
2.3创建MGMTDB数据库
mdbutil.pl脚本是GI Management Repository 管理维护工具,创建MGMTDB数据库也可以使用该脚本,该脚本是Oracle官方提供的维护GIMR的,执行时确保权限正常,生产环境执行该脚本先在测试环境进行充分测试后再实施。
注意:从19.27开始mdbutil.pl脚本已不在支持GIMR。
[grid@host01 ~] ./mdbutil.pl -h
Usage:
Create/Enable MGMTDB & CHM
mdbutil.pl --addmdb --target=
Move MGMTDB to another location
mdbutil.pl --mvmgmtdb --target=
Check MGMTDB status
mdbutil.pl --status
mdbutil.pl OPTIONS
--addmdb Create MGMTDB/CHM and reconfigure related functions
--mvmgmtdb Migrate MGMTDB to another location
--target='+DATA' MGMTDB Disk Group location
--status Check the CHM & MGMTDB status
--help Display this help and exit
--debug Verbose commands output/trace
Example:
Create/Enable MGMTDB:
mdbutil.pl --addmdb --target=+DATA
Move MGMTDB to another location:
mdbutil.pl --mvmgmtdb --target=+REDO
Check CHM:
mdbutil.pl --status
使用grid用户执行以下命令
[grid@host01 ~]./mdbutil.pl --addmdb --target=+MGMTDG
mdbutil.pl version : 1.102
2025-08-08 23:34:49: I Starting To Configure MGMTDB at +MGMT...
2025-08-08 23:34:51: I Container database creation in progress... for GI 19.0.0.0.0
2025-08-08 23:46:54: I Plugable database creation in progress...
2025-08-08 23:49:04: I Executing "/tmp/mdbutil.pl --addchm" on host01 as root to configure CHM.
2025-08-08 23:50:53: W Not able to execute "/tmp/mdbutil.pl --addchm" on host01 as root to configure CHM.
2025-08-08 23:50:53: I Executing "/tmp/mdbutil.pl --addchm" on host01 as root to configure CHM.
2025-08-08 23:50:58: W Not able to execute "/tmp/mdbutil.pl --addchm" on host01 as root to configure CHM.
2025-08-08 23:50:58: I MGMTDB & CHM configuration done!
2.4检查MGMTDB状态
/mdbutil.pl –status [grid@host01 ~]$ srvctl status mgmtdb Database is enabled Instance -MGMTDB is running on node host01
2.5检查集群状态
$crsctl stat res -t
[grid@host01 _mgmtdb]$ crsctl stat res -t
---------------------------------------------------------------------------
Name Target State Server State details
---------------------------------------------------------------------------
Local Resources
---------------------------------------------------------------------------
ora.LISTENER.lsnr
ONLINE ONLINE host01 STABLE
ora.chad
OFFLINE OFFLINE host01 STABLE
ora.net1.network
ONLINE ONLINE host01 STABLE
ora.ons
ONLINE ONLINE host01 STABLE
ora.proxy_advm
OFFLINE OFFLINE host01 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
1 ONLINE ONLINE host01 STABLE
2 ONLINE OFFLINE STABLE
3 ONLINE OFFLINE STABLE
ora.CESDB_DATA.dg(ora.asmgroup)
1 ONLINE ONLINE host01 STABLE
2 OFFLINE OFFLINE STABLE
3 OFFLINE OFFLINE STABLE
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE host01 STABLE
ora.MGMTDG.dg(ora.asmgroup)
1 ONLINE ONLINE host01 STABLE
2 OFFLINE OFFLINE STABLE
3 OFFLINE OFFLINE STABLE
ora.MGMTLSNR
1 ONLINE ONLINE host01 10.10.10.191,STABLE
ora.OCR.dg(ora.asmgroup)
1 ONLINE ONLINE host01 STABLE
2 OFFLINE OFFLINE STABLE
3 OFFLINE OFFLINE STABLE
ora.asm(ora.asmgroup)
1 ONLINE ONLINE host01 Started,STABLE
2 ONLINE OFFLINE STABLE
3 ONLINE OFFLINE STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
1 ONLINE ONLINE host01 STABLE
2 ONLINE OFFLINE STABLE
3 ONLINE OFFLINE STABLE
ora.cvu
1 OFFLINE OFFLINE STABLE
ora.dev19c.db
1 ONLINE ONLINE host01 Open,HOME=/u01/app/oracle/product/19c/db
_1,STABLE
2 ONLINE OFFLINE STABLE
ora.dev19c.dev19c_ro.svc
1 OFFLINE OFFLINE STABLE
2 OFFLINE OFFLINE STABLE
ora.dev19c.dev19c_rw.svc
1 OFFLINE OFFLINE STABLE
2 ONLINE ONLINE host01 STABLE
ora.dev19c.devpdb1.svc
1 ONLINE ONLINE host01 STABLE
ora.mgmtdb
1 ONLINE ONLINE host01 Open,STABLE
ora.qosmserver
1 ONLINE ONLINE host01 STABLE
ora.host01.vip
1 ONLINE ONLINE host01 STABLE
OVER,STABLE
ora.scan1.vip
1 ONLINE ONLINE host01 STABLE
集群中已经有了ora.mgmtdb资源
2.6检查MGMTDB状态
[grid@host01 ~]$ srvctl status MGMTDB
Database is enabled
Instance -MGMTDB is running on node host01
[grid@ host01 ~]$ srvctl config mgmtdb
Database unique name: _mgmtdb
Database name:
Oracle home: <CRS home>
Oracle user: grid
Spfile: +MGMTDG/_MGMTDB/PARAMETERFILE/spfile.269.1208613661
Password file: +MGMTDG/_MGMTDB/PASSWORD/pwd_mgmtdb.256.1208612757
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Type: Management
PDB name: GIMR_DSCREP_10
PDB service: GIMR_DSCREP_10
Cluster name: rac-cluster
Database instance: -MGMTDB
MGMTDB数据库已启用,数据库状态正常。MGMTDB是多租户架构“单C单P”-一个CDB中一个PDB。
2.7检查监听状态
[grid@host01 ~]$ ps -eaf | grep tns
root 15 2 0 20:05 ? 00:00:00 [netns]
grid 1168 892 0 22:37 pts/0 00:00:00 grep --color=auto tns
grid 3974 1 0 20:06 ? 00:00:00 /u01/app/12.1.0/grid/bin/tnslsnr MGMTLSNR -no_crs_notify -inherit
grid 4064 1 0 20:06 ? 00:00:00 /u01/app/12.1.0/grid/bin/tnslsnr LISTENER -no_crs_notify -inherit
grid 4092 1 0 20:06 ? 00:00:00 /u01/app/12.1.0/grid/bin/tnslsnr LISTENER_SCAN2 -no_crs_notify -inherit
grid 4103 1 0 20:06 ? 00:00:00 /u01/app/12.1.0/grid/bin/tnslsnr LISTENER_SCAN3 -no_crs_notify -inherit
[grid@host01 ~]$ lsnrctl status MGMTLSNR
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-MAR-2016 22:38:03
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=MGMTLSNR)))
STATUS of the LISTENER
------------------------
Alias MGMTLSNR
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 14-MAR-2016 20:06:33
Uptime 0 days 2 hr. 31 min. 29 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/12.1.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/host01/mgmtlsnr/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=MGMTLSNR)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.100.61)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=169.254.146.121)(PORT=1521)))
Services Summary...
Service "-MGMTDBXDB" has 1 instance(s).
Instance "-MGMTDB", status READY, has 1 handler(s) for this service...
Service "_mgmtdb" has 1 instance(s).
Instance "-MGMTDB", status READY, has 1 handler(s) for this service...
Service "racnode_cluster" has 1 instance(s).
Instance "-MGMTDB", status READY, has 1 handler(s) for this service...
The command completed successfully
已经增加了MGMTLSNR监听,服务名_mgmtdb,监听状态正常。
2.8启动ora.crf
分别在两个节点使用root用户执行以下命令
# <GI_HOME>/bin/crsctl modify res ora.crf -attr ENABLED=1 -init
# <GI_HOME>/bin/crsctl start res ora.crf -init
[root@host01 ~]# $GRID_HOME/bin/crsctl start res ora.crf -init
CRS-2672: Attempting to start 'ora.crf' on 'host01'
CRS-2676: Start of 'ora.crf' on 'host01' succeeded
[root@host01 ~]#
[root@host02 bin]# $GRID_HOM/bin/crsctl modify res ora.crf -attr ENABLED=1 -init
[root@host02 bin]# $GRID_HOM/bin/crsctl start res ora.crf -init
CRS-2672: Attempting to start 'ora.crf' on 'host02'
CRS-2676: Start of 'ora.crf' on 'host02' succeeded
[root@host02 ~]#
最后修改时间:2025-08-11 15:36:48
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




