Oracle 12c RAC 替换 OCR 磁盘组操作步骤

注:本文谢绝转载!

为方便以后的测试,整了一套新的测试环境,600G PCIe 闪存卡+8核CPU+16G内存。  把整个虚拟机从我的电脑上直接copy 过去,网络什么都没问题,但是RAC 的共享设备是重新添加的。 这样之前旧的数据都不存在。

所以用脚本直接重建了OCR和Voting Disk,RAC 启动,没有问题,但是磁盘组出现错乱,Dave 有强迫症的倾向,所以重新重新添加了一个磁盘组。  把OCR 和 voting disk 都替换到新创建的OCR 磁盘组了。

所以以下所有的操作,只为一个事情准备,就是在Oracle 12c RAC 环境下,更换OCR 磁盘组。从OCR_VOINT 改成 OCR。

实际上,更换OCR 和Voting 的操作和11g 一样,但是12c 会多出其他的部分,具体如下。

1  替换OCR 和 Voting disk

--替换VOTEDISK

[[email protected] ~]# crsctl query css votedisk

## STATE    File Universal Id                File Name Disk group

-- -----    -----------------                --------- ---------

1.ONLINE   f56b0e0be76b4f03bf4782230c783e67(/dev/asm-diskb) [OCR_VOTING]

Located 1 voting disk(s).

[[email protected] ~]# crsctl replace votedisk +OCR

Successful addition of voting disk2aa04b8a77d84fcbbfd272ad2b665bcc.

Successful addition of voting disk7dd098bc01ec4fcebfc8f3e2f12f11b7.

Successful addition of voting diskd0b8ab3340ed4f6dbfa087f8f4a59c49.

Successful deletion of voting diskf56b0e0be76b4f03bf4782230c783e67.

Successfully replaced voting disk groupwith +OCR.

CRS-4266: Voting file(s) successfullyreplaced

[[email protected] ~]# crsctl query css votedisk

## STATE    File Universal Id                File Name Disk group

-- -----    -----------------                --------- ---------

1.ONLINE   2aa04b8a77d84fcbbfd272ad2b665bcc(/dev/asm-diskf) [OCR]

2.ONLINE   7dd098bc01ec4fcebfc8f3e2f12f11b7(/dev/asm-diskg) [OCR]

3.ONLINE   d0b8ab3340ed4f6dbfa087f8f4a59c49(/dev/asm-diskh) [OCR]

Located 3 voting disk(s).

[[email protected] ~]#

[[email protected] rac1]$ crsctl stat res -t

--------------------------------------------------------------------------------

Name           Target  State       Server                   Statedetails

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.ASMNET1LSNR_ASM.lsnr

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.DATA.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.LISTENER.lsnr

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.OCR.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.OCR_VOTING.dg

OFFLINE OFFLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.net1.network

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.ons

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.proxy_advm

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

1        ONLINE  ONLINE      rac1                     STABLE

ora.MGMTLSNR

1        ONLINE  ONLINE      rac1                     169.254.193.105192.

168.57.5,STABLE

ora.asm

1        ONLINE  ONLINE      rac1                     STABLE

2        ONLINE  ONLINE      rac2                     STABLE

3        OFFLINE OFFLINE                               STABLE

ora.cndba.db

1        ONLINE  OFFLINE                               STABLE

2        OFFLINE OFFLINE                               CorruptedControlfil

e,STABLE

ora.cvu

1        ONLINE  ONLINE      rac1                     STABLE

ora.mgmtdb

1        ONLINE  OFFLINE                               STABLE

ora.oc4j

1        ONLINE  ONLINE      rac1                     STABLE

ora.rac1.vip

1        ONLINE  ONLINE      rac1                     STABLE

ora.rac2.vip

1        ONLINE  ONLINE      rac2                     STABLE

ora.scan1.vip

1        ONLINE  ONLINE      rac1                     STABLE

--------------------------------------------------------------------------------

[[email protected] rac1]$

SQL> alter diskgroup ocr_voting dismount;

alter diskgroup ocr_voting dismount

*

ERROR at line 1:

ORA-15032: not all alterations performed

ORA-15027: active use of diskgroup"OCR_VOTING" precludes its dismount

