oracle ocr加盘,Oracle 添加OCR镜像盘以及镜像磁盘组

添加OCR镜像盘/镜像磁盘组:

---

**查看当前信息:**

[grid@rac1 rac1]$ ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 3

Total space (kbytes) : 262120

Used space (kbytes) : 3288

Available space (kbytes) : 258832

ID : 785902757

Device/File Name : +OCR

[root@rac1 ~]# /oracle/grid/crs_1/bin/crsctl query css votedisk

\## STATE File Universal Id File Name Disk group

\1. ONLINE 5d0d201e0ab24f66bf24bfd4a88f2f30 (/dev/asm-disk2) [OCR]

\2. ONLINE 9520d9d3ab8d4fefbfe5d05b62dac9cf (/dev/asm-disk3) [OCR]

\3. ONLINE 361f26ddd0b34feabfeba6a1123533d7 (/dev/asm-disk4) [OCR]

Located 3 voting disk(s).

**添加镜像盘:**

[root@rac1 ~]# /oracle/grid/crs_1/bin/ocrconfig -add /dev/asm-disk5

[root@rac1 ~]# /oracle/grid/crs_1/bin/ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 3

Total space (kbytes) : 262120

Used space (kbytes) : 3288

Available space (kbytes) : 258832

ID : 785902757

Device/File Name : +OCR

Device/File integrity check succeeded

Device/File Name : /dev/asm-disk5

Device/File integrity check succeeded

**删除镜像盘:**

[root@rac1 ~]# /oracle/grid/crs_1/bin/ocrconfig -delete /dev/asm-disk5

单独镜像盘的意义在于使用裸设备存放OCR/VF时,可以镜像单个裸设备磁盘。

**添加OCR镜像磁盘组:**

**(1)创建磁盘组:**

create diskgroup OCR2 normal redundancy disk '/dev/asm-disk6','/dev/asm-disk7' ,'/dev/asm-disk8' ATTRIBUTE 'compatible.asm'='11.2.0.0.0';

//在两节点检查该OCR2磁盘组是否都处于mount状态。

**(2)添加OCR镜像磁盘组:**

[root@rac1 ~]# /oracle/grid/crs_1/bin/ocrconfig -add +OCR2

**(3)ocrcheck查看OCR设备**

[grid@rac1 ~]$ ocrcheck

Status of Oracle Cluster Registry is as follows :

Version : 3

Total space (kbytes) : 262120

Used space (kbytes) : 3304

Available space (kbytes) : 258816

ID : 785902757

Device/File Name : +OCR

Device/File integrity check succeeded

Device/File Name : +OCR2

Device/File integrity check succeeded

在镜像的磁盘和磁盘组中是没有Voting File信息的,也是无法添加的,VF只能使用replace替换掉当前VF磁盘组。

**替换演示:**

**当前:**

[grid@rac1 ~]$ crsctl query css votedisk

\## STATE File Universal Id File Name Disk group

\1. ONLINE 5d0d201e0ab24f66bf24bfd4a88f2f30 (/dev/asm-disk2) [OCR]

\2. ONLINE 9520d9d3ab8d4fefbfe5d05b62dac9cf (/dev/asm-disk3) [OCR]

\3. ONLINE 361f26ddd0b34feabfeba6a1123533d7 (/dev/asm-disk4) [OCR]

**replace替换:**

[root@rac1 ~]# /oracle/grid/crs_1/bin/crsctl replace votedisk +OCR2

Successful addition of voting disk 3a6ec9fdcf4b4f3ebf8efebcbd5b748c.

Successful addition of voting disk 06963edca0eb4f3ebf78a5695cea1bc1.

Successful addition of voting disk 90dab584c1a24fc0bffa1c20b0aaf1d0.

Successful deletion of voting disk 5d0d201e0ab24f66bf24bfd4a88f2f30.

Successful deletion of voting disk 9520d9d3ab8d4fefbfe5d05b62dac9cf.

Successful deletion of voting disk 361f26ddd0b34feabfeba6a1123533d7.

Successfully replaced voting disk group with +OCR2.

CRS-4266: Voting file(s) successfully replaced

//从显示中可以看出deletion

**查看已经发生变化:**

