ITPub博客

首页 > 数据库 > Oracle > ORACLE 11G RAC 更改OCR磁盘组extenrnal 为normal

ORACLE 11G RAC 更改OCR磁盘组extenrnal 为normal

Oracle 作者:we6100 时间:2016-01-14 11:02:17 0 删除 编辑
原文地址http://www.itpub.net/thread-1580669-1-1.html

概述1.1 环境

在安装ASM磁盘时采用了extenrnal的冗余模式,现在需要将冗余模式改为normail的冗余模式。

1.2 三种冗余模式1.2.1 EXTERNAL模式

External redundancy(1OCR and no copies)

An external redundancy disk group requires a minimum of one disk device.

The effective disk space in an external redundancy disk group is the sum of the disk space in all of its devices.

Because Automatic Storage Management does not mirror data in an external

redundancy disk group, Oracle recommends that you use external redundancy with storage devices such as RAID, or other similar devices that provide their own data protection mechanisms.

1.2.2 NORMAL模式

Normal redundancy(1 OCR and 2 copies )

In a normal redundancy disk group, to increase performance and reliability,

Automatic Storage Management by default uses two-way mirroring. A normal

redundancy disk group requires a minimum of two disk devices (or two

failure groups). The effective disk space in a normal redundancy disk group is

half the sum of the disk space in all of its devices.

For Oracle Clusterware files, Normal redundancy disk groups provide 3

voting disk files, 1 OCR and 2 copies (one primary and one secondary mirror).

With normal redundancy, the cluster can survive the loss of one failure group.

For most installations, Oracle recommends that you select normal redundancy.

1.2.3 HIGH模式

High redundancy(1 OCR and 3 copies )

In a high redundancy disk group, Automatic Storage Management uses

three-way mirroring to increase performance and provide the highest level of

reliability. A high redundancy disk group requires a minimum of three disk

devices (or three failure groups). The effective disk space in a high redundancy

disk group is one-third the sum of the disk space in all of its devices.

For Oracle Clusterware files, High redundancy disk groups provide 5 voting

disk files, 1 OCR and 3 copies (one primary and two secondary mirrors). With

high redundancy, the cluster can survive the loss of two failure groups.

While high redundancy disk groups do provide a high level of data protection,

you should consider the greater cost of additional storage devices before

deciding to select high redundancy disk groups.

1.3 METALINK文档描述

[ID 428681.1]

题目:OCR / Vote disk Maintenance Operations: (ADD/REMOVE/REPLACE/MOVE)

11.2+:

From 11.2, votedisk can be stored on either ASM diskgroup or cluster file systems. The following commands can only be executed when GI is running either in cluster mode or exclusive mode. As grid user:

1. To add a Voting Disk

a. When votedisk is on cluster file system:

$ crsctl add css votedisk <VOTEDISK_LOCATION/filename>

b. When votedisk is on ASM diskgroup, no add option available. The number of votedisk is determined by the diskgroup redundancy. If more copy of votedisk is desired, one can move votedisk to a diskgroup with higher redundancy.

2. To delete a Voting Disk

a. When votedisk is on cluster file system:

$ crsctl delete css votedisk <VOTEDISK_LOCATION/filename>

b. When votedisk is on ASM, no delete option available, one can only replace the existing votedisk group with another ASM diskgroup

3. To move a Voting Disk

a. When votedisk is on cluster file system:

$ crsctl add css votedisk <NEW VOTEDISK_LOCATION/filename>

$ crsctl delete css votedisk <OLD VOTEDISK_LOCATION/filename>

b. When votedisk is on ASM or moving votedisk between cluster file system and ASM diskgroup

$ crsctl replace votedisk <+diskgroup>|<vdisk>

eg:

move to cluster file system:

$ crsctl replace votedisk /shared/vote.dat

Now formatting voting disk: /shared/vote.dat.

CRS-4256: Updating the profile

