Oracle asmlib 是Oracle 公司在linux 平台上提供的一种取代raw devices 的系统程序包。它的安装和配置很简单,可以去参考我写的http://mikixiyou.iteye.com/blog/1513773 一文。
本文描述了在oracel asmlib 使用过程中出现的一个小问题。
在asmlib 软件包安装完成后,使用oracleasm configure 完成配置操作。
正常情况下,执行过程应该是如下所示:
[root@db2 ~]# oracleasm configure
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) [y]:
Fix permissions of Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: [ OK ]
Scanning system for ASM disks: [ OK ]
这个脚本执行完成了四大任务。
1 、创建了配置文件/etc/sysconfig/oracleasm
2 、创建了挂载点/dev/oracleasm
3 、加载oracleasm 内核模块
4 、挂载ASM 函数驱动文件系统
(miki西游 @mikixiyou 文档,原文链接: http://mikixiyou.iteye.com/blog/1559584 )
但是,现在执行结果却是这样,如下:
[root@oracle16 ~]# oracleasm configure
ORACLEASM_ENABLED=false
ORACLEASM_UID=
ORACLEASM_GID=
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
没有出现任何配置过程的参数项。从结果看,像是oracleasm 已经配置过了,只是设置成不使用状态了。
我们先分析一下这个应用程序oracleasm 。
[root@oracle16 ~]# which oracleasm
/usr/sbin/oracleasm
[root@oracle16 ~]# oracleasm configure -h
Usage: oracleasm-configure [-l <manager>] [-i|-I] [-e|-d] [-u <user>] [-g <group>] [-s y|n]
[[-o <order>] ...] [[-x <exclude>] ...]
此应用程序提供的帮助文字很差,信息不全面。我是查了资料之后才知道使用-i 参数可以重新配置
oracleasm 。
[root@oracle16 ~]# 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]:
Writing Oracle ASM library driver configuration: done
[root@oracle16 ~]# oracleasm configure
ORACLEASM_ENABLED=true
ORACLEASM_UID=oracle
ORACLEASM_GID=dba
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
[root@oracle16 ~]#
配置完成后,就可以使用oracleasm createdisk 创建磁盘了。
[root@oracle16 ~]# fdisk -l
Disk /dev/sda: 598.8 GB, 598879502336 bytes
255 heads, 63 sectors/track, 72809 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 6387 51199155 82 Linux swap / Solaris
/dev/sda3 6388 11486 40957717+ 83 Linux
/dev/sda4 11487 72800 492504705 83 Linux
[root@oracle16 ~]# oracleasm createdisk vol1 /dev/sda4
Writing disk header: done
Instantiating disk: done
创建成功,以下是检查部分。
[root@oracle16 ~]# oracleasm listdisks
VOL1
[root@oracle16 ~]# oracleasm querydisk
Usage: oracleasm-querydisk [-l <manager>] [-v] [-d|-p] <label>|<device> ...
[root@oracle16 ~]# oracleasm querydisk vol1
Disk "VOL1" is a valid ASM disk
[root@oracle16 ~]# oracleasm querydisk -d vol1
Disk "VOL1" is a valid ASM disk on device /dev/sda4[8,4]
[root@oracle16 ~]# oracleasm querydisk -p vol1
Disk "VOL1" is a valid ASM disk
/dev/sda4: LABEL="VOL1" TYPE="oracleasm"
总而言之,oracleasm 使用帮助还需要多看看,否则一碰到问题都不知道怎么处理。这个问题可能是在oracle 用户还没创建之前,oracle asmlib 包就已经安装上,并且配置了,只是配置时啥也没输入。整体上感觉它还没raw devices 好用。至于性能上是否有多大差别,这里不能下结论。