本节介绍如何创建ASM磁盘组。
[root@rac1 ~]# su - Oracle
[oracle@rac1 ~]$ export ORACLE_SID=+ASM
[oracle@rac1 ~]$ sqlplus /nolog
SQL> conn / as sysdba
SQL> startup
ASM instance started
ORA-15110: no diskgroups mounted
SQL> create diskgroup DG1 normal redundancy
2 failgroup FG1 disk '/dev/oracleasm/disks/VOL1' name VOL1
3 failgroup FG2 disk '/dev/oracleasm/disks/VOL2' name VOL2;
create diskgroup DG1 normal redundancy
*
ERROR at line 1:
ORA-15018: diskgroup cannot be created --下面提示磁盘路径未在discovery set中设置
ORA-15031: disk specification '/dev/oracleasm/disks/VOL2' matches no disks
ORA-15014: location '/dev/oracleasm/disks/VOL2' is not in the discovery set
ORA-15031: disk specification '/dev/oracleasm/disks/VOL1' matches no disks
ORA-15014: location '/dev/oracleasm/disks/VOL1' is not in the discovery set
SQL> show parameter asm_diskstring
NAME TYPE VALUE
---------------- ----------- ------------------------------
asm_diskstring string
SQL> alter system set asm_diskstring='/dev/oracleasm/disks/VOL*';
SQL> create diskgroup DG1 normal redundancy --设置asm_diskstring后重新创建磁盘DG1成功
2 failgroup FG1 disk '/dev/oracleasm/disks/VOL1' name VOL1
3 failgroup FG2 disk '/dev/oracleasm/disks/VOL2' name VOL2;
SQL> select name,state,free_mb,required_mirror_free_mb,usable_file_mb
2 from v$asm_diskgroup;
NAME STATE FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB
------- ----------- ---------- ----- -------------
DG1 MOUNTED 2964 0 1482