Successful addition of voting disk 32ff90ab38a04f65bf0c428c8fea9721.

Successful deletion of voting disk 3d34623f09b64f9dbfa44fabf455513e.

Successful deletion of voting disk 7043c38000a24f1abf36473ca7e9cd9e.

Successful deletion of voting disk 18de241007df4f9cbf3fbb4193f0ecb4.

CRS-4256: Updating the profile

CRS-4266: Voting file(s) successfully replaced

more to ASM diskgroup:

$ crsctl replace votedisk +OCRVOTE

CRS-4256: Updating the profile

Successful addition of voting disk 3d34623f09b64f9dbfa44fabf455513e.

Successful addition of voting disk 7043c38000a24f1abf36473ca7e9cd9e.

Successful addition of voting disk 18de241007df4f9cbf3fbb4193f0ecb4.

Successful deletion of voting disk a32c9b158e644fabbfdcc239c76f22a0.

Successfully replaced voting disk group with +CRS.

CRS-4256: Updating the profile

CRS-4266: Voting file(s) successfully replaced

1.4 联机文档描述

One reason to drop a disk group is to change the redundancy level (normal, high, or external). Because you cannot change the redundancy of a disk group, you must drop the disk group and then re-create it with the proper redundancy. In this case, you must back up or move disk group data before you drop the disk group

1.5 小结

如果要想改变asm磁盘组的冗余方式,就必须删除并重建磁盘组。

移走OCR磁盘内容2.1 备份2.1.1 备份OCR

ocrconfig –export /tmp/ocr.bak

ocrconfig –manualbackup

$ ocrconfig -showbackup                                                                                                         

node2     2012/02/24 12:09:34  /u01/grid/cdata/PMSBIPD/backup00.ocr

node2     2012/02/24 08:03:21     /u01/grid/cdata/PMSBIPD/backup01.ocr

node2     2012/02/24 04:03:21     /u01/grid/cdata/PMSBIPD/backup02.ocr

node2     2012/02/22 19:38:28     /u01/grid/cdata/PMSBIPD/day.ocr

node2     2012/02/10 11:48:21     /u01/grid/cdata/PMSBIPD/week.ocr

PROT-25: Manual backups for the Oracle Cluster Registry are not available

2.1.2 备份VOTEDISK

In Oracle Clusterware 11g release 2 (11.2), you no longer have to back up the voting disk. The voting disk data is automatically backed up in OCR as part of any configuration change and is automatically restored to any voting disk added. If all voting disks are corrupted, however, you can restore them as described in "Restoring Voting Disks".---联机文档说不需要备份votedisk,可以使用dd备份

2.1.2.1 查看VOTEDISK位置

$ crsctl query css votedisk                                                                                                     

##  STATE    File Universal Id                File Name Disk group

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

1. ONLINE   077fcbf9dd704f03bf95d2b1490208f2 (/dev/rdisk/disk444) [OCR_ORCL]

Located 1 voting disk(s).

2.1.2.2 备份

备份votedisk盘:

[root@node1 bin]# dd if=/dev/raw/raw5 of=/home/oracle/voting_disk.bak

256977+0 records in

256977+0 records out

2.1.2.3 恢复

恢复votedisk盘(如果真需要恢复的话):

[root@node1 bin]# dd if=/home/oracle/voting_disk.bak of=/dev/raw/raw5

256977+0 records in

256977+0 records out

2.1.3 备份ASM参数文件

在OCR的磁盘组里,有OCR、VOTEDISK、ASM的SPFILE参数文件,但是这里ASM的参数文件是不需要备份的,因为我们一会在改ASM参数文件位置的时候,会生产PFILE文件,那时就已经是备份了。

2.2 移动OCR

备注:这里将OCR移动到DATA_ORCL这个磁盘组上,在一个节点操作即可。

当OCR只有一份时,如果移动则会报错

NODE1#[/u01/grid/bin]./ocrconfig -replace OCR_ORCL -replacement  DATA_ORCL

