配置 ASMLib
使用 ASMLib 之前,必须运行配置脚本以准备驱动程序。以 root 用户身份运行以下命令,并响应如下示例中所显示的提示。
# /etc/init.d/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) [n]:y
Fix permissions of Oracle ASM disks on boot (y/n) [y]:y
Writing Oracle ASM library driver configuration [ OK ]
Creating /dev/oracleasm mount point [ OK ]
Loading module "oracleasm" [ OK ]
Mounting ASMlib driver filesystem [ OK ]
Scanning system for ASM disks [ OK ]
现在,如下所示启用 ASMLib 驱动程序。
# /etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration [ OK ]
Scanning system for ASM disks [ OK ]
为 ASM 配置磁盘
接下来,告诉 ASM 驱动程序您要使用的磁盘。请注意,这些磁盘是不包含任何内容(甚至不包含分区)的空磁盘。可以将磁盘分区用于 ASM,但建议您不要这样做。
通过以 root 用户身份运行以下命令来标记由 ASMLib 使用的磁盘:
/etc/init.d/oracleasm createdisk DISK_NAME device_name
(提示:DISK_NAME 应由大写字母组成。当前版本有一个错误,即如果使用小写字母,ASM 实例将无法识别磁盘。)
例如:
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb
Marking disk "/dev/sdb" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc
Marking disk "/dev/sdc" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd
Marking disk "/dev/sdd" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL4 /dev/sdf
Marking disk "/dev/sdf" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL5 /dev/sdg
Marking disk "/dev/sdg" as an ASM disk [ OK ]
# /etc/init.d/oracleasm createdisk VOL6 /dev/sdh
Marking disk "/dev/sdh" as an ASM disk [ OK ]
以下示例演示了如何列出标记为由 ASMLib 使用的所有磁盘。
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
VOL6