3. 安装ASM组件
# 查看内核版本
[root@OL54.cuug.net:/root]$ uname -rm
2.6.18-164.el5 i686
# 下载并安装需要的asm安装包(注意一定要与上面查到的内核版本保持一致)
# 这里是下载最后一个
# 相关的软件包,已经在给大家的软件中提供。
# 使用SecureFX以root用户连接到虚拟机,将相关软件上传到/root目录中
[root@OL54.cuug.net:/root]$ ls
Oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm oracleasmlib-2.0.4-1.el5.i386.rpm oracleasm-support-2.1.8-1.el5.i386.rpm
[root@OL54.cuug.net:/root]$ rpm -Uvh oracleasm-support-2.1.8-1.el5.i386.rpm
warning: oracleasm-support-2.1.8-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@OL54.cuug.net:/root]$ rpm -Uvh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
warning: oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-2.6.18-164.el########################################### [100%]
[root@OL54.cuug.net:/root]$ rpm -Uvh oracleasmlib-2.0.4-1.el5.i386.rpm
warning: oracleasmlib-2.0.4-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
# 查看磁盘和分区情况
[root@OL54.cuug.net:/root]$ cat /proc/partitions
major minor #blocks name
8 0 41943040 sda
8 1 36700461 sda1
8 2 5237190 sda2
8 16 5242880 sdb
8 32 5242880 sdc
8 48 5242880 sdd
8 64 5242880 sde
# 对要使用的磁盘进行分区,这里是sdb, sdc, sdd, sde
[root@OL54.cuug.net:/root]$ fdisk /dev/sdb
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): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
Using default value 652
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# 对sdc, sdd, sde执行类似的操作
# 查看最终的结果
[root@OL54.cuug.net:/root]$ cat /proc/partitions
major minor #blocks name
8 0 41943040 sda
8 1 36700461 sda1
8 2 5237190 sda2
8 16 5242880 sdb
8 17 5237158 sdb1
8 32 5242880 sdc
8 33 5237158 sdc1
8 48 5242880 sdd
8 49 5237158 sdd1
8 64 5242880 sde
8 65 5237158 sde1
# 创建ASM磁盘
# 对oracleasm进行配置
[root@OL54.cuug.net:/root]$ oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
# 初始化asmlib
[root@OL54.cuug.net:/root]$ oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
# 使用oracleasm createdisk <diskname> <device_name> 命令为每个磁盘创建ASM磁盘label
[root@OL54.cuug.net:/root]$ oracleasm createdisk DATA1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@OL54.cuug.net:/root]$ oracleasm createdisk DATA2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@OL54.cuug.net:/root]$ oracleasm createdisk DATA3 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@OL54.cuug.net:/root]$ oracleasm createdisk DATA4 /dev/sde1
Writing disk header: done
Instantiating disk: done
# 查看创建结果
[root@OL54.cuug.net:/root]$ oracleasm listdisks
DATA1
DATA2
DATA3
DATA4
# 检查磁盘是否已经挂载到oracleasm文件系统
[root@OL54.cuug.net:/root]$ ls -l /dev/oracleasm/disks
total 0
brw-rw---- 1 oracle dba 8, 17 May 4 21:59 DATA1
brw-rw---- 1 oracle dba 8, 33 May 4 21:59 DATA2
brw-rw---- 1 oracle dba 8, 49 May 4 21:59 DATA3
brw-rw---- 1 oracle dba 8, 65 May 4 21:59 DATA4