Every Oracle Standalone Cluster and Oracle Domain Services Cluster contains a Grid Infrastructure Management Repository (GIMR), or the Management Database (MGMTDB).node
The Grid Infrastructure Management Repository (GIMR) is a multitenant database with a pluggable database (PDB) for the GIMR of each cluster. The GIMR stores the following information about the cluster:sql
?Real time performance data the Cluster Health Monitor collects數據庫
?Fault, diagnosis, and metric data the Cluster Health Advisor collectsapi
?Cluster-wide events about all resources that Oracle Clusterware collectsbash
?CPU architecture data for Quality of Service Management (QoS)session
?Metadata required for Rapid Home Provisioningoracle
The Oracle Standalone Cluster locally hosts the GIMR on an Oracle ASM disk group; this GIMR is a multitenant database with a single pluggable database (PDB).app
The global GIMR runs in an Oracle Domain Services Cluster. Oracle Domain Services Cluster locally hosts the GIMR in a separate Oracle ASM disk group. Client clusters, such as Oracle Member Cluster for Database, use the remote GIMR located on the Domain Services Cluster. For two-node or four-node clusters, hosting the GIMR for a cluster on a remote cluster reduces the overhead of running an extra infrastructure repository on a cluster. The GIMR for an Oracle Domain Services Cluster is a multitenant database with one PDB, and additional PDB for each member cluster that is added.ide
When you configure an Oracle Domain Services Cluster, the installer prompts to configure a separate Oracle ASM disk group for the GIMR, with the default name as MGMT.ui
srvctl stop mgmtdb
srvctl status mgmtdb
srvctl config mgmtdb
srvctl disable mgmtdb
srvctl disable mgmtlsnr
srvctl add mgmtdb
srvctl config mgmtdb
srvctl disable mgmtdb
srvctl enable mgmtdb
srvctl getenv mgmtdb
srvctl modify mgmtdb
srvctl relocate mgmtdb
srvctl remove mgmtdb
srvctl setenv mgmtdb
srvctl start mgmtdb
srvctl status mgmtdb
srvctl stop mgmtdb
srvctl unsetenv mgmtdb
srvctl add mgmtlsnr
srvctl config mgmtlsnr
srvctl disable mgmtlsnr
srvctl enable mgmtlsnr
srvctl getenv mgmtlsnr
srvctl modify mgmtlsnr
srvctl remove mgmtlsnr
srvctl setenv mgmtlsnr
srvctl start mgmtlsnr
srvctl status mgmtlsnr
srvctl stop mgmtlsnr
srvctl unsetenv mgmtlsnr
必須使用grid用戶進行登陸:
[grid@raclhr-12cR1-N1 ~]$ export ORACLE_SID=-MGMTDB
[grid@raclhr-12cR1-N1 ~]$ sqlplus / as sysdba
MGMTDB數據庫的信息:
Database unique name: _mgmtdb
Database name: _mgmtdb
Oracle user: grid
Database instance: -MGMTDB
service_names:_mgmtdb
[root@raclhr-12cR1-N1 ~]# crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE raclhr-12cr1-n1 STABLE
ONLINE ONLINE raclhr-12cr1-n2 STABLE
ora.FRA.dg
ONLINE ONLINE raclhr-12cr1-n1 STABLE
ONLINE ONLINE raclhr-12cr1-n2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE raclhr-12cr1-n1 STABLE
ONLINE ONLINE raclhr-12cr1-n2 STABLE
ora.OCR.dg
ONLINE ONLINE raclhr-12cr1-n1 STABLE
ONLINE ONLINE raclhr-12cr1-n2 STABLE
ora.asm
ONLINE ONLINE raclhr-12cr1-n1 Started,STABLE
ONLINE ONLINE raclhr-12cr1-n2 Started,STABLE
ora.net1.network
ONLINE ONLINE raclhr-12cr1-n1 STABLE
ONLINE ONLINE raclhr-12cr1-n2 STABLE
ora.ons
ONLINE ONLINE raclhr-12cr1-n1 STABLE
ONLINE ONLINE raclhr-12cr1-n2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE raclhr-12cr1-n1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE raclhr-12cr1-n1 169.254.20.104 192.1
68.2.100,STABLE
ora.cvu
1 ONLINE ONLINE raclhr-12cr1-n1 STABLE
ora.lhrrac.db
1 ONLINE ONLINE raclhr-12cr1-n1 Open,STABLE
2 ONLINE ONLINE raclhr-12cr1-n2 Open,STABLE
ora.mgmtdb
1 ONLINE ONLINE raclhr-12cr1-n1 Open,STABLE
ora.oc4j
1 ONLINE ONLINE raclhr-12cr1-n1 STABLE
ora.raclhr-12cr1-n1.vip
1 ONLINE ONLINE raclhr-12cr1-n1 STABLE
ora.raclhr-12cr1-n2.vip
1 ONLINE ONLINE raclhr-12cr1-n2 STABLE
ora.scan1.vip
1 ONLINE ONLINE raclhr-12cr1-n1 STABLE
--------------------------------------------------------------------------------
[root@raclhr-12cR1-N1 ~]#
使用crsctl 命令能夠看到ora.mgmtdb 和ora.MGMTLSNR。
在操做系統層面,也能夠查看到有2個對應的進程:
[root@raclhr-12cR1-N1 ~]# ps -ef| grep pmon_-MGMTDB
grid 36338 1 0 16:50 ? 00:00:00 mdb_pmon_-MGMTDB
root 38490 46150 0 16:58 pts/0 00:00:00 grep pmon_-MGMTDB
[root@raclhr-12cR1-N1 ~]# ps -ef| grep MGMTLSNR
grid 729 1 0 06:11 ? 00:00:01 /u01/app/12.1.0/grid/bin/tnslsnr MGMTLSNR -no_crs_notify -inherit
root 38779 46150 0 16:58 pts/0 00:00:00 grep MGMTLSNR
[root@raclhr-12cR1-N1 ~]#
在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 Health Monitor(CHM/OS,ora.crf) ,Oracle Database QoS Management,Rapid Home Provisioning和其餘的數據。
Management Repository 是受12c Clusterware 管理的一個單實例,在Cluster 啓動的時會啓動MGMTDG並在其中一個節點上運行,並受GI 管理,若是運行MGMTDG的節點宕機了,GI 會自動把MGMTDB 轉移到其餘的節點上。
默認狀況,MGMTDB 數據庫的數據文件存放在共享的設備,如OCR/Voting 的磁盤組中,但後期能夠移動位置。
在12.1.0.1 中,GIMR 是可選的,若是在安裝GI的時候,沒有選擇Management Database 數據庫,那麼全部依賴的特性,如Cluster Health Monitor (CHM/OS) 就會被禁用。
固然,在12.1.0.2 中,能夠忽略這個問題,由於是強制安裝GIMR了。
另外,對於MGMT 數據庫,在目前的版本中,也不須要手工對其進行備份。
[root@rac1 ~]# crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- 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 0 14: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 ] [-node ]
Usage: srvctl start mgmtlsnr [-node ]
通常狀況下,是不須要查看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: [root@rac1 ~]# srvctl status mgmtdb Database is enabled Database is not running. [root@rac1 ~]# srvctl start mgmtdb [root@rac1 ~]# [root@rac1 ~]# srvctl status mgmtdb Database is enabled Instance -MGMTDB is running on node rac1 [root@rac1 ~]# --查看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 on Mon Dec 8 15:24:37 2014 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production With the Partitioning, Automatic Storage Management and Advanced Analytics options SQL> select file_name from dba_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 from dba_users where username like 'CH%'; USERNAME ACCOUNT_STATUS ------------- ---------------- CHM OPEN CHA OPEN
默認狀況下,MGMTDB 的數據文件是存放在OCR voting disk的磁盤組裏的,爲了節省OCR 磁盤組空間,咱們也能夠把MGMTDB 轉移走。
固然,這裏的移動位置,也是從一個共享位置移動到另外一個共享位置。
具體操做以下。
在12.1.0.1 版本中有有問題,升級到12.1.0.2 解決。
這裏的ora.crf就是CHM。
在全部節點使用root用戶執行以下命令:
[root@rac1 ~]# crsctl stop res ora.crf -init CRS-2673: Attempting to stop 'ora.crf' on 'rac1' CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded [root@rac1 ~]# crsctl modify res ora.crf -attr ENABLED=0 -init [root@rac1 ~]# [root@rac2 ~]# crsctl stop res ora.crf -init CRS-2673: Attempting to stop 'ora.crf' on 'rac2' CRS-2677: Stop of 'ora.crf' on 'rac2' succeeded [root@rac2 ~]# crsctl modify res ora.crf -attr ENABLED=0 -init [root@rac2 ~]# 注意:ora.mgmtlsnr 和 ora.mgmtdb 資源不能停,不然DBCA 時會報錯。
--查看MGMTDB的運行節點:
[root@rac1 ~]# srvctl status mgmtdb Database is enabled Instance -MGMTDB is running on node rac2
這裏顯示在節點2上運行,那麼在節點2上,用grid用戶,執行dbca 命令,刪除MGMTDB。
[grid@rac2 ~]$ dbca -silent -deleteDatabase -sourceDB -MGMTDB Connecting to database 4% complete 9% complete 14% complete 19% complete 23% complete 28% complete 47% complete Updating network configuration files 48% complete 52% complete Deleting instance and datafiles 76% complete 100% complete Look at the log file "/u01/gridbase/cfgtoollogs/dbca/_mgmtdb.log" for further details. [grid@rac2 ~]$
注意:
若是是使用DBCA 手工建立的MGMTDB,則可能出現不能刪除的狀況,具體處理過程能夠參考MOS: 1631336.1。
用grid用戶,在任意節點,執行以下命令,重建CDB。
$ /bin/dbca -silent -createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName _mgmtdb -storageType ASM -diskGroupName <+NEW_DG> -datafileJarLocation /assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -oui_internal
注意:
這裏新的磁盤組,建議compatible.asm 和 compatible.rdbms 屬性都設置爲12.1。
上面的命令使用的是磁盤組,若是是使用共享的NFS/CFS, 則使用以下命令:
/bin/dbca -silent -createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName _mgmtdb -storageType FS -datafileDestination -datafileJarLocation /assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -oui_internal
咱們這裏數據庫版本是12.1.0.1,而且使用的是磁盤組,因此執行第一個命令:
[grid@rac1 /]$ dbca -silent -createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName _mgmtdb -storageType ASM -diskGroupName OCR -datafileJarLocation /u01/gridsoft/12.1.0/assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -oui_internal Copying database files 1% complete 3% complete 10% complete 17% complete 24% complete 31% complete 35% complete Creating and starting Oracle instance 37% complete 42% complete 47% complete 52% complete 53% complete 56% complete 58% complete Registering database with Oracle Grid Infrastructure 64% complete Completing Database Creation 68% complete 78% complete 89% complete 100% complete Look at the log file "/u01/gridbase/cfgtoollogs/dbca/_mgmtdb/_mgmtdb0.log" for further details. [grid@rac1 /]$
在任意節點,用grid用戶執行以下命令:
--ASM 磁盤組: $ /bin/dbca -silent -createDatabase -sid -MGMTDB -createAsContainerDatabase true -templateName MGMTSeed_Database.dbc -gdbName _mgmtdb -storageType ASM -diskGroupName <+NEW_DG> -datafileJarLocation $GRID_HOME/assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -skipUserTemplateCheck --共享的NFS/CFS : $/bin/dbca -silent -createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName _mgmtdb -storageType FS -datafileDestination -datafileJarLocation /assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -oui_internal --示例: [grid@rac1 templates]$ dbca -silent -createDatabase -sid -MGMTDB -createAsContainerDatabase true -templateName MGMTSeed_Database.dbc -gdbName _mgmtdb -storageType ASM -diskGroupName +OCR -datafileJarLocation /u01/gridsoft/12.1.0.2/assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -skipUserTemplateCheck Registering database with Oracle Grid Infrastructure 5% complete Copying database files 7% complete 9% complete 16% complete 23% complete 30% complete 41% complete Creating and starting Oracle instance 43% complete 48% complete 49% complete 50% complete 55% complete 60% complete 61% complete 64% complete Completing Database Creation 68% complete 79% complete 89% complete 100% complete Look at the log file "/u01/gridbase/cfgtoollogs/dbca/_mgmtdb/_mgmtdb0.log" for further details. [grid@rac1 templates]$
[grid@rac1 templates]$ srvctl status mgmtdb Database is enabled Instance -MGMTDB is running on node rac1 [grid@rac1 templates]$
在任意節點,用grid用戶執行dbca 建立PDB,命令以下:
$ /bin/dbca -silent -createPluggableDatabase -sourceDB -MGMTDB -pdbName -createPDBFrom RMANBACKUP -PDBBackUpfile /assistants/dbca/templates/mgmtseed_pdb.dfb -PDBMetadataFile /assistants/dbca/templates/mgmtseed_pdb.xml -createAsClone true –internalSkipGIHomeCheck
--查詢集羣的名稱:
[grid@rac1 /]$ cemutlo -n
rac-scan
[grid@rac1 /]$
注意:默認狀況CLUSTER_NAME 都是-,這裏好比換成_
咱們這裏就要換成rac_scan
[grid@rac1 templates]$ dbca -silent -createPluggableDatabase -sourceDB -MGMTDB -pdbName rac_scan -createPDBFrom RMANBACKUP -PDBBackUpfile /u01/gridsoft/12.1.0.2/assistants/dbca/templates/mgmtseed_pdb.dfb -PDBMetadataFile /u01/gridsoft/12.1.0.2/assistants/dbca/templates/mgmtseed_pdb.xml -createAsClone true -internalSkipGIHomeCheck Creating Pluggable Database 4% complete 12% complete 21% complete 38% complete 55% complete 85% complete Completing Pluggable Database Creation 100% complete Look at the log file "/u01/gridbase/cfgtoollogs/dbca/_mgmtdb/rac_scan/_mgmtdb0.log" for further details. [grid@rac1 templates]$
用grid用戶執行以下命令,驗證MGMTDB 運行狀況:
[grid@rac1 ~]$ srvctl status MGMTDB
Database is enabled
Instance -MGMTDB is running on node rac1
這裏顯示的是節點1,那麼在節點1上在執行:
[grid@rac1 ~]$ mgmtca [grid@rac1 ~]$ crsctl stat res -t …… ora.MGMTLSNR 1 ONLINE ONLINE rac1 169.254.193.105 192. 168.57.5,STABLE ora.mgmtdb 1 ONLINE ONLINE rac1 Open,STABLE …… [grid@rac1 ~]$ [grid@rac1 templates]$ srvctl config mgmtdb Database unique name: _mgmtdb Database name: Oracle home: Oracle user: grid Spfile: +OCR/_MGMTDB/PARAMETERFILE/spfile.268.865977817 Password file: Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Type: Management PDB name: rac_scan PDB service: rac_scan Cluster name: rac-scan Database instance: -MGMTDB [grid@rac1 templates]$ [grid@rac1 templates]$ export ORACLE_SID=-MGMTDB [grid@rac1 templates]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Dec 10 21:39:13 2014 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Automatic Storage Management and Advanced Analytics options SQL> select file_name from dba_data_files union select member file_name from V$logfile; FILE_NAME -------------------------------------------------------------------------------- +OCR/_MGMTDB/DATAFILE/sysaux.257.865977463 +OCR/_MGMTDB/DATAFILE/system.258.865977473 +OCR/_MGMTDB/DATAFILE/undotbs1.259.865977489 +OCR/_MGMTDB/ONLINELOG/group_1.261.865977635 +OCR/_MGMTDB/ONLINELOG/group_2.262.865977635 +OCR/_MGMTDB/ONLINELOG/group_3.263.865977635 6 rows selected. SQL>
數據文件已經轉移到OCR 磁盤組了。
在全部節點,用root用戶執行:
[root@rac1 u01]# crsctl modify res ora.crf -attr ENABLED=1 -init [root@rac1 u01]# crsctl start res ora.crf -init CRS-2672: Attempting to start 'ora.crf' on 'rac1' CRS-2676: Start of 'ora.crf' on 'rac1' succeeded [root@rac1 u01]# oclumon manage -get master Master = rac1 [root@rac1 u01]#
一、How to Move/Recreate GI Management Repository to Different Shared Storage (Diskgroup, CFS or NFS etc) (文檔 ID 1589394.1)
In this Document
Goal |
Solution |
Oracle Database - Enterprise Edition - Version 12.1.0.1 and later
Information in this document applies to any platform.
This note outlines the steps to move 12c GIMR (Grid Infrastructure Management Repository) to a different shared storage.
This procedure will NOT preserve Management Database contents. To back up manually in text format, as grid user on any node:
$ /bin/oclumon dumpnodeview -allnodes -v >
1. Stop and disable ora.crf resource.
On each node, as root user:
# /bin/crsctl stop res ora.crf -init
# /bin/crsctl modify res ora.crf -attr ENABLED=0 -init
Do not stop ora.mgmtlsnr or ora.mgmtdb resource or Step 2 will fail with the following:
Oracle Grid Management database is running on node "". Run dbca on node "" to delete the database.
2. Issue the DBCA command to delete the management database
As Grid User, locate the node that the Management Database is running by executing:
$ /bin/srvctl status mgmtdb
As Grid User on the node where ora.mgmtdb resource is running execute:
$ /bin/dbca -silent -deleteDatabase -sourceDB -MGMTDB
Connecting to database
4% complete
9% complete
14% complete
19% complete
23% complete
28% complete
47% complete
Updating network configuration files
48% complete
52% complete
Deleting instance and datafiles
76% complete
100% complete
Look at the log file "/home/grid/app/grid/cfgtoollogs/dbca/_mgmtdb.log" for further details.
Note:
If MGMTDB is not starting for any reason, dbca will fail:
Oracle Grid Management database is running on node "". Run dbca on node "" to delete the database.
The solution is to delete it manually by:
- remove the MGMTDB related files manually with OS command and remove the oratab entry
- remove the resource with srvctl: srvctl remove mgmtdb
3. Recreate the MGMTDB
3A. For 12.1.0.1 only:
As grid user, on any node execute the following dbca command:
$ /bin/dbca -silent -createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName _mgmtdb -storageType ASM -diskGroupName <+NEW_DG> -datafileJarLocation /assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -oui_internal
Copying database files
1% complete
3% complete
10% complete
17% complete
24% complete
31% complete
35% complete
Creating and starting Oracle instance
37% complete
42% complete
47% complete
52% complete
53% complete
56% complete
58% complete
Registering database with Oracle Grid Infrastructure
64% complete
Completing Database Creation
68% complete
78% complete
89% complete
100% complete
Look at the log file "/home/grid/app/grid/cfgtoollogs/dbca/_mgmtdb/_mgmtdb1.log" for further details.
NOTE: It's recommended to set both compatible.asm and compatible.rdbms to 12.1 for the new ASM diskgroup when creating or altering and existing diskgroup.
Also, this example created the Management Database in a new ASM Diskgroup, to create the database in shared NFS/CFS location:
/bin/dbca -silent -createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName _mgmtdb -storageType FS -datafileDestination -datafileJarLocation /assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -oui_internal
3B. For 12.1.0.2 only:
a. As Grid User on any node execute the following DBCA command with the desired :
$ /bin/dbca -silent -createDatabase -sid -MGMTDB -createAsContainerDatabase true -templateName MGMTSeed_Database.dbc -gdbName _mgmtdb -storageType ASM -diskGroupName <+NEW_DG> -datafileJarLocation $GI_HOME/assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -skipUserTemplateCheck
Copying database files
1% complete
3% complete
10% complete
17% complete
24% complete
31% complete
35% complete
Creating and starting Oracle instance
37% complete
42% complete
47% complete
52% complete
53% complete
56% complete
58% complete
Registering database with Oracle Grid Infrastructure
64% complete
Completing Database Creation
68% complete
78% complete
89% complete
100% complete
Look at the log file "/cfgtoollogs/dbca/_mgmtdb/_mgmtdb1.log" for further details.
NOTE: It's recommended to set both compatible.asm and compatible.rdbms to 12.1 for the new ASM diskgroup when creating or altering and existing diskgroup.
Ex: CREATE DISKGROUP … ATTRIBUTE 'compatible.rdbms' = '12.1', 'compatible.asm' = '12.1';
The Management Database may be moved to an ASM Diskgroup, in a shared NFS/CFS location with the following command line:
$ /bin/dbca -silent -createDatabase -sid -MGMTDB -createAsContainerDatabase true -templateName MGMTSeed_Database.dbc -gdbName _mgmtdb -storageType FS -datafileDestination -datafileJarLocation $GI_HOME/assistants/dbca/templates -characterset AL32UTF8 -autoGeneratePasswords -skipUserTemplateCheck
b. Create a PDB within the MGMTDB using DBCA.
As Grid User on any node execute the following DBCA command:
NOTE: The CLUSTER_NAME needs to have any hyphens (「-「) replaced with underscores (「_」)
$ /bin/dbca -silent -createPluggableDatabase -sourceDB -MGMTDB -pdbName -createPDBFrom RMANBACKUP -PDBBackUpfile /assistants/dbca/templates/mgmtseed_pdb.dfb -PDBMetadataFile /assistants/dbca/templates/mgmtseed_pdb.xml -createAsClone true
Creating Pluggable Database
4% complete
12% complete
21% complete
38% complete
55% complete
85% complete
Completing Pluggable Database Creation
100% complete
Look at the log file "/cfgtoollogs/dbca/_mgmtdb//_mgmtdb2.log" for further details.
4. Secure that the Management Database credential:
As Grid User, confirm the node on which MGMTDB is running by executing.
$ /bin/srvctl status MGMTDB
Database is enabled
Instance -MGMTDB is running on node
On :
$ /bin/mgmtca
5. Enable and start ora.crf resource.
On each node, as root user:
# /bin/crsctl modify res ora.crf -attr ENABLED=1 -init
# /bin/crsctl start res ora.crf -init
二、12.1.0.2 GI GIMR/MGMTDB SYSMGMTDATA Tablespace Increasing Rapidly (文檔 ID 2177879.1)
In this Document
Symptoms |
Cause |
Solution |
References |
Oracle Database - Enterprise Edition - Version 12.1.0.2 and later
Information in this document applies to any platform.
12.1.0.2 GIMR database (-MGMTDB) SYSMGMTDATA tablespace keeps increasing with the same retention size:
$ oclumon manage -get reppath
CHM Repository Path = +CRS/_MGMTDB/FD9B43BF6A646F8CE043B6A9E80A2815/DATAFILE/sysmgmtdata.269.917710623
Tablespace Name File Name Size (M) Used (M) Free (M) % Used
-------------------- -------------------------------------------------------------------------------- ---------- ---------- ---------- ----------
SYSMGMTDATA +CRS/_MGMTDB/FD9B43BF6A646F8CE043B6A9E80A2815/DATAFILE/sysmgmtdata.269.917710623 16894 16032 521 95
Expired CHM data are not purged:
SQL> select trunc(BEGINTIME), count(*) from chm.CHMOS_PROCESS_INT_TBL group by trunc(BEGINTIME) order by trunc(BEGINTIME);
TRUNC(BEG COUNT(*)
--------- ----------
25-JUL-16 1824587
26-JUL-16 3019039
27-JUL-16 3236612
28-JUL-16 3559627
29-JUL-16 3687053
....
09-AUG-16 3626059
10-AUG-16 3638210
11-AUG-16 3665800
12-AUG-16 3565969
13-AUG-16 3650727
14-AUG-16 3638103
15-AUG-16 3622208
16-AUG-16 3680251
17-AUG-16 2321889
Issue was investigated in:
Bug 23563549 - -MGMTDB SYSMGMTDATA IS FILLING UP WHICH CAUSES GRID1 DISK TO REACH 100%.
Bug 24331121 - OCR_VOTE DISK GROUP IS 99% FULL, HIGH UNDO USED BY MGMTDB
The cause is due to autoextend for the tablespace being set to on.
Solution 1:
Recreate GIMR which will drop the existing database and set autoextend back to off.
note 1589394.1 - How to Move/Recreate GI Management Repository to Different Shared Storage (Diskgroup, CFS or NFS etc)
Or
Solution 2:
Manually perform the following steps to shrink:
1. Stop and disable ora.crf resource.
On each node, as root user:
# /bin/crsctl stop res ora.crf -init
# /bin/crsctl modify res ora.crf -attr ENABLED=0 -init
2. Identify huge objects from dba_segments and truncate them:
Connect to MGMTDB:
export ORACLE_HOME=
export ORACLE_SID=-MGMTDB
$ORACLE_HOME/bin/sqlplus / as sysdba
SQL> select pdb_name from dba_pdbs where pdb_name!='PDB$SEED';
PDB_NAME
--------------------------------------------------------------------------------------------------------------------------------
CEHAOVMSP1CLU68 ====>>>> this is your PDB name, use it in next command
SQL> alter session set container=CEHAOVMSP1CLU68;
Session altered.
SQL> col obj format a50
SQL> select owner||'.'||SEGMENT_NAME obj, BYTES from dba_segments where owner='CHM' order by 2 asc
Likely you are going to see the following as the biggest table:
CHM.CHMOS_PROCESS_INT_TBL
CHM.CHMOS_DEVICE_INT_TBL
Truncate the table, i.e.:
SQL> truncate table CHM.CHMOS_PROCESS_INT_TBL;
SQL> truncate table CHM.CHMOS_DEVICE_INT_TBL;
..
3. Shrink the tablespace:
https://docs.oracle.com/database/121/ADMIN/schema.htm#ADMIN11600
4. Enable and start ora.crf resource.
On each node, as root user:
# /bin/crsctl modify res ora.crf -attr ENABLED=1 -init # /bin/crsctl start res ora.crf -init