磁盘组正在被使用,使用md_backup 命令备份一下OCR,这里主要是查看这个磁盘组上有哪些文件,然后逐一转移走。

[[email protected] ~]$ asmcmd md_backup/tmp/ocr_back -G OCR_VOTING

Disk group metadata to be backed up:OCR_VOTING

Current alias directory path:rac-scan/ASMPARAMETERFILE

Current alias directory path: ASM

Current alias directory path:CNDBA/CONTROLFILE

Current alias directory path: ASM/PASSWORD

Current alias directory path: rac-scan

Current alias directory path: CNDBA

Current alias directory path:rac-scan/OCRFILE

2  更改控制文件位置

--查看当前控制文件位置

SQL> select name from v$controlfile;

NAME

--------------------------------------------------------------------------------

+DATA/CNDBA/CONTROLFILE/current.261.854948915

+OCR_VOTING/CNDBA/CONTROLFILE/current.268.854948917

--修改控制文件参数:

SQL> alter system set control_files =‘+DATA/CNDBA/CONTROLFILE/control01.ctl‘,‘+DATA/CNDBA/CONTROLFILE/control02.ctl‘,‘+DATA/CNDBA/CONTROLFILE/control03.ctl‘scope=spfile sid=‘*‘;

System altered.

这里注意,Oracle ASM 中的文件是由OMF 管理的,所以我们不能和之前查询的一样,执行稳定的ID,我们这里只能指定别名,然后OMF 会自动产生一个文件与别名对应,这里我们等会在验证。 继续下一步。

[[email protected] rac1]$ srvctl stop database -dcndba

[[email protected] rac1]$ crsctl stat res -t

--------------------------------------------------------------------------------

Name           Target  State       Server                   Statedetails

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.ASMNET1LSNR_ASM.lsnr

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.DATA.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.LISTENER.lsnr

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.OCR.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.OCR_VOTING.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

……

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

1        ONLINE  ONLINE      rac1                     STABLE

ora.MGMTLSNR

1        ONLINE  ONLINE      rac1                     169.254.193.105192.

168.57.5,STABLE

ora.asm

1        ONLINE  ONLINE      rac1                     STABLE

2        ONLINE  ONLINE      rac2                     STABLE

3        OFFLINE OFFLINE                               STABLE

ora.cndba.db

1       OFFLINE OFFLINE                               InstanceShutdown,ST

ABLE

2       OFFLINE OFFLINE                               InstanceShutdown,ST

ABLE

……

[[email protected] rac1]$

--移动控制文件位置

ASMCMD> pwd

+ocr_voting/cndba/controlfile

ASMCMD> ls

Current.268.854948917

ASMCMD> pwd

+ocr_voting/cndba/controlfile

ASMCMD> ls

Current.268.854948917

ASMCMD> cp Current.268.854948917 +DATA/CNDBA/CONTROLFILE/control01.ctl

copying+ocr_voting/cndba/controlfile/Current.268.854948917 ->+DATA/CNDBA/CONTROLFILE/control01.ctl

ASMCMD> cp Current.268.854948917+DATA/CNDBA/CONTROLFILE/control02.ctl

copying+ocr_voting/cndba/controlfile/Current.268.854948917 ->+DATA/CNDBA/CONTROLFILE/control02.ctl

ASMCMD> cp Current.268.854948917+DATA/CNDBA/CONTROLFILE/control03.ctl

copying+ocr_voting/cndba/controlfile/Current.268.854948917 ->+DATA/CNDBA/CONTROLFILE/control03.ctl

ASMCMD>

--启动数据库并查看:

[[email protected] rac1]$ srvctl start database -dcndba

[[email protected] rac1]$ crsctl stat res -t

--------------------------------------------------------------------------------

Name           Target  State       Server                   Statedetails

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.ASMNET1LSNR_ASM.lsnr

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.DATA.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.LISTENER.lsnr

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.OCR.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

ora.OCR_VOTING.dg

ONLINE  ONLINE      rac1                     STABLE

ONLINE  ONLINE      rac2                     STABLE

……

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

1        ONLINE  ONLINE      rac1                     STABLE

ora.MGMTLSNR

