ASM技术基础(3)

三、diskgroup管理

1、删除disk

SQL> select group_number, name from v$asm_diskgroup;

GROUP_NUMBER         NAME
---------------------------- ------------------
           1                         ASM_DISKGROUP

SQL> select path, name from v$asm_disk where group_number=1;
PATH                           NAME
------------------------------ ------------------------------
/dev/raw/raw5                  ASM_DISKGROUP_0004
/dev/raw/raw4                  ASM_DISKGROUP_0003
/dev/raw/raw3                  ASM_DISKGROUP_0002
/dev/raw/raw2                  ASM_DISKGROUP_0001
/dev/raw/raw1                  ASM_DISKGROUP_0000

SQL>alter diskgroup ASM_DISKGROUP drop disk asm_diskgroup_0004;
SQL>alter diskgroup ASM_DISKGROUP drop disk asm_diskgroup_0003;

2、创建新的diskgroup

SQL> select name, path, mode_status, state from v$asm_disk; 

NAME                           PATH                           MODE_ST STATE
------------------------------ ------------------------------ ------- --------
                                                          /dev/raw/raw6                  ONLINE  NORMAL
                                                          /dev/raw/raw5                  ONLINE  NORMAL
                                                           /dev/raw/raw4                  ONLINE  NORMAL
ASM_DISKGROUP_0002             /dev/raw/raw3                  ONLINE  NORMAL
ASM_DISKGROUP_0001             /dev/raw/raw2                  ONLINE  NORMAL
ASM_DISKGROUP_0000             /dev/raw/raw1                  ONLINE  NORMAL

SQL>create diskgroup dg1  external redundancy disk '/dev/raw/raw4';

SQL> select name, state, type, total_mb, free_mb from v$asm_diskgroup;

NAME                                STATE            TYPE       TOTAL_MB    FREE_MB
------------------------------ ----------- ------ ---------- ----------
ASM_DISKGROUP        MOUNTED     NORMAL      15072      14919
DG1                                  MOUNTED     EXTERN          5024       4974

SQL>drop diskgroup dg1;

SQL> create diskgroup dg1 normal redundancy
  2  failgroup f1 disk '/dev/raw/raw4'                        
  3  failgroup f2 disk '/dev/raw/raw5';

在创建diskgroup有三个选项:external, normal和high redunancy,具体在使用中,如果使用中高端存储设备,通常磁盘镜像在硬件级别就完成了,所以在创建diskgroup采用external,normal则至少需要两个磁盘,high则是三个磁盘,通常用于低端存储设备。

3、添加disk到现有的diskgroup

SQL>alter diskgroup ASM_DISKGROUP add disk
          '/dev/raw/raw6' name ASM_DISKGROUP_0003;

删除failure group 下的所有disk

SQL>alter diskgroup dg1 drop disks in failgroup f2;

检查disk状态,f2下的磁盘处于hung状态

SQL> select group_number,disk_number,name,failgroup,state from v$asm_disk;

4、重新设置disk大小

alter diskgroup asm_diskgroup resize disk ASM_DISKGROUP_0001 size 800m;

5、将diskgroup进行dismount和mount

SQL> select name, state from v$asm_diskgroup;
NAME                                         STATE
------------------------------------- ---------------
ASM_DISKGROUP                  MOUNTED
DG1                                            MOUNTED

SQL>alter diskgroup dg1 dismount;
SQL> alter diskgroup asm_diskgroup dismount;

SQL> select name, state from v$asm_diskgroup;
NAME                                         STATE
------------------------------------- ---------------
ASM_DISKGROUP                  DISMOUNTED
DG1                                            DISMOUNTED

SQL> alter diskgroup dg1 mount;
SQL>alter diskgroup  asm_diskgroup mount;

SQL> select name, state from v$asm_diskgroup;
NAME                                         STATE
------------------------------------- ---------------
ASM_DISKGROUP                  MOUNTED
DG1                                            MOUNTEDx`

6、冗余性考虑

我们在创建diskgroup没有指定failure group, failure group 自动在自己盘重建。但我们要注意指定failure group 时,每个failure group中的盘数量和大小要一致,避免空间浪费。
在ASM的diskgroup中,第一个被分配的file extents,作为primary extent,其他作为second extents,在10g中,缺省都是先读primary extents,但在11g,我们可以设置prefered read 特性,主要解决了RAC的两个节点中,节点1优先读取primary extent,节点2优先读取second extents,提高I/O性能

7、disk partnership
在normal和high redundancy diskgroup中,磁盘故障切换备用盘的信息可查询x$kfdpartner.

SQL> select name, disk_number
            from v$asm_disk
            where GROUP_NUMBER=2
            order by 2;

NAME                                         DISK_NUMBER
----------------------------------- -------------------------
ASM_DISKGROUP_0000                       0
ASM_DISKGROUP_0001                       1
ASM_DISKGROUP_0002                       2

SQL> select disk, NUMBER_KFDPARTNER from x$kfdpartner;

      DISK        NUMBER_KFDPARTNER
----------------- -----------------------------------
         0                 1
         0                 2
         1                 0
         1                 2
         2                 0
         2                 1

可以看到磁盘1的parner是磁盘2和磁盘3.

Trackback

no comment untill now

Add your comment now

切换到手机版