今天给虚拟机的asm加了一下磁盘,小记一下:
1 |
1.在vmware中选择其中一个节点的机器,Add Hardware-Hard disk-Create a new Virtual Disk-选择location,加3GB-File option中选allocation all disk space now,disk mode勾上Indepentent,且选persistent,Virtual device node选择和原来的asm disk一样的SCSI 1,device no为后一位,policy选optimize for performance。 |
1 |
2.启动一次后,关机,将该主机的vmx文件打开进行编辑,找到最下面的几行关于新加盘的,复制到其他节点的vmx文件中。 |
1 |
3.启动各个节点,在其中一个节点用fdisk -n-p-1-回车-回车-w新增分区 |
1 |
4.重启各个节点,看到/dev/sd*下已经有各个新建的分区,如/dev/sdf1 |
1 2 3 4 5 |
5.以使用asmlib为例,先在/etc/sysconfig/rawdevices中添加一行: /dev/raw/raw1 /dev/sdc1 /dev/raw/raw2 /dev/sdd1 /dev/raw/raw3 /dev/sde1 /dev/raw/raw4 /dev/sdf1 <----此行为新增加的 |
1 |
6.以root用户运行/sbin/service rawdevices restart 重启rawdevide服务 |
1 |
7.以oracle用户为新的磁盘新建link:ln -sf /dev/raw/raw4 /u01/oradata/devdb/asmdisk4 ,注,检查/etc/udev/permissions.d/50-udev.permissions中是否已经注释掉raw/*:root:disk:0660和存在raw/*:oracle:dba:0660,如果没有的话,重启后,/dev/raw/raw4会变成root属主。 |
1 2 3 4 |
8.以root创建asm盘: /etc/init.d/oracleasm createdisk VOL4 /dev/sdf1 /etc/init.d/oracleasm scandisks /etc/init.d/oracleasm liskdisks |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
9.运行下面语句是否能看到待加的asm disk: select state,header_status,substr(name,1,12) Name,free_mb, substr(path,1,16) PATH from v$asm_disk; 应该显示类似如下: select state,header_status,substr(name,1,12) Name,free_mb, substr(path,1,16) PATH from v$asm_disk; STATE HEADER_STATU NAME FREE_MB PATH -------- ------------ ------------ ---------- ---------------- NORMAL PROVISIONED 0 /dev/raw/raw4 NORMAL MEMBER VOL1 976 /dev/raw/raw1 NORMAL MEMBER VOL2 976 /dev/raw/raw2 NORMAL MEMBER VOL3 1559 /dev/raw/raw3 如果没有看到,检查asm_diskstring,看是否asm_diskstring设置了只搜索/dev/raw/raw1~/dev/raw/raw3 NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ asm_diskstring string SQL> 如果为空,则搜索所有raw下路径。 注:如果出现UNKNOWN如下的结果: NAME PATH HEADER_STATU ------------------------------ ---------------------------------- /dev/raw/raw4 PROVISIONED ORCL:VOL1 UNKNOWN ORCL:VOL2 UNKNOWN ORCL:VOL3 UNKNOWN ORCL:VOL4 UNKNOWN VOL1 /dev/raw/raw1 MEMBER VOL2 /dev/raw/raw2 MEMBER VOL3 /dev/raw/raw3 MEMBER 检查/etc/sysconfig/oracleasm中是否已经设置ORACLEASM_SCANEXCLUDE: # ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan ORACLEASM_SCANEXCLUDE="sd" |
1 2 3 |
10. 加disk: alter diskgroup <DG_NAME>add disk '<DISK_PATH>' name <DISK_NAME> rebalance power <number>; alter diskgroup dg1 add disk '/dev/raw/raw4' name VOL4 rebalance power 5; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
11. 检查rebalance情况: select * from v$asm_operation; GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- 1 REBAL RUN 5 5 22 1524 201 7 SQL> 看到还需要7分钟,我们调整rebalance级别,加快速度 SQL> alter diskgroup dg1 rebalance power 11; Diskgroup altered. SQL> select * from v$asm_operation; GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES ------------ ----- ---- ---------- ---------- ---------- ---------- ---------- ----------- 1 REBAL RUN 11 11 12 742 456 1 SQL> 现在只剩1分钟了。 等rebalance完,我们看看剩余的free的量: SQL> select state,header_status,substr(name,1,12) Name,free_mb, 2 substr(path,1,16) PATH from v$asm_disk; STATE HEADER_STATU NAME FREE_MB PATH -------- ------------ ------------ ---------- ---------------- NORMAL MEMBER VOL1 1618 /dev/raw/raw1 NORMAL MEMBER VOL2 1617 /dev/raw/raw2 NORMAL MEMBER VOL3 1559 /dev/raw/raw3 NORMAL MEMBER VOL4 1617 /dev/raw/raw4 SQL> 可以看到,等rebalance 完,free的量均衡。 |