1        ONLINE  ONLINE      rac1                     169.254.193.105 192.

168.57.5,STABLE

ora.asm

1        ONLINE  ONLINE      rac1                     STABLE

2        ONLINE  ONLINE      rac2                     STABLE

3        OFFLINE OFFLINE                               STABLE

ora.cndba.db

1        ONLINE  ONLINE      rac1                     Open,STABLE

2        ONLINE  ONLINE      rac2                     Open,STABLE

……

--------------------------------------------------------------------------------

[[email protected] rac1]$

ASMCMD> pwd

+data/cndba/controlfile

ASMCMD> ls -l

Type        Redund  Striped  Time             Sys  Name

CONTROLFILE UNPROT  FINE     DEC 08 11:00:00  Y   Current.261.854948915

CONTROLFILE UNPROT  FINE     DEC 08 12:00:00  N   control01.ctl => +DATA/ASM/CONTROLFILE/control01.ctl.276.865771415

CONTROLFILE UNPROT  FINE     DEC 08 12:00:00  N   control02.ctl => +DATA/ASM/CONTROLFILE/control02.ctl.277.865771425

CONTROLFILE UNPROT  FINE     DEC 08 12:00:00  N   control03.ctl => +DATA/ASM/CONTROLFILE/control03.ctl.278.865771431

ASMCMD>

--drop 还是报错,继续处理:

SQL> drop diskgroup ocr_voting includingcontents;

drop diskgroup ocr_voting includingcontents

*

ERROR at line 1:

ORA-15039: diskgroup not dropped

ORA-15027: active use of diskgroup"OCR_VOTING" precludes its dismount

3  更改ASM中密码文件位置

ASMCMD> showversion

ASM version         : 12.1.0.1.0

ASMCMD> pwd

+ocr_voting

ASMCMD> ls -l

Type     Redund  Striped  Time             Sys  Name

Y    ASM/

Y    CNDBA/

Y    _MGMTDB/

PASSWORD  UNPROT COARSE   AUG 07 02:00:00  N   orapwasm => +OCR_VOTING/ASM/PASSWORD/pwdasm.256.854938127

Y    rac-scan/

ASMCMD>

我们这里直接在新的磁盘组里创建一个:

[[email protected] rac1]$ orapwdfile=‘+ocr/orapwasm‘ asm=y

Enter password for SYS:

[[email protected] rac1]$

--验证:

[[email protected] ~]$ srvctl config asm

ASM home: /u01/gridsoft/12.1.0

Password file: +OCR/orapwasm

ASM listener: LISTENER

ASM instance count: 3

Cluster ASM listener: ASMNET1LSNR_ASM

[[email protected] ~]$

4  修改online redo log 位置

进入asmcmd 看,还有onlineredo log 文件,继续转移。

SQL> select group#,thread#,blocksizefrom v$log;

GROUP#    THREAD#  BLOCKSIZE

---------- ---------- ----------

1      1        512

2      1        512

3      2        512

4      2        512

SQL> ALTER DATABASE ADD LOGFILE THREAD 1group 7 ‘+DATA‘ size 200M;

Database altered.

SQL> ALTER DATABASE ADD LOGFILE THREAD 1group 6 ‘+DATA‘ size 200M;

Database altered.

SQL> ALTER DATABASE ADD LOGFILE THREAD 1group 5 ‘+DATA‘ size 200M;

Database altered.

SQL> ALTER DATABASE ADD LOGFILE THREAD 2group 8 ‘+DATA‘ size 200M;

Database altered.

SQL> ALTER DATABASE ADD LOGFILE THREAD 2group 9 ‘+DATA‘ size 200M;

Database altered.

SQL> ALTER DATABASE ADD LOGFILE THREAD 2group 10 ‘+DATA‘ size 200M;

Database altered.

SQL> alter databasedrop logfile group1;

Database altered.

SQL> alter database drop logfile group4;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> alter database drop logfile group3;

alter database drop logfile group 3

*

ERROR at line 1:

ORA-01624: log 3 needed for crash recoveryof instance cndba2 (thread 2)

ORA-00312: online log 3 thread 2:‘+DATA/CNDBA/ONLINELOG/group_3.269.854950325‘