PROT-28: Cannot delete or replace the only configured Oracle Cluster Registry location

2.2.1 添加一份OCR

NODE1#[/u01/grid/bin]./ocrconfig -add +DATA_ORCL

2.2.2 检查OCR位置

NODE1#[/u01/grid/bin]./ocrcheck  

Status of Oracle Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2852

         Available space (kbytes) :     259268

         ID                       :  941087888

         Device/File Name         :    +OCR_ORCL

                                    Device/File integrity check succeeded

         Device/File Name         :   +DATA_ORCL

                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

2.2.3 删除一份OCR

NODE1#[/u01/grid/bin]./ocrconfig -delete +OCR_ORCL

NODE1#[/u01/grid/bin]./ocrcheck  

Status of Oracle Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2852

         Available space (kbytes) :     259268

         ID                       :  941087888

         Device/File Name         :   +DATA_ORCL

                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

NODE1#[/u01/grid/bin]cat /var/opt/oracle/ocr.loc

#Device/file +OCR_ORCL getting replaced by device +DATA_ORCL

ocrconfig_loc=+DATA_ORCL

2.3 移动VOTEDISK

NODE1#[/u01/grid/bin]./crsctl replace votedisk +DATA_ORCL

Successful addition of voting disk 21dffc4c1ef84feebfaf2340c61853ba.

Successful deletion of voting disk 077fcbf9dd704f03bf95d2b1490208f2.

Successfully replaced voting disk group with +DATA_ORCL.

CRS-4266: Voting file(s) successfully replaced

NODE1#[/u01/grid/bin]./crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

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

1. ONLINE   21dffc4c1ef84feebfaf2340c61853ba (/dev/rdisk/disk447) [DATA_ORCL]

备注:在一个节点操作即可。

2.4 移动ASM参数文件2.4.1 查看ASM位置

$sqlplus / as sysasm

SQL> show parameter spfile

NAME                                 TYPE        VALUE

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

spfile                               string      +OCR_ORCL/pmsbipd/asmparameterfile/registry.253.760201253

2.4.2 创建PFILE

SQL> create pfile='/home/grid/asminit.ora' from spfile='+OCR_ORCL/pmsbipd/asmparameterfile/registry.253.760201253';

File created.

2.4.3 查看PFILE内容

$ cat asminit.ora

+ASM2.asm_diskgroups='DATA_ORCL','REDO_ORCL'#Manual Mount

+ASM1.asm_diskgroups='DATA_ORCL','REDO_ORCL'#Manual Mount

*.asm_power_limit=1

*.diagnostic_dest='/u01/oracle'

*.instance_type='asm'

*.large_pool_size=12M

*.remote_login_passwordfile='EXCLUSIVE'

2.4.4 关闭ASM实例

NODE2#[/u01/grid/bin]./srvctl stop asm -o abort -f

2.4.5 PFILE启动ASM实例

$sqlplus / as sysasm

SQL> startup pfile='/home/grid/asminit.ora';

ASM instance started

Total System Global Area  283930624 bytes

Fixed Size                  2169104 bytes

Variable Size             256595696 bytes

ASM Cache                  25165824 bytes

ASM diskgroups mounted

SQL> show parameter spfile

NAME                                 TYPE        VALUE

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

spfile                               string

2.4.6 创建SPFILE

SQL> create spfile='+DATA_ORCL' from pfile='/home/grid/asminit.ora';

File created.

2.4.7 SPFILE启动ASM实例

NODE2#[/u01/grid/bin]./srvctl stop asm -o abort -f

$sqlplus / as sysasm

SQL> startup

ASM instance started

Total System Global Area  283930624 bytes

Fixed Size                  2169104 bytes

Variable Size             256595696 bytes

ASM Cache                  25165824 bytes

ASM diskgroups mounted

SQL> show parameter spfile

NAME    TYPE    VALUE

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

