asm添加删除磁盘

一、 ASM_POWER_LIMIT 参数

 这个参数 ASM_POWER_LIMIT 参数控制 ASM 后台进程 ARBx 的数量。ARBx 进程用来进行 ASM 磁盘数据重新分布打散。ASM_POWER_LIMIT 取值 从 0 到 11(据说从 10gR2 开始可以设置为 0 ). 当新添加磁盘或者删除磁盘后,ASM 会启动 ARBx 进行 IO 分散操作,该参数值越大,io 越大。这是个非常消耗资源的动作,所以一定要选择系统空闲的时候进行。

ASM_POWER_LIMIT 参数官方描述:

ASM_POWER_LIMIT specifies the maximum power on an Automatic Storage Management instance for disk rebalancing. The higher the limit, the faster rebalancing will complete. Lower values will take longer, but consume fewer processing and I/O resources.

If the POWER clause of a rebalance operation is not specified, then the default power will be the value of ASM_POWER_LIMIT.

根据 逻辑 cpu个数 与 负载情况 ,确定 asm_power_limit 参数。
1.1 查看逻辑cpu个数
$ cat /proc/cpuinfo |grep "processor"|wc -l
48

1.2 grid用户登录,设置 asm_power_limit 参数
$ sqlplus / as sysasm
SQL> show parameter asm_power_limit

NAME TYPE VALUE
------------------------------------ --------------- ------------------------------
asm_power_limit integer 1

1.3 修改 asm_power_limit 参数
SQL> alter system set asm_power_limit=20 sid= '*' scope=both;

1.4 添加或者删除asm磁盘

1.5 还原 asm_power_limit 默认值
SQL> alter system set asm_power_limit=1 sid= '*' scope=both;

二、 添加磁盘组磁盘成员 (最好保证添加的磁盘成员size大小与该磁盘组其他成员size大小一致,否则浪费最大可用空间)

1.grid用户进入asm环境

node1-> sqlplus / as sysasm

2.查看当前环境的信息
SQL>
col name for a35;
select a.group_number,b.name,a.path from v$asm_disk a,v$asm_diskgroup b where a.group_number=b.group_number;


3.增加一个asm磁盘 ,之后磁盘做 rebalance 操作

SQL> ALTER DISKGROUP DATA ADD DISK '/dev/asm-data02';

Diskgroup altered.

-- 如果查询出来有结果,说明磁盘数据迁移没有结束。如果查询出来结束输出为 no rows selected ,说明磁盘数据迁移已经结束。
SQL> select OPERATION,POWER,EST_RATE,EST_MINUTES,STATE from v$asm_operation;

GROUP_NUMBER OPERATION STATE POWER ACTUAL SOFAR
------------ --------------- ------------ ---------- ---------- ----------
EST_WORK EST_RATE EST_MINUTES
---------- ---------- -----------
ERROR_CODE
--------------------------------------------------------------------------------
3 REBAL RUN 1 1 195
300 782 0

4. 查询磁盘情况
SQL>
col name for a40;
select group_number, name, TOTAL_MB, FREE_MB from V$asm_disk_stat;

GROUP_NUMBER NAME TOTAL_MB FREE_MB
------------ ---------------------------------------- ---------- ----------
3 DATA_0000 43008 40913
2 FLASH_0000 15360 14211
1 GRIDDG_0000 1024 830
1 GRIDDG_0001 1024 863
3 DATA_0001 6144 5842

SQL> select OPERATION,POWER,EST_RATE,EST_MINUTES,STATE from v$asm_operation;

no rows selected > 磁盘 rebalance 操作结束


三、 删除磁盘组磁盘成员

3.0 查询磁盘信息,保留盘符path路径 ( 删除磁盘组的一个磁盘成员,但必须确保删除该磁盘成员之后,该磁盘组的其他成员有足够空间做 rebalance )

SQL>
col path for a30;
select group_number,disk_number,path from v$asm_disk order by group_number,disk_number;
GROUP_NUMBER DISK_NUMBER PATH
------------ ----------- ------------------------------
1 0 /dev/asm-ocr
1 1 /dev/asm-vd
2 0 /dev/asm-date
2 1 /dev/asm-date02
3 0 /dev/asm-flash

SQL> col name for a40
SQL> select group_number, name, TOTAL_MB, FREE_MB from V$asm_disk_stat;

GROUP_NUMBER NAME TOTAL_MB FREE_MB
------------ ---------------------------------------- ---------- ----------
3 DATA_0000 43008 40913
2 FLASH_0000 15360 14211
1 GRIDDG_0000 1024 830
1 GRIDDG_0001 1024 863
3 DATA_0001 6144 5842

3.1 开始删除磁盘 DATA_0001 , 磁盘做 rebalance 操作
SQL> alter diskgroup DATA drop disk DATA_0001;

Diskgroup altered.

3.2 查看磁盘情况
SQL>
col name for a45;
select group_number, name, TOTAL_MB, FREE_MB from V$asm_disk_stat;

