Oracle 12cRAC移动MGMTDB数据库数据文件方法

页面导航:首页 > 数据库 > oracle > Oracle 12cRAC移动MGMTDB数据库数据文件方法

Oracle 12cRAC移动MGMTDB数据库数据文件方法

来源: 作者: 时间:2016-01-29 09:07 【

在之前的Blog里介绍了Oracle12c RAC 中的MGMTDB的概念,参考:Oracle 12cRAC MGMTDB 说明http: www 2cto com database 201412 359252 html而在默认情况下,MGMTDB 的数据文件是存放在OCR voting disk的

在之前的Blog里介绍了Oracle12c RAC 中的MGMTDB的概念,参考:

 

Oracle 12cRAC MGMTDB 说明

http://www.2cto.com/database/201412/359252.html

 

而在默认情况下,MGMTDB 的数据文件是存放在OCR voting disk的磁盘组里的,为了节省OCR 磁盘组空间,我们也可以把MGMTDB 转移走。

 

当然,这里的移动位置,也是从一个共享位置移动到另一个共享位置。

 

具体操作如下。

 

 

1 停止并禁用ora.crf 资源

 

这里的ora.crf就是CHM。

 

在所有节点使用root用户执行如下命令:

 

[[email protected] ~]# crsctlstop res ora.crf -init

CRS-2673: Attempting to stop 'ora.crf' on'rac1'

CRS-2677: Stop of 'ora.crf' on 'rac1'succeeded



[[email protected] ~]# crsctlmodify res ora.crf -attr ENABLED=0 -init

[[email protected] ~]#



[[email protected] ~]# crsctl stop res ora.crf-init

CRS-2673: Attempting to stop 'ora.crf' on'rac2'

CRS-2677: Stop of 'ora.crf' on 'rac2'succeeded



[[email protected] ~]# crsctl modify res ora.crf-attr ENABLED=0 -init

[[email protected] ~]#

注意:ora.mgmtlsnr 和 ora.mgmtdb资源不能停,否则DBCA 时会报错。

 

 

2 执行DBCA 删除management database

 

 

--查看MGMTDB的运行节点:

[[email protected] ~]# srvctl status mgmtdb

Database is enabled

Instance -MGMTDB is running on node rac2

 

这里显示在节点2上运行,那么在节点2上,用grid用户,执行dbca 命令,删除MGMTDB。

 

[[email protected] ~]$ dbca -silent-deleteDatabase -sourceDB -MGMTDB

Connecting to database

4% complete

9% complete

14% complete

19% complete

23% complete

28% complete

47% complete

Updating networkconfiguration files

48% complete

52% complete

Deleting instance anddatafiles

76% complete

100% complete

Look at the log file"/u01/gridbase/cfgtoollogs/dbca/_mgmtdb.log" for further details.

[[email protected] ~]$


注意:

如果是使用DBCA 手工创建的MGMTDB,则可能出现不能删除的情况,具体处理过程可以参考MOS: 1631336.1。

 

 

3 重建MGMTDB的CDB

1.1 12.1.0.1 执行如下命令

 

用grid用户,在任意节点,执行如下命令,重建CDB。

$ <GI_HOME>/bin/dbca -silent-createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName_mgmtdb -storageType ASM -diskGroupName <+NEW_DG> -datafileJarLocation<GI_HOME>/assistants/dbca/templates -characterset AL32UTF8-autoGeneratePasswords -oui_internal

注意:

这里新的磁盘组,建议compatible.asm和 compatible.rdbms 属性都设置为12.1。

 

上面的命令使用的是磁盘组,如果是使用共享的NFS/CFS, 则使用如下命令:

<GI_HOME>/bin/dbca -silent-createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName_mgmtdb -storageType FS -datafileDestination <NFS_Location>-datafileJarLocation <GI_HOME>/assistants/dbca/templates-characterset AL32UTF8 -autoGeneratePasswords -oui_internal

 

我们这里版本是12.1.0.1,并且使用的是磁盘组,所以执行第一个命令:

[[email protected] /]$ dbca -silent -createDatabase-templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName _mgmtdb -storageTypeASM -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 GridInfrastructure

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 furtherdetails.

[[email protected] /]$


1.2 12.1.0.2 执行如下命令

 

在任意节点,用grid用户执行如下命令:

--ASM 磁盘组:

$ <GI_HOME>/bin/dbca -silent-createDatabase -sid -MGMTDB -createAsContainerDatabasetrue -templateName MGMTSeed_Database.dbc -gdbName _mgmtdb -storageType ASM-diskGroupName <+NEW_DG> -datafileJarLocation $GRID_HOME/assistants/dbca/templates-characterset AL32UTF8 -autoGeneratePasswords -skipUserTemplateCheck





--共享的NFS/CFS :

$<GI_HOME>/bin/dbca -silent-createDatabase -templateName MGMTSeed_Database.dbc -sid -MGMTDB -gdbName_mgmtdb -storageType FS -datafileDestination <NFS_Location>-datafileJarLocation <GI_HOME>/assistants/dbca/templates -charactersetAL32UTF8 -autoGeneratePasswords -oui_internal



--示例:

[[email protected] templates]$ dbca -silent-createDatabase -sid -MGMTDB -createAsContainerDatabase true -templateNameMGMTSeed_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 GridInfrastructure

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 furtherdetails.

[[email protected] templates]$


 

4 使用DBCA 创建PDB

[[email protected] templates]$ srtl status mgmtdb

Database is enabled

Instance -MGMTDB is running on node rac1

[[email protected] templates]$

在任意节点,用grid用户执行dbca创建PDB,命令如下:

$ <GI_HOME>/bin/dbca -silent-createPluggableDatabase -sourceDB -MGMTDB -pdbName <CLUSTER_NAME>-createPDBFrom RMANBACKUP -PDBBackUpfile<GI_HOME>/assistants/dbca/templates/mgmtseed_pdb.dfb -PDBMetadataFile<GI_HOME>/assistants/dbca/templates/mgmtseed_pdb.xml -createAsClone true–internalSkipGIHomeCheck

--查询集群的名称:

[[email protected] /]$ cemutlo -n

rac-scan

[[email protected] /]$

注意:默认情况CLUSTER_NAME 都是-,这里比如换成_

 

我们这里就要换成rac_scan

[[email protected] templates]$ dbca -silent-createPluggableDatabase -sourceDB -MGMTDB -pdbName rac_scan -createPDBFromRMANBACKUP -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" forfurther details.

[[email protected] templates]$




 

 

5 验证MGMTDB

 

用grid用户执行如下命令,验证MGMTDB运行情况:

[[email protected] ~]$ srvctl status MGMTDB

Database is enabled

Instance -MGMTDB is running on node rac1

这里显示的是节点1,那么在节点1上在执行:

 

[[email protected] ~]$ mgmtca

[[email protected] ~]$ 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

……

[[email protected] ~]$



[[email protected]]$ srvctl config mgmtdb

Database unique name:_mgmtdb

Database name:

 home: <CRShome>

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

[[email protected]]$





[[email protected] templates]$ exportORACLE_SID=-MGMTDB

[[email protected] templates]$ sqlplus / as sysdba



SQL*Plus: Release 12.1.0.2.0 Production onWed Dec 10 21:39:13 2014



Copyright (c) 1982, 2014, Oracle. All rights reserved.





Connected to:

Oracle Database 12c Enterprise EditionRelease 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Managementand Advanced Analytics options



SQL> select file_name fromdba_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 磁盘组了。

 

 

6 启用并启动ora.crf 资源

 

在所有节点,用root用户执行:

[[email protected] u01]# crsctl modify res ora.crf-attr ENABLED=1 -init



[[email protected] 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



[[email protected] u01]# oclumon manage -get master



Master = rac1

[[email protected] u01]#

 

Tags:

文章评论

最 近 更 新
热 点 排 行
Js与CSS工具
代码转换工具

<