环境:
操作系统: AIX 5300-09
集群软件: CRS 10.2.0.1
数据库: Oracle 10.2.0.1
RAC 环境
本机采用vg 并发(VG concurrent)作为共享的存储
1、Oracle Clusterware 组成
Oracle Cluster 是一个单独的安装包,安装后,在每个结点上的Oracle Clusterware 会自动启动。 Oracle Clusterware的运行环境由2个磁盘文件(OCR,Voting Disk),若干进程和网络元素组成。
1) 磁盘文件:
Clusterware 在运行期间需要两个文件:OCR和Voting Disk. 这2个文件必须存放在共享存储上。 OCR 用于解决健忘问题,Voting Disk 用于解决脑裂问题。 Oracle 建议使用裸设备来存放这2个文件,每个文件创建一个裸设备,每个裸设备分配100M左右的空间就够了。
OCR:
健忘问题是由于每个节点都有配置信息的拷贝,修改节点的配置信息不同步引起的。 Oracle 采用的解决方法就是把这个配置文件放在共享的存储上, 这个文件就是OCR Disk。
OCR 中保存整个集群的配置信息,配置信息以"Key-Value" 的形式保存其中。
Voting Disk:
Voting Disk 这个文件主要用于记录节点成员状态,在出现脑裂时,决定那个Partion获得控制权,其他的Partion必须从集群中剔除。在安装Clusterware时也会提示指定这个位置。安装完成后可以通过如下命令来查看Voting Disk位置。
$Crsctl query css votedisk
2、OCR 维护
对于Oracle 10g RAC ,OCR存储在raw 设备上,在安装时选择“External redundancy”时,只需要一个raw ;但为保证OCR的健壮性,可以给OCR添加Mirror。
1)查看OCR信息:
[root@aix211 /]#ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262056
Used space (kbytes) : 3248
Available space (kbytes) : 258808
ID : 128956142
Device/File Name : /dev/rrac_ocr
Device/File integrity check succeeded
Device/File not configured
Cluster registry integrity check succeeded
[root@aix211 /]#
CRS版本:
[root@aix211 /]# crsctl query crs softwareversion
CRS software version on node [aix211] is [10.2.0.1.0]
[root@aix211 /]#crsctl query crs activeversion
CRS active version on the cluster is [10.2.0.1.0]
注意:
对于CRS 这个版本bug,要求OCR mirror必须比原OCR 容量要超过256M以上!
[root@aix211 /]#
OCR存储信息:
[root@aix211 /]#ocrdump -stdout -keyname SYSTEM -xml|more
<OCRDUMP>
<TIMESTAMP>04/09/2014 10:03:18</TIMESTAMP>
<COMMAND>/u01/crs_1/bin/ocrdump.bin -stdout -keyname SYSTEM -xml </COMMAND>
<KEY>
<NAME>SYSTEM</NAME>
<VALUE_TYPE>UNDEF</VALUE_TYPE>
<VALUE><![CDATA[]]></VALUE>
<USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
<GROUP_PERMISSION>PROCR_READ</GROUP_PERMISSION>
<OTHER_PERMISSION>PROCR_READ</OTHER_PERMISSION>
<USER_NAME>root</USER_NAME>
<GROUP_NAME>system</GROUP_NAME>
<KEY>
<NAME>SYSTEM.css</NAME>
<VALUE_TYPE>UNDEF</VALUE_TYPE>
<VALUE><![CDATA[]]></VALUE>
<USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
<GROUP_PERMISSION>PROCR_READ</GROUP_PERMISSION>
<OTHER_PERMISSION>PROCR_READ</OTHER_PERMISSION>
<USER_NAME>root</USER_NAME>
<GROUP_NAME>system</GROUP_NAME>
<KEY>
<NAME>SYSTEM.css.interfaces</NAME>
<VALUE_TYPE>UNDEF</VALUE_TYPE>
<VALUE><![CDATA[]]></VALUE>
<USER_PERMISSION>PROCR_ALL_ACCESS</USER_PERMISSION>
[root@aix211 /]#
OCR 备份信息:
对于OCR,crs会自动在master node 上自动备份(每4个小时自动备份一次);会保留最近的3个,及上周,上一天的最新的备份!
[root@aix211 /]#ocrconfig -showbackup
aix211 2014/04/08 17:18:40 /u01/crs_1/cdata/crs
aix211 2014/04/08 13:18:39 /u01/crs_1/cdata/crs
aix212 2014/04/04 18:15:21 /u01/crs_1/cdata/crs
aix211 2014/04/08 13:18:39 /u01/crs_1/cdata/crs
aix212 2014/04/04 18:15:21 /u01/crs_1/cdata/crs
2)建立OCR mirror
建立逻辑卷:
[root@aix211 /]#lsvg dbvg
VOLUME GROUP: dbvg VG IDENTIFIER: 00040f8a00004c00000001452a7f1815
VG STATE: active PP SIZE: 64 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 479 (30656 megabytes)
MAX LVs: 512 FREE PPs: 369 (23616 megabytes)
LVs: 18 USED PPs: 110 (7040 megabytes)
OPEN LVs: 14 QUORUM: 2 (Enabled)
TOTAL PVs: 1 VG DESCRIPTORS: 2
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 1 AUTO ON: no
Concurrent: Enhanced-Capable Auto-Concurrent: Disabled
VG Mode: Concurrent
Node ID: 1 Active Nodes: 2
MAX PPs per VG: 130048
MAX PPs per PV: 1016 MAX PVs: 128
LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable
[root@aix211 /]#lsvg -l dbvg
dbvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
rac_ocr raw 4 4 1 open/syncd N/A
rac_vote raw 4 4 1 open/syncd N/A
......
[root@aix211 /]#mklv -y 'rac_ocr1' -t 'raw' dbvg 10 (10个pp ,远超过原来ocr的4个pp)
rac_ocr1
[root@aix211 /]#lsvg -l dbvg
dbvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
rac_ocr raw 4 4 1 open/syncd N/A
rac_vote raw 4 4 1 open/syncd N/A
......
rac_ocr1 raw 10 10 1 closed/syncd N/A
修改裸设备属性:
[root@aix211 /]#ls -l /dev |grep ocr
brw-rw---- 1 oracle dba 90, 1 Apr 4 11:24 rac_ocr
brw-rw---- 1 root system 90, 19 Apr 9 10:05 rac_ocr1
crw-r----- 1 root oinstall 90, 1 Apr 9 10:05 rrac_ocr
crw-rw---- 1 root system 90, 19 Apr 9 10:05 rrac_ocr1
[root@aix211 /]#chown oracle:dba /dev/*rac_ocr1
[root@aix211 /]#chmod 660 /dev/*rac_ocr1
[root@aix211 /]#ls -l /dev |grep ocr
brw-rw---- 1 oracle dba 90, 1 Apr 4 11:24 rac_ocr
brw-rw---- 1 oracle dba 90, 19 Apr 9 10:05 rac_ocr1
crw-r----- 1 root oinstall 90, 1 Apr 9 10:06 rrac_ocr
crw-rw---- 1 oracle dba 90, 19 Apr 9 10:05 rrac_ocr1
[root@aix211 /]#
建立OCR mirror:
[root@aix211 /]#ocrconfig -replace ocrmirror /dev/rrac_ocr1
[root@aix211 /]#ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 262056
Used space (kbytes) : 3248
Available space (kbytes) : 258808
ID : 128956142
Device/File Name : /dev/rrac_ocr
Device/File integrity check succeeded
Device/File Name : /dev/rrac_ocr1
Device/File integrity check succeeded
Cluster registry integrity check succeeded
3、vote disk 维护
查看vote disk 信息:
[root@aix212@ /]#crsctl query css votedisk
0. 0 /dev/rrac_vote
located 1 votedisk(s).
建立逻辑卷:(vote disk 访问遵循”多数可用原则“,建立vote disk冗余在3块以上的磁盘)
[root@aix212@ /]#lsvg -l dbvg
dbvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
rac_ocr raw 4 4 1 open/syncd N/A
rac_vote raw 4 4 1 open/syncd N/A
[root@aix211 /]#mklv -y 'rac_vote1' -t 'raw' dbvg 4
rac_vote1
[root@aix211 /]#mklv -y 'rac_vote2' -t 'raw' dbvg 4
rac_vote2
[root@aix211 /]#lsvg -l dbvg
dbvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
rac_ocr raw 4 4 1 open/syncd N/A
rac_vote raw 4 4 1 open/syncd N/A
......
rac_ocr1 raw 10 10 1 open/syncd N/A
rac_vote1 raw 4 4 1 closed/syncd N/A
rac_vote2 raw 4 4 1 closed/syncd N/A
[root@aix211 /]#
修改裸设备属性:
[root@aix211 /]#ls -l /dev |grep vote
brw-rw---- 1 oracle dba 90, 2 Apr 4 11:24 rac_vote
brw-rw---- 1 root system 90, 20 Apr 9 10:30 rac_vote1
brw-rw---- 1 root system 90, 21 Apr 9 10:30 rac_vote2
crw-r--r-- 1 oracle oinstall 90, 2 Apr 9 10:31 rrac_vote
crw-rw---- 1 root system 90, 20 Apr 9 10:29 rrac_vote1
crw-rw---- 1 root system 90, 21 Apr 9 10:30 rrac_vote2
[root@aix212@ /]#chmod 660 /dev/*rac_vote?
[root@aix212@ /]#chown oracle:dba /dev/*rac_vote?
[root@aix212@ /]#ls -l /dev/|grep vote
brw-rw---- 1 oracle dba 90, 2 Apr 4 11:23 rac_vote
brw-rw---- 1 oracle dba 90, 20 Apr 9 10:30 rac_vote1
brw-rw---- 1 oracle dba 90, 21 Apr 9 10:30 rac_vote2
crw-r--r-- 1 oracle oinstall 90, 2 Apr 9 10:33 rrac_vote
crw-rw---- 1 oracle dba 90, 20 Apr 9 10:30 rrac_vote1
crw-rw---- 1 oracle dba 90, 21 Apr 9 10:30 rrac_vote2
[root@aix212@ /]#
建立vote disk 冗余:
对于vote disk 建立冗余,必须要在所有node上关闭crs server!
[root@aix211 /]#crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
[root@aix211 /]#crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@aix211 /]#
[root@aix211 /]#crsctl add css votedisk /dev/rrac_vote1 -force
Now formatting voting disk: /dev/rrac_vote1
successful addition of votedisk /dev/rrac_vote1.
[root@aix211 /]#crsctl query css votedisk
0. 0 /dev/rrac_vote
1. 0 /dev/rrac_vote1
located 2 votedisk(s).
[root@aix211 /]#crsctl add css votedisk /dev/rrac_vote2 -force
Now formatting voting disk: /dev/rrac_vote2
successful addition of votedisk /dev/rrac_vote2.
查看vote disk 冗余信息:
[root@aix211 /]#crsctl query css votedisk
0. 0 /dev/rrac_vote
1. 0 /dev/rrac_vote1
2. 0 /dev/rrac_vote2
located 3 votedisk(s).
启动crs 服务(所有node):
[root@aix211 /]#crsctl start crs
[oracle@aix211 ~]$crsctl check crs
CSS appears healthy
CRS appears healthy
EVM appears healthy
对于vote disk的备份可以使用dd的命令:
dd if=/dev/rrac_vote of=/home/oracle/vote.bak bs=1024k