ORA-00312: online log 3 thread 2:

‘+OCR_VOTING/CNDBA/ONLINELOG/group_3.271.854950331‘

--测试库,不等了,直接unarchive:

SQL> alter database clear unarchivedlogfile group 3;

Database altered.

SQL> alter database clear unarchivedlogfile group 2;

Database altered.

SQL> alter database drop logfile group2;

Database altered.

SQL> alter database drop logfile group3;

Database altered.

SQL> select group#,thread#,blocksize from v$log;

GROUP#    THREAD#  BLOCKSIZE

---------- ---------- ----------

5      1        512

6      1        512

7      1        512

8      2        512

9      2        512

10      2       512

6 rows selected.

5        修改asm spfile位置

--查看当前位置:

[[email protected] grid]$ gpnptool get -o-

……

<orcl:ASM-Profile id="asm"DiscoveryString="/dev/asm*"SPFile="+OCR_VOTING/rac-scan/ASMPARAMETERFILE/registry.253.854938125"Mode="remote"/>

……

Success.

[[email protected] grid]$

--修改:

[[email protected] /]$ sqlplus / as sysasm

SQL*Plus: Release 12.1.0.1.0 Production onTue Dec 9 12:37:03 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 Real Application Clusters andAutomatic Storage Management options

SQL> create pfile=‘/tmp/pfile.asm‘ fromspfile;

File created.

SQL> create spfile=‘+OCR‘ FROMPFILE=‘/tmp/pfile.asm‘;

File created.

--检查:

[[email protected] grid]$ gpnptool get -o-

……

<orcl:ASM-Profile id="asm" DiscoveryString="/dev/asm*"SPFile="+OCR/rac-scan/ASMPARAMETERFILE/registry.253.865859837"Mode="remote"/>

……

Success.

[[email protected] grid]$

这里修改成功。

但是查看还是旧目录:

SQL> show parameter spfile

NAME                     TYPE   VALUE

------------------------------------ -----------------------------------------

spfile                   string +OCR_VOTING/rac-scan/ASMPARAME

TERFILE/registry.253.854938125

重启ASM实例,让修改生效:

SQL> shutdown immediate

ASM diskgroups dismounted

ASM instance shutdown

SQL> startup

ASM instance started

Total System Global Area 1135747072 bytes

Fixed Size          2297344 bytes

Variable Size       1108283904 bytes

ASM Cache          25165824 bytes

ASM diskgroups mounted

SQL> show parameter spfile

NAME                     TYPE   VALUE

------------------------------------ -----------------------------------------

spfile                   string +OCR/rac-scan/ASMPARAMETERFILE

/registry.253.865859837

SQL>

以上是在节点1操作的,在节点2 同样也需要重启ASM。

注意:在11g以后,重启ASM,整个节点的CRS 也就挂了。

[[email protected] ~]# crs_stat -t

CRS-0184: Cannot communicate with the CRSdaemon.

所以改操作只能一个节点依次操作。

6  转移MGMTDB 数据文件

在Oracle 12c中,默认情况下,MGMTDB 实例的数据文件也是存放在OCR 磁盘组的,所以我们在drop 之前,必须先转移走对应的数据文件。 这里的具体操作,另篇blog 在说明。

7  drop 旧磁盘组

--在节点2 dismount 磁盘组:

SQL> alter diskgroup ocr_votingdismount;

Diskgroup altered.

--节点1 上drop:

SQL> drop diskgroup ocr_voting includingcontents;

Diskgroup dropped.

到此,更换成功,整个世界安静了。

--------------------------------------------------------------------------------------------

版权所有,文章禁止转载,否则追究法律责任!

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(满)

时间: 2024-11-05 21:51:26

Oracle 12c RAC 替换 OCR 磁盘组操作步骤的相关文章

Oracle Study之--AIX RAC下OCR磁盘故障(PROT-602)

Oracle Study之--AIX RAC下OCR磁盘故障(PROT-602) ********************************************************************************  Welcome to AIX Version 5.3!                                                **                                                  

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