spfile   string    +DATA_ORCL/pmsbipd/asmparameterfile/registry.253.776257911

2.4.8 节点二重启CLUSTER

将另一个节点的cluster重启以保证asm的spfile是新的参数文件

此时最好是将2个节点的cluster都重启下,让所有的资源都正常。

删除OCR磁盘组3.1 查看OCR磁盘组状态

节点一:

SQL>  select name,state from v$asm_diskgroup;

NAME                           STATE

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

DATA_ORCL                        MOUNTED

REDO_ORCL                        MOUNTED

OCR_ORCL                         DISMOUNTED

节点二:

SQL>  select name,state from v$asm_diskgroup;

NAME                           STATE

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

DATA_ORCL                        MOUNTED

REDO_ORCL                        MOUNTED

OCR_ORCL                         DISMOUNTED

3.2 查看OCR磁盘组包括的磁盘

SQL> select name,GROUP_NUMBER ,DISK_NUMBER,state,REDUNDANCY ,TOTAL_MB,FREE_MB,path from v$asm_disk where name like 'OCR%';

NAME                           GROUP_NUMBER DISK_NUMBER STATE    REDUNDA   TOTAL_MB    FREE_MB PATH

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

OCR_ORCL_0000                               1           0 NORMAL   UNKNOWN       1031        844 /dev/rdisk/disk444

OCR_ORCL_0001                               1           1 NORMAL   UNKNOWN       1031        908 /dev/rdisk/disk445

OCR_ORCL_0002                               1           2 NORMAL   UNKNOWN       1031        909 /dev/rdisk/disk446

3.3 节点2卸载OCR磁盘

备注:节点一不卸载

SQL> alter diskgroup OCR_ORCL dismount ;

Diskgroup altered.

SQL>  select name,state from v$asm_diskgroup;

NAME                           STATE

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

DATA_ORCL                        MOUNTED

REDO_ORCL                        MOUNTED

OCR_ORCL                         DISMOUNTED

3.4 OCR磁盘组删除

备注:在节点一操作

SQL>  drop diskgroup OCR_ORCL including contents;

Diskgroup dropped.

3.5 两节点查看

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE

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

DATA_ORCL                        MOUNTED

REDO_ORCL                        MOUNTED

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE

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

DATA_ORCL                        MOUNTED

REDO_ORCL                        MOUNTED

4 ASMCA重建OCR磁盘组4.1 打开4.2 创建注意选择normal冗余 4.3 完成4.4 查看状态

SQL> select name,state from v$asm_diskgroup;

NAME                           STATE

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

DATA_ORCL                        MOUNTED

REDO_ORCL                        MOUNTED

OCR_ORCL                         MOUNTED

将信息移回OCR磁盘组5.1 OCR移回5.1.1 查看OCR位置

NODE1#[/u01/grid/bin]./ocrcheck

Status of Oracle Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2852

         Available space (kbytes) :     259268

         ID                       :  941087888

         Device/File Name         :   +DATA_ORCL

                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

./       Logical corruption check succeeded

5.1.2 添加一份OCR

NODE1#[/u01/grid/bin]./ocrconfig -add +OCR_ORCL

NODE1#[/u01/grid/bin]./ocrcheck  

Status of Oracle Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2852

         Available space (kbytes) :     259268

         ID                       :  941087888

         Device/File Name         :   +DATA_ORCL

                                    Device/File integrity check succeeded

         Device/File Name         :    +OCR_ORCL

                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

5.1.3 删除一份OCR

NODE1#[/u01/grid/bin]./ocrconfig -delete +DATA_ORCL

NODE2#[/u01/grid/bin]./ocrcheck

Status of Oracle Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2852

         Available space (kbytes) :     259268

         ID                       :  941087888

         Device/File Name         :    +OCR_ORCL

                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

5.2 VOTEDISK移回

NODE1#[/u01/grid/bin]./crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

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