GROUP_NUMBER NAME TOTAL_MB FREE_MB
------------ --------------------------------------------- ---------- ----------
3 DATA_0000 43008 40613
2 FLASH_0000 15360 14211
1 GRIDDG_0000 1024 830
1 GRIDDG_0001 1024 863

说明: 一旦重新调整删除了所有的分配单元,那么这个磁盘就从这个磁盘组中删除了。

3.3 查看磁盘 rebalance 操作是否结束,如果查询输出结果为 no rows selected ,表示已经 rebalance 结束。
SQL> select OPERATION,POWER,EST_RATE,EST_MINUTES,STATE from v$asm_operation;
no rows selected
SQL>
col state for a10;
col path for a20;
SQL> select path,group_number, disk_number,mount_status,state from v$asm_disk;

PATH GROUP_NUMBER DISK_NUMBER MOUNT_STATUS STATE
-------------------- ------------ ----------- --------------------- ----------
/dev/asm-data02 0 0 CLOSED NORMAL
/dev/asm-date 3 0 CACHED NORMAL
/dev/asm-flash 2 0 CACHED NORMAL
/dev/asm-ocr 1 0 CACHED NORMAL
/dev/asm-vd 1 1 CACHED NORMAL

说明:踢出磁盘后的成员, GROUP_NUMBER,DISK_NUMBER 显示为 0 , 0


补充:磁盘处理方案
SQL>
col name for a20;
select group_number,disk_number,name,TOTAL_MB,FREE_MB,TOTAL_MB-FREE_MB used_size from V$asm_disk_stat order by group_number,disk_number;

GROUP_NUMBER NAME TOTAL_MB FREE_MB USED_SIZE
------------ -------------------- ---------- ---------- ----------
1 OCRVOTDG_0001 4096 3914 182
1 OCRVOTDG_0000 4096 3880 216
2 DATADG01_0004 284672 188576 96096
2 DATADG01_0000 284672 188648 96024
2 DATADG01_0005 284672 188632 96040
2 DATADG01_0006 284672 188616 96056
2 DATADG01_0007 284672 188664 96008
2 DATADG01_0001 284672 188584 96088
2 DATADG01_0002 284672 188560 96112
2 DATADG01_0003 284672 188584 96088
3 DATADG02_0004 284672 200504 84168

GROUP_NUMBER NAME TOTAL_MB FREE_MB USED_SIZE
------------ -------------------- ---------- ---------- ----------
3 DATADG02_0003 284672 200424 84248
3 DATADG02_0002 284672 200440 84232
3 DATADG02_0001 284672 200480 84192
3 DATADG02_0000 284672 200472 84200
3 DATADG02_0007 284672 200496 84176
3 DATADG02_0005 284672 200432 84240
3 DATADG02_0006 284672 200424 84248
4 DATADG03_0002 284672 273664 11008
4 DATADG03_0000 284672 273664 11008
4 DATADG03_0001 284672 273656 11016
5 ARCHDG_0000 284672 82672 202000

22 rows selected.

SQL> select sum(total_mb-free_mb) T_size from v$asm_disk;

T_SIZE
----------
1677646

SQL> select sum(total_mb) T_size from v$asm_disk;

T_SIZE
----------
5701632

SQL> select sum(free_mb) T_size from v$asm_disk;

T_SIZE
----------
4023986

磁盘处理情况说明:
SQL> select group_number,sum(total_mb) total_M,sum(total_mb-free_mb) used_size_M ,sum(free_mb) free_M from v$asm_disk group by group_number order by group_number ;

GROUP_NUMBER TOTAL_M USED_SIZE_M FREE_M
------------ ---------- ----------- ----------
1 8192 398 7794 (不动)
2 2277376 768512 1508864
3 2277376 673704 1603672
4 854016 33032 820984
5 284672 202000 82672 (不动)

SQL> select sum(total_mb) total_M,sum(total_mb-free_mb) used_size_M ,sum(free_mb) free_M from v$asm_disk where group_number in (2,3,4);

TOTAL_M USED_SIZE_M FREE_M
---------- ----------- ----------
5408768 1475248 3933520


计划方案:已经使用 1677646 M ,存留 2.7 T=2831155 M , 踢出 2870477 M


5701632 - 2831155 = 2870477 M

2870477/284672 = 10.0834539


实际实施:
group 2 踢出4块磁盘,DATADG01_0007~DATADG01_0004 。
group 3 踢出4块磁盘,DATADG02_0007~DATADG02_0004。
group 4 踢出2块磁盘,DATADG03_0002,DATADG03_0001 。

实际踢出空间:284672*10=2846720/1024/1024= 2.71484375 T
实际存留空间:5408768-2846720=2562048/1024/1024= 2.44335938 T


实施后存储情况:
GROUP_NUMBER TOTAL_M USED_SIZE_M FREE_M
------------ ---------- ----------- ----------
1 8192 398 7794
2 1138688 768512 370176
3 1138688 673704 464984
4 284672 33032 251640
5 284672 202000 82672

 

posted on 2017-08-01 21:47  张冲andy  阅读(1197)  评论(0编辑  收藏  举报

导航