注:本文谢绝转载! 在之前的Blog里介绍了Oracle12c RAC 中的MGMTDB的概念,参考: Oracle 12cRAC MGMTDB 说明 http://blog.csdn.net/tianlesoftware/article/details/41804553 而在默认情况下,MGMTDB 的数据文件是存放在OCR voting disk的磁盘组里的,为了节省OCR 磁盘组空间,我们也可以把MGMTDB 转移走. 当然,这里的移动位置,也是从一个共享位置移动到另一个共享位置. 具体

centos 7部署oracle 12c rac 上菜了

oracle 12c 发布用很长一段时间了,虽然在近期部署了几套单实例oracle 12c,但一直都没有机会在生产环境实施12c rac,当然,既不能把现有的11g rac干掉,替换成12c rac,又没有新的项目找上来,但总不能等需要干活的时候再学习测试,未雨绸缪,正好从青龙那里化缘来一台配置不错的技嘉迷你pc,正好用它来做测试,安装上proxmox,虚拟出一堆系统,然后就有条件测试部署oracle 12c rac . Oracle实现负载均衡,完全不依赖于其它第三方工具,自己全部搞定,真是牛

Oracle 12c RAC 修改SCAN 配置

注:本文谢绝转载! 关于RAC 的SCAN 的理论说明,参考如下链接: Oracle RAC 集群 SCAN 说明 http://blog.csdn.net/tianlesoftware/article/details/42712979 Oracle 12c RAC 集群使用DNS 实现 SCAN http://blog.csdn.net/tianlesoftware/article/details/42917867 这篇blog 看下12c中对SCAN 的修改,修改包括2个方面: (1)  修

AIX 5.3 Install Oracle 10g RAC 错误集锦--磁盘I/O 故障

AIX 5.3  Install Oracle 10g RAC 错误集锦--磁盘I/O 故障 系统环境: 操作系统: AIX 5300-09 集群软件: CRS 10.2.0.1 数据库:   Oracle 10.2.0.1                      系统架构图                                        本机采用vg 并发(VG concurrent)作为共享的存储 故障现象: . 当在第一个node(aix211)执行root.sh时,被ha

Oracle 12c rac搭建

1.1 硬件需求 ? 服务器具有相同的体系架构(如 64bit 和 32bit 不能同一集群) ? 非 cluster 环境要求物理内存高于 2G,cluster 环境要求物理内存高于 3G 1.2 操作系统要求 ? 操作系统版本要保持至少和源端一样或者更高的版本,操作系统补丁和源端一致 ? 数据库版本11.2.0.3.0,要求AIX6.1 TL04以上.7.1 ? 数据库版本11.2.0.4.0,要求AIX6.1 TL04以上.7.1.7.2 ? Linux操作系统版本最好 RHEL 6.7以

Oracle 12c RAC 集群使用 GNS 实现 SCAN

注:本文谢绝转载! 1   说明 在前面的Blog中,讲过RAC 中SCAN 的配置有三种方式: (1) /etc/hosts (2) DNS (3) GNS 具体链接如下: Oracle RAC 集群 SCAN 说明 http://blog.csdn.net/tianlesoftware/article/details/42712979 Oracle 12c RAC 集群使用DNS 实现 SCAN http://blog.csdn.net/tianlesoftware/article/deta

Oracle 12c RAC 集群使用DNS 实现 SCAN

注:本文谢绝转载! 1   说明 关于RAC 集群的SCAN 特性说明参考: Oracle RAC 集群 SCAN 说明 http://blog.csdn.net/tianlesoftware/article/details/42712979 本文描述Oracle 12c RAC 集群使用DNS 实现SCAN. DNS 的配置工作,就是分配SCAN IP地址,并映射到一个域名上. SCAN IP最多有3个,我的环境,只有2个节点,这个也没关系,我照样弄3个SCANIP. 当前IP规划: [[em

ORACLE 11204 GRID在CRS磁盘组损坏后的处理

ORACLE 11204 GRID在CRS磁盘组损坏后的处理主要处理CRS磁盘组(ocr和votedisk所在的磁盘组)损坏的情况下,对CRS磁盘处理.1.模拟故障[[email protected] ~]$ ocrcheckStatus of Oracle Cluster Registry is as follows :Version : 3Total space (kbytes) : 262120Used space (kbytes) : 3152Available space (kbyte