1. ONLINE   21dffc4c1ef84feebfaf2340c61853ba (/dev/rdisk/disk447) [DATA_ORCL]

Located 1 voting disk(s).

NODE1#[/u01/grid/bin]./crsctl replace votedisk +OCR_ORCL

Successful addition of voting disk 57ebf38a74524fbebf146a38ef3e1088.

Successful addition of voting disk 376ef62cf1c14febbfd6635bd9786366.

Successful addition of voting disk 6658efafcb194f7cbff49fa4bb8b5408.

Successful deletion of voting disk 21dffc4c1ef84feebfaf2340c61853ba.

Successfully replaced voting disk group with +OCR_ORCL.

CRS-4266: Voting file(s) successfully replaced

NODE1#[/u01/grid/bin]./crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

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

1. ONLINE   57ebf38a74524fbebf146a38ef3e1088 (/dev/rdisk/disk444) [OCR_ORCL]

2. ONLINE   376ef62cf1c14febbfd6635bd9786366 (/dev/rdisk/disk445) [OCR_ORCL]

3. ONLINE   6658efafcb194f7cbff49fa4bb8b5408 (/dev/rdisk/disk446) [OCR_ORCL]

Located 3 voting disk(s).

5.3 ASM参数文件移回5.3.1 创建PFILE

$ sqlplus / as sysasm

SQL> show parameter spfile

NAME   TYPE        VALUE

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

spfile   string  +DATA_ORCL/pmsbipd/asmparameterfile/registry.253.776257911

SQL> create pfile='/home/grid/asmocrinit.ora' from spfile='+DATA_ORCL/pmsbipd/asmparameterfile/registry.253.776257911';

File created.

5.3.2 关闭ASM实例

NODE1#[/u01/grid/bin]./srvctl stop asm -o abort -f

5.3.3 启动ASM实例

$ sqlplus / as sysasm

SQL> startup pfile='/home/grid/asmocrinit.ora';

ASM instance started

Total System Global Area  283930624 bytes

Fixed Size                  2169104 bytes

Variable Size             256595696 bytes

ASM Cache                  25165824 bytes

ASM diskgroups mounted

5.3.4创建SPFILE

SQL> create spfile='+OCR_ORCL' from pfile='/home/grid/asmocrinit.ora';

File created.

5.3.5 关闭ASM实例

NODE1#[/u01/grid/bin]./srvctl stop asm -o abort -f

5.3.6 节点一启动CLUSTER

NODE1#[/u01/grid/bin]./crsctl start cluster -n node1

5.3.7 节点二启动CLUSTER

NODE2#[/u01/grid/bin]./crsctl start cluster -n node2

查看OCRVOTEDISKASM参数文件位置6.1 查看OCR位置

NODE2#[/u01/grid/bin]./ocrcheck

Status of Oracle Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2852

         Available space (kbytes) :     259268

         ID                       :  941087888

         Device/File Name         :    +OCR_ORCL

                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check succeeded

6.2 查看VOTEDISK位置

NODE2#[/u01/grid/bin]./crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

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

1. ONLINE   57ebf38a74524fbebf146a38ef3e1088 (/dev/rdisk/disk444) [OCR_ORCL]

2. ONLINE   376ef62cf1c14febbfd6635bd9786366 (/dev/rdisk/disk445) [OCR_ORCL]

3. ONLINE   6658efafcb194f7cbff49fa4bb8b5408 (/dev/rdisk/disk446) [OCR_ORCL]

Located 3 voting disk(s).

6.3 查看ASM参数文件位置

$ sqlplus / as sysasm                                                                                                           

SQL*Plus: Release 11.2.0.1.0 Production on Sun Feb 26 14:31:43 2012

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Real Application Clusters and Automatic Storage Management options

SQL> show parameter spfile

NAME                                 TYPE        VALUE

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27500440/viewspace-1976329/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-02-23

  • 博文量
    72
  • 访问量
    268490