[grid@test ~]$ sqlplus "/as sysasm"
SQL*Plus: Release 11.2.0.2.0 Production on Mon Nov 22 11:30:43 2010
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Automatic Storage Management optionSQL> select name,state from v$asm_diskgroup;
NAME
------------------------------------------------------------
STATE
----------------------
DATA
MOUNTED
1、添加磁盘组:
相信很多人都会使用dbca创建磁盘组了,这里介绍使用SQL*PLUS创建磁盘组。主要是使用CREATE DISKGROUP语句,该语句的语法如下:
CREATE DISKGROUP diskgroup_name
[ { HIGH | NORMAL | EXTERNAL } REDUNDANCY ]
[ FAILGROUP failgroup_name ]
DISK [ NAME disk_name ] [ SIZE size_clause ] [ FORCE | NOFORCE ] ...;
选项描述:
首先要指定的就是磁盘组名称(diskgroup_name);指定冗余度,有三个选择:HIGH(高度冗余>三路)、NORMAL(标准冗余--双路)和EXTERNAL(外部存储冗余);选择是否指定FAILGROUP(如果选择非external则必须指定);指定该磁盘组中的成员(对应的LUN),在指定成员时一般ASM能够自动检测出磁盘的容量,不过如果DBA基于某些方面的考虑,希望限制ASM使用的空间的话,也可以在指定成员过程中,顺便指定大小(只要指定的大小不超出磁盘实际容量),在添加成员时,ASM也会自动检查磁盘头以确定该磁盘是否被加入到其它的磁盘组中,当发现该盘已加入其它磁盘组的话,你可以通过FORCE选项来强制修改该盘所属磁盘组。2.添加磁盘:
[root@test ~]# fdisk -l
Disk /dev/sda: 193.2 GB, 193273528320 bytes
255 heads, 63 sectors/track, 23497 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 17233 138319650 83 Linux
/dev/sda3 17234 18277 8385930 82 Linux swap / Solaris
/dev/sda4 18278 23497 41929650 5 Extended
/dev/sda5 18278 19321 8385898+ 83 Linux
/dev/sda6 19322 20365 8385898+ 83 Linux
/dev/sda7 20366 21409 8385898+ 83 Linux
/dev/sda8 21410 22453 8385898+ 83 Linux
/dev/sda9 22454 23497 8385898+ 83 Linux
Disk /dev/sdb: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 6527 52428096 83 Linux
/dev/sdb2 6528 13054 52428127+ 83 Linux
Disk /dev/sdc: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 6527 52428096 83 Linux
/dev/sdc2 6528 13054 52428127+ 83 Linux
初始化SDC磁盘:
[root@test ~]# /etc/init.d/oracleasm createdisk VOL_C /dev/sdc1
Marking disk "VOL_C" as an ASM disk: [ OK ]
[root@test ~]# /etc/init.d/oracleasm createdisk VOL_D /dev/sdc2
Marking disk "VOL_D" as an ASM disk: [ OK ]
[root@test ~]# /etc/init.d/oracleasm
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[root@test ~]# /etc/init.d/oracleasm listdisks
VOL_A
VOL_B
VOL_C
VOL_D
[root@test ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
使用OEM添加磁盘:
-》磁盘组 -》DATA磁盘组 -》添加
-》
就可以了。
下面演示使用命令添加:
[root@test ~]# /etc/init.d/oracleasm createdisk VOL_E /dev/sdd1
Marking disk "VOL_E" as an ASM disk: [ OK ]
[root@test ~]# /etc/init.d/oracleasm createdisk VOL_F /dev/sdd2
Marking disk "VOL_F" as an ASM disk: [ OK ]
SQL> ALTER DISKGROUP DATA add disk 'ORCL:VOL_E' rebalance power 5 ;
Diskgroup altered.
SQL> ALTER DISKGROUP DATA add disk 'ORCL:VOL_F' rebalance power 5 ;
Diskgroup altered.
SQL> col disk format a15
SQL> col path format a15
SQL> select name disk,path from v$asm_disk_stat;
DISK PATH
--------------- ---------------
VOL_A ORCL:VOL_A
VOL_B ORCL:VOL_B
VOL_C ORCL:VOL_C
VOL_D ORCL:VOL_D
VOL_E ORCL:VOL_E
VOL_F ORCL:VOL_F
注意:rebalance power 5 中后面跟的数字范围是1到11.rebalance power 意思是指加入磁盘后,自动重组的比值,数字越大,重组速度越快,但是会影响在线数据库运行。默认是1.