创建ASM磁盘组
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5008.htm
一、创建ASM磁盘组
SQL> show parameter asm_diskstring
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string /dev/asm*
SQL> col name for a40
SQL> col value for a15
SQL> select group_number,name,value from v$asm_attribute where name in ('au_size','compatible.asm','compatible.rdbms');
GROUP_NUMBER NAME VALUE
------------ ---------------------------------------- ---------------
1 au_size 4194304
1 compatible.asm 11.2.0.0.0
1 compatible.rdbms 10.1.0.0.0
SQL> set linesize 200 pagesize 200
SQL> col path for a20
SQL> col name for a15
SQL> col failgroup for a15
SQL> select group_number,disk_number,failgroup,name,path,state,mount_status,total_mb,free_mb,os_mb from v$asm_disk;
GROUP_NUMBER DISK_NUMBER FAILGROUP NAME PATH STATE MOUNT_S TOTAL_MB FREE_MB OS_MB
------------ ----------- --------------- --------------- -------------------- -------- ------- ---------- ---------- ----------
0 0 /dev/asm-diskg NORMAL CLOSED 0 0 10240
0 1 /dev/asm-diskh NORMAL CLOSED 0 0 10240
0 2 /dev/asm-diskf NORMAL CLOSED 0 0 4096
0 3 /dev/asm-diske NORMAL CLOSED 0 0 4096
1 2 OCRVOTING_0002 OCRVOTING_0002 /dev/asm-diskd NORMAL CACHED 1024 680 1024
1 1 OCRVOTING_0001 OCRVOTING_0001 /dev/asm-diskc NORMAL CACHED 1024 676 1024
1 0 OCRVOTING_0000 OCRVOTING_0000 /dev/asm-diskb NORMAL CACHED 1024 676 1024
7 rows selected.
SQL> create diskgroup FRA external redundancy
disk
'/dev/asm-diske' name FRA_0000,
'/dev/asm-diskf' name FRA_0001
attribute 'au_size'='4M',
'compatible.asm' = '11.2',
'compatible.rdbms' = '10.1';
Diskgroup created.
SQL> create diskgroup DATA external redundancy
disk
'/dev/asm-diskg' name DATA_0000,
'/dev/asm-diskh' name DATA_0001
attribute 'au_size'='4M',
'compatible.asm' = '11.2',
'compatible.rdbms' = '10.1';
Diskgroup created.
如果创建normal或high冗余磁盘组,则需要使用failgroup选项:
create diskgroup andy normal redundancy
failgroup fg1 disk
'/dev/asm-disko' name andy_fg1
failgroup fg2 disk
'/dev/asm-diskm' name andy_fg2
attribute 'au_size'='4M',
'compatible.asm' = '11.2',
'compatible.rdbms' = '11.1';
二、磁盘组参数
REDUNDANCY Clause
The REDUNDANCY
clause lets you specify the redundancy level of the disk group.
NORMAL
REDUNDANCY
requires the existence of at least two failure groups (see theFAILGROUP
clause that follows). Automatic Storage Management provides redundancy for all files in the disk group according to the attributes specified in the disk group templates.NORMAL
REDUNDANCY
disk groups can tolerate the loss of one group. Please refer toALTER
DISKGROUP
... diskgroup_template_clauses for more information on disk group templates.HIGH
REDUNDANCY
requires the existence of at least three failure groups. Automatic Storage Management fixes mirroring at 3-way mirroring, with each extent getting two mirrored copies.HIGH
REDUNDANCY
disk groups can tolerate the loss of two failure groups.EXTERNAL
REDUNDANCY
indicates that Automatic Storage Management does not provide any redundancy for the disk group. The disks within the disk group must provide redundancy (for example, using a storage array), or you must be willing to tolerate loss of the disk group if a disk fails (for example, in a test environment). You cannot specify theFAILGROUP
clause if you specifyEXTERNAL
REDUNDANCY
.
FAILGROUP Clause
Use this clause to specify a name for one or more failure groups. If you omit this clause, and you have specified NORMAL
or HIGH
REDUNDANCY
, then Oracle Database automatically adds each disk in the disk group to its own failure group. The implicit name of the failure group is the same as the operating system independent disk name (see "NAME Clause").
You cannot specify this clause if you are creating an EXTERNAL
REDUNDANCY
disk group.
关于asm_diskstring参数:
定义哪些磁盘可以被ASM使用。ASM实例启动之后,就根据这个参数扫描发现ASM磁盘,配置了这个参数以后,还必须要确认oracle用户对这些磁盘有操作权限。
- 如果使用的是裸设备,用逗号分隔每个设备名
asm_diskstring='/dev/raw/raw3','/dev/raw/raw7'
- 也可以使用通配符
asm_diskstring='/dev/raw/raw*'
- 使用ASMLib时,需要使用“ORCL:磁盘名”格式
asm_diskstring='ORCL:KEL1'
- 也可以使用通配符
asm_diskstring='ORCL:KEL*'