[grid@lzl1 ~]$ sqlplus / as sysasm
SQL*Plus: Release 11.2.0.3.0 Production on Fri Oct 20 15:20:44 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL>
现有磁盘
SQL> select name,free_mb,total_mb from v$asm_disk;
NAME FREE_MB TOTAL_MB
------------------------------ ---------- ----------
DATA_0002 44245120
DATA_0001 44245120
DATA_0000 44195120
CRS_0002 30895120
CRS_0001 30825120
CRS_0000 30895120
6 rows selected.
SQL> select group_number,operation,state,power from v$asm_operation;
no rows selected
删除磁盘
SQL> alter diskgroup DATA drop disk DATA_0002 rebalance power 5;
Diskgroup altered.
SQL> select group_number,operation,state,power from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER
------------ ----- ---- ----------
2 REBAL RUN5
正在进行rebalance操作
SQL> /
no rows selected
SQL> select name,free_mb,total_mb,path,state,mount_status,header_status from v$asm_disk;
SQL> col name for a10;
SQL> /
NAME FREE_MBTOTAL_MB PATHSTATE MOUNT_S HEADER_STATU
---------- ---------- ---------- --------------- -------- ------- ------------
0 0 /dev/asm-diskg NORMAL CLOSED FORMER
DATA_0001 4075 5120 /dev/asm-diskf NORMAL CACHED MEMBER
DATA_0000 4074 5120 /dev/asm-diske NORMAL CACHED MEMBER
CRS_0002 3089 5120 /dev/asm-diskd NORMAL CACHED MEMBER
CRS_0001 3082 5120 /dev/asm-diskc NORMAL CACHED MEMBER
CRS_0000 3089 5120 /dev/asm-diskb NORMAL CACHED MEMBER
6 rows selected.
磁盘已删除但仍然识别。
在drop之前DATA组的used mb=(5120-4424)+(5120-4424)+(5120-4419)= 2093
在drop之后DATA组的used mb=(5120-4075)+(5120-4074)= 2091
可以看出used mb几乎是相等的,rebalance把drop盘里的数据平衡分配到其他盘去了。
创建磁盘组
SQL> create diskgroup fra external redundancy disk '/dev/asm-diskg';
Diskgroup created.
SQL> select name,free_mb,total_mb,path,state,mount_status,header_status from v$asm_disk;
NAME FREE_MBTOTAL_MB PATHSTATE MOUNT_S HEADER_STATU
---------- ---------- ---------- --------------- -------- ------- ------------
FRA_0000 5070 5120 /dev/asm-diskg NORMAL CACHED MEMBER
DATA_0001 4075 5120 /dev/asm-diskf NORMAL CACHED MEMBER
DATA_0000 4074 5120 /dev/asm-diske NORMAL CACHED MEMBER
CRS_0002 3089 5120 /dev/asm-diskd NORMAL CACHED MEMBER
CRS_0001 3082 5120 /dev/asm-diskc NORMAL CACHED MEMBER
CRS_0000 3089 5120 /dev/asm-diskb NORMAL CACHED MEMBER
6 rows selected.
asm通过asm_diskstring识别磁盘
SQL> show parameter string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string/dev/asm*
我们新增一个磁盘来添加到FRA磁盘组中
[root@lzl1 Desktop]# ls /dev/asm-*
/dev/asm-diskb /dev/asm-diskd /dev/asm-diskf /dev/asm-diskh
/dev/asm-diskc /dev/asm-diske /dev/asm-diskg
共享设备已经配置好,/dev/asm-diskg就是我们新增的
SQL>select name,free_mb,total_mb,path,state,mount_status,header_status from v$asm_disk;
NAME FREE_MBTOTAL_MB PATHSTATE MOUNT_S HEADER_STATU
---------- ---------- ---------- --------------- -------- ------- ------------
0 0 /dev/asm-diskh NORMAL CLOSED CANDIDATE
FRA_0000 5070 5120 /dev/asm-diskg NORMAL CACHED MEMBER
DATA_0001 4075 5120 /dev/asm-diskf NORMAL CACHED MEMBER
DATA_0000 4074 5120 /dev/asm-diske NORMAL CACHED MEMBER
CRS_0002 3089 5120 /dev/asm-diskd NORMAL CACHED MEMBER
CRS_0001 3082 5120 /dev/asm-diskc NORMAL CACHED MEMBER
CRS_0000 3089 5120 /dev/asm-diskb NORMAL CACHED MEMBER
7 rows selected
已经自动识别了
在查询下另外一个视图
SQL> select name,free_mb,total_mb,path,state,mount_status,header_status from v$asm_disk_stat;
NAME FREE_MBTOTAL_MB PATHSTATE MOUNT_S HEADER_STATU
---------- ---------- ---------- --------------- -------- ------- ------------
FRA_0000 5070 5120 /dev/asm-diskg NORMAL CACHED MEMBER
DATA_0001 4075 5120 /dev/asm-diskf NORMAL CACHED MEMBER
DATA_0000 4074 5120 /dev/asm-diske NORMAL CACHED MEMBER
CRS_0002 3089 5120 /dev/asm-diskd NORMAL CACHED MEMBER
CRS_0001 3082 5120 /dev/asm-diskc NORMAL CACHED MEMBER
CRS_0000 3089 5120 /dev/asm-diskb NORMAL CACHED MEMBER
6 rows selected.
v$asm_disk_stat不会展示新增的磁盘
v$asm_disk_stat在官方文档中的描述
V$ASM_DISK_STAT displays performance statistics in the same way that V$ASM_DISK does, but without performing discovery of new disks. This results in a less expensive operation. However, since discovery is not performed, the output of this view does not include any data about disks that are new to the system.
The columns for V$ASM_DISK_STAT are the same as those for V$ASM_DISK.