1. 在磁盘上建立分区
[root@node1 ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdf: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@node1 ~]# fdisk /dev/sdf
Command (m for help): p
Disk /dev/sdf: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf1 1 130 1044193+ 83 Linux
Command (m for help): q
2、使用oracleasm标识磁盘
[root@node1 ~]# /etc/init.d/oracleasm deletedisk VOL6
Removing ASM disk "VOL6": [ OK ]
[root@node1 ~]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdf1
Marking disk "VOL3" as an ASM disk: [ OK ]
[root@node1 ~]# ls -la /dev/oracleasm/disks
total 0
drwxr-xr-x 1 root root 0 Mar 19 13:04 .
drwxr-xr-x 2 root root 0 Mar 19 12:56 ..
brw-rw---- 1 oracle dba 8, 81 Mar 19 13:04 VOL3
3、验证标识结果
[root@node1 ~]# /etc/init.d/oracleasm querydisk VOL3
Disk "VOL3" is a valid ASM disk
[root@node1 ~]# /etc/init.d/oracleasm listdisks
VOL3
[root@node1 ~]#
4.在其他节点上验证结果
[root@node2 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@node2 ~]# /etc/init.d/oracleasm listdisks
VOL3
5.在Oracle中添加磁盘到DATA磁盘组
[oracle@node1 ~]$ export ORACLE_SID=+ASM1
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 19 13:13:00 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL> select path from v$asm_disk;
PATH
--------------------------------------------------------------------------------
/dev/raw/raw2
ORCL:VOL3
/dev/raw/raw1
/dev/raw/raw4
/dev/raw/raw3
SQL> alter diskgroup RAC_DISK add disk 'ORCL:VOL3' name test_asm;
Diskgroup altered.