[grid@rac1 ~]$ crsctl query css votedisk

\## STATE File Universal Id File Name Disk group

\1. ONLINE 3a6ec9fdcf4b4f3ebf8efebcbd5b748c (/dev/asm-disk6) [OCR2]

\2. ONLINE 06963edca0eb4f3ebf78a5695cea1bc1 (/dev/asm-disk7) [OCR2]

\3. ONLINE 90dab584c1a24fc0bffa1c20b0aaf1d0 (/dev/asm-disk8) [OCR2]

Located 3 voting disk(s).

如果我们在OCR/VF的磁盘组中添加一块磁盘,那么VF以及OCR会自动同步到这块新添加的磁盘嘛。

测试:

**在OCR2磁盘组中添加一块磁盘**

SQL> alter diskgroup ocr2 add disk '/dev/asm-disk5';

**crsctl查看无变化:**

[grid@rac1 ~]$ crsctl query css votedisk

\## STATE File Universal Id File Name Disk group

\1. ONLINE 3a6ec9fdcf4b4f3ebf8efebcbd5b748c (/dev/asm-disk6) [OCR2]

\2. ONLINE 06963edca0eb4f3ebf78a5695cea1bc1 (/dev/asm-disk7) [OCR2]

\3. ONLINE 90dab584c1a24fc0bffa1c20b0aaf1d0 (/dev/asm-disk8) [OCR2]

**视图查询:**

SQL> select name,path,voting_file from v$asm_disk;

NAME PATH V

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

OCR2_0000 /dev/asm-disk6 Y

OCR_0000 /dev/asm-disk2 N

OCR_0001 /dev/asm-disk3 N

OCR_0002 /dev/asm-disk4 N

OCR2_0001 /dev/asm-disk7 Y

OCR2_0002 /dev/asm-disk8 Y

**OCR2_0003 /dev/asm-disk5 N**

DATA_0000 /dev/asm-disk1 N

从视图中看出新添加的盘并不是具有voting file,如果此时我踢掉一块盘,踢掉/dev/asm-disk6呢

**删除/dev/asm-disk6**

SQL> alter diskgroup ocr2 drop disk OCR2_0000;

注意这里需要写/dev/asm-disk6在ASM中对应的name 磁盘的别名。

Diskgroup altered.

**再次查看(它来了!!!)**

[grid@rac1 ~]$ crsctl query css votedisk

\## STATE File Universal Id File Name Disk group

\1. ONLINE 6b0b1252344a4f5fbf56d18ba7b4b49f (/dev/asm-disk7) [OCR2]

\2. ONLINE 78057d6e288c4f73bf4df35b12bc0686 (/dev/asm-disk8) [OCR2]

\3. ONLINE 30dbcc684e724ff5bf2e2e5e8279c2ab **(/dev/asm-disk5)** [OCR2]

**通过视图查询:**

select name,path,voting_file from v$asm_disk where path='/dev/asm-disk5';

NAME PATH V

**OCR2_0003 /dev/asm-disk5 Y**

**总结:**

1.添加单独镜像盘的意义在于使用裸设备存放OCR/VF时,可以镜像单个裸设备磁盘。

---

2.添加镜像磁盘组时,可以使用ocrcheck发现到新镜像的磁盘组(包含OCR),但是不包含Voting file无法使用crsctl query css votedisk查询到,在视图中也显示不具备Voting file,如果想要替换当前的VF磁盘组,需要我们手动执行replace替换,替换的过程就是将原磁盘组中VF信息删除,添加到新替换的磁盘组中去。

Successful addition of voting disk 90dab584c1a24fc0bffa1c20b0aaf1d0.

Successful deletion of voting disk 361f26ddd0b34feabfeba6a1123533d7.

---

3.如果向当前OCR磁盘组中添加单块盘或多块盘时,添加成功后,crsctl query css votedisk无法显示新添加的磁盘,通过视图进行查询也不具备voting file,我个人理解属于候选盘,当OCR/VF磁盘组出现问题时,或者手动踢掉一块磁盘时,出现问题的磁盘会被踢出去,然后候选盘会被写入voting file,成为VF的一员。

ending.....

你可能感兴趣的:(oracle,ocr加盘)