此贴主要演示如何维护rac的Voting Disk,主要包括备份恢复等。注意:
在Oracle 11gR2中已经不支持使用dd命令来对voting disks 进行备份和恢复。因为11g使用asm了。
在Oracle 11gR2之前,我们可以直接直接使用dd命令对voting disk进行备份。
使用dd命令备份恢复裸设备示例:
备份votedisk盘:
[root@raw1 bin]# dd if=/dev/raw/raw2 of=/home/oracle/voting_disk.bak
恢复votedisk盘:
[root@raw1 bin]# dd if=/home/oracle/voting_disk.bak of=/dev/raw/raw2
ocr和voting disk 同时挂了,先恢复ocr,再恢复voting disk。
11g存储在Oracle ASM中Voting files的数量由磁盘组的冗余级别决定:
(1)External redundancy: 该磁盘组只能存储一个voting disk。
(2)Normal redundancy: 该磁盘组会存储3个voting disk。
(3)High redundancy: 该磁盘组会存储5个voting disks。
10g放在裸设备上的votingdisk最多5个,ocr最多2份。
1.查看voting disk信息:
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 0af360f44f454ff0bf2021cddafa3275 (/dev/asm-diskl) [DATA]
Located 1 voting disk(s).
2.备份voting disk:
在Oracle 11gR2中,不在需要备份Voting Disk。 Voting disk的信息有任何改变时,会自动备份到OCR中,当添加voting disk时,
也会从自动从备份中进行restore。如果所有的VOTING DISK 都损坏,也可以通过备份进行还原。
3.如何还原voting disk(可在线操作):
a.如果需要,先恢复OCR,这一步仅当OCR 也损坏的情况,否则不需要。比如OCR和Voitng disk都存放在一个diskgroup中。
OCR的恢复参考OCR管理。
b.root用户-excl模式启动crs:
crsctl start crs -excl
c.检查当前定义的voting disk
crsctl query css votedisk
如果所有的voting disks都已经损坏,该命令就会返回空,也可能state被标记3或OFF。
d.还原voting disk
crsctl replace votedisk +BACKUPDG
示例:
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 0af360f44f454ff0bf2021cddafa3275 (/dev/asm-diskl) [DATA]
Located 1 voting disk(s).
[root@maclean1 ~]# crsctl replace votedisk +BACKUPDG
Successful addition of voting disk 3672fe4906564f13bf1733b513b8d082.
Successful deletion of voting disk 0af360f44f454ff0bf2021cddafa3275.
Successfully replaced voting disk group with +BACKUPDG.
CRS-4266: Voting file(s) successfully replaced
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 3672fe4906564f13bf1733b513b8d082 (/dev/asm-diskt) [BACKUPDG]
Located 1 voting disk(s).
[root@maclean1 ~]#
利用以上方法也可以将voting disk迁移到其他集群文件系统中:
示例:
[root@maclean1 ~]# crsctl replace votedisk /dev/asm-diskn
Now formatting voting disk: /dev/asm-diskn.
CRS-4256: Updating the profile
Successful addition of voting disk 844443087bd34fd7bf87c2606621375b.
Successful deletion of voting disk 3672fe4906564f13bf1733b513b8d082.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 844443087bd34fd7bf87c2606621375b (/dev/asm-diskn) []
Located 1 voting disk(s).
[root@maclean1 ~]#
4.添加voting disk:
crsctl add css votedisk path_to_voting_disk
示例:
[root@maclean1 ~]# crsctl add css votedisk /dev/asm-diskj
Now formatting voting disk: /dev/asm-diskj.
CRS-4603: Successful addition of voting disk /dev/asm-diskj.
[root@maclean1 ~]#
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 844443087bd34fd7bf87c2606621375b (/dev/asm-diskn) []
2. ONLINE 595eed878d814fe0bfa786947b4f24f3 (/dev/asm-diskj) []
Located 2 voting disk(s).
注意:不能直接往asm磁盘组中添加voting disk,oracle不支持:
[root@maclean1 ~]# crsctl add css votedisk +BACKUPDG
CRS-4671: This command is not supported for ASM diskgroups.
CRS-4000: Command Add failed, or completed with errors.
但可以将其他集群文件系统上的voting disk间接的replace到asm磁盘组上:
[root@maclean1 ~]# crsctl replace votedisk +DATA
CRS-4256: Updating the profile
Successful addition of voting disk 8e23c0e6772a4f96bfbe821092290aaf.
Successful deletion of voting disk 844443087bd34fd7bf87c2606621375b.
Successful deletion of voting disk 595eed878d814fe0bfa786947b4f24f3.
Successfully replaced voting disk group with +DATA.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 8e23c0e6772a4f96bfbe821092290aaf (/dev/asm-diskl) [DATA]
Located 1 voting disk(s).
[root@maclean1 ~]#
在磁盘组中加几份voting disk根据磁盘的冗余类型决定。如上+DATA是外部冗余只加了一份。
如果voting disk存放在asm磁盘组中,则无法添加voting disk到其他集群文件系统中:
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 8e23c0e6772a4f96bfbe821092290aaf (/dev/asm-diskl) [DATA]
Located 1 voting disk(s).
[root@maclean1 ~]# crsctl add css votedisk /dev/asm-disko
CRS-4258: Addition and deletion of voting files are not allowed because the voting files are on ASM
将voting disk替换到共享文件设备上后就可以添加了:
[root@maclean1 ~]# crsctl replace votedisk /dev/asm-diskj
Now formatting voting disk: /dev/asm-diskj.
CRS-4256: Updating the profile
Successful addition of voting disk 370b18f0922f4fd0bfae6b7a21e4bcb5.
Successful deletion of voting disk 8e23c0e6772a4f96bfbe821092290aaf.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 370b18f0922f4fd0bfae6b7a21e4bcb5 (/dev/asm-diskj) []
Located 1 voting disk(s).
[root@maclean1 ~]# crsctl add css votedisk /dev/asm-disko
Now formatting voting disk: /dev/asm-disko.
Failed to initialize voting file /dev/asm-disko.
Change to configuration failed, but was successfully rolled back.
CRS-4000: Command Add failed, or completed with errors.
[root@maclean1 ~]# crsctl add css votedisk /dev/asm-diskq
Now formatting voting disk: /dev/asm-diskq.
clsscfgVFFormatted: corrupt volume info block(3)
CRS-4603: Successful addition of voting disk /dev/asm-diskq.
[root@maclean1 ~]# crsctl query css votedisk
## STATE File Universal Id File Name Disk group
-- ----- ----------------- --------- ---------
1. ONLINE 370b18f0922f4fd0bfae6b7a21e4bcb5 (/dev/asm-diskj) []
2. ONLINE 51b9e3e6be254ff3bf889335d9e88175 (/dev/asm-diskq) []
Located 2 voting disk(s).
处于former格式盘(从asm磁盘drop的盘)也无法添加voting disk:
SQL> select group_number,disk_number,mount_status,header_status,state,redundancy,name,path,total_mb,free_mb from v$asm_disk;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE REDUNDA NAME PATH TOTAL_MB FREE_MB
------------ ----------- ------- ------------ -------- ------- --------------- --------------- ---------- ----------
0 0 CLOSED FORMER NORMAL UNKNOWN /dev/asm-disko 0 0
0 4 CLOSED FOREIGN NORMAL UNKNOWN /dev/asm-diskq 0 0
0 8 CLOSED FOREIGN NORMAL UNKNOWN /dev/asm-diskn 0 0
0 11 CLOSED FOREIGN NORMAL UNKNOWN /dev/asm-diskj 0 0
1 2 CACHED MEMBER NORMAL UNKNOWN BACKUPDG_0002 /dev/asm-diskv 1024 499
3 2 CACHED MEMBER NORMAL UNKNOWN SYSTEMDG_0002 /dev/asm-disku 1024 660
3 1 CACHED MEMBER NORMAL UNKNOWN SYSTEMDG_0001 /dev/asm-disks 1024 660
1 1 CACHED MEMBER NORMAL UNKNOWN BACKUPDG_0001 /dev/asm-diskt 1024 500
2 2 CACHED MEMBER NORMAL UNKNOWN DATA_0002 /dev/asm-diskr 1024 219
2 3 CACHED MEMBER NORMAL UNKNOWN DATA_0003 /dev/asm-diskp 1024 217
3 3 CACHED MEMBER NORMAL UNKNOWN SYSTEMDG_0003 /dev/asm-diskm 1024 660
2 0 CACHED MEMBER NORMAL UNKNOWN DATA_0000 /dev/asm-diskl 1024 217
[root@maclean1 ~]# crsctl add css votedisk /dev/asm-disko
Now formatting voting disk: /dev/asm-disko.
Failed to initialize voting file /dev/asm-disko.
Change to configuration failed, but was successfully rolled back.
CRS-4000: Command Add failed, or completed with errors.
添加过voting disk(处于FOREIGN状态)的盘也无法加入到asm磁盘组:
SQL> show parameter power
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_power_limit integer 1024
SQL> alter diskgroup data add disk '/dev/asm-diskn';
alter diskgroup data add disk '/dev/asm-diskn'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15201: disk /dev/asm-diskn contains a valid RDBMS file
如果cluster 已经down,并且因为丢失voting disk而不能启动,那么必须用root用户执行如下命令将CSS 启动到exclusive 模式:
# crsctl start crs -excl
启动到exclusive 模式之后,就可以替换voting disk了:
# crsctl replace votedisk path_to_voting_disk
总结:
1.voting disk如果放在asm磁盘组里面,会自动备份(会备份到OCR中),且维护数量依赖于asm磁盘的冗余级别。因此无法手动add或者delete voting disk。
2.可以在asm磁盘组和共享文件系统(包括裸设备)之间replace voting disk。
3.voting disk如果存放在共享文件系统(包括裸设备)或者被replace到共享文件系统(包括裸设备)之后可以进行add和delete操作。
4.由于voting disk会自动备份到OCR中,因此当OCR和voting disk同时坏掉,要先恢复OCR(restore),再恢复(replace)voting disk。
该贴由system转至本版2014-11-19 9:34:59