本例是基于ASMLib创建, 也可以基于裸设备创建.
1.安装asm所需要的支持包
A.在Oracle网站下载支持包:这里
B.根据linux内核下载相应的asm安装包:
oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-8.el5PAE-2.0.4-1.el5.i686.rpm
oracleasm-2.6.18-8.el5xen-2.0.4-1.el5.i686.rpm
oracleasmlib-2.0.3-1.el5.i386.rpm
oracleasm-support-2.0.4-1.el5.i386.rpm
C.安装 rpm -Uvh .......... --nodeps
1.1 安装ASMLib
# cd /orahome/wangnc/asmlib
# rpm -Uvh oracleasm-support-2.1.3-1.el4.i386.rpm oracleasm-2.6.9-55.ELsmp-2.0.3-1.i686.rpm oracleasmlib-2.0.4-1.el4.i386.rpm
1.2 配置ASMLib
# /etc/init.d/oracleasm configure
...
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
...
# df -ha | grep oracleasm
oracleasmfs 0 0 0 - /dev/oracleasm
附启用或禁用oracleasm自动启动方法:
# /etc/init.d/oracleasm disable
# /etc/init.d/oracleasm enable
1.3 物理磁盘分区
对用来做ASM 的硬盘要进行分区(只分一个区, 此处采用硬盘sdb):
# fdisk -l | grep Disk
Disk /dev/sda: 250.0 GB, 250059350016 bytes
Disk /dev/sdb: 250.0 GB, 250059350016 bytes
# fdisk /dev/sdb
Command (m for help): n
p
Partition number (1-4): 1
First cylinder (1-30401, default 1):
Last cylinder or +size or +sizeM or +sizeK (1-30401, default 30401):
Command (m for help): w
# fdisk -l /dev/sdb
Disk /dev/sdb: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 30401 244196001 83 Linux
1.4 创建ASM磁盘
这些磁盘是不包含任何内容的空磁盘, 创建时物理磁盘要带分区号如sdb1.
ASM磁盘名可以为大写字母,数字和下划线, 且以字母开始:
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk: [ OK ]
如果提示Failed, 可以跟踪日志:
# tail -f /var/log/oracleasm
附删除磁盘语句:
# /etc/init.d/oracleasm deletedisk VOL1
检查配置情况:
# /etc/init.d/oracleasm querydisk VOL1
# /etc/init.d/oracleasm querydisk /dev/sdb1
# /etc/init.d/oracleasm listdisks
# ls -l /dev/oracleasm/disks/*
# /etc/init.d/oracleasm status
1.5 建初始化参数文件
注意asm_diskstring必需配置成'ORCL:'开头.
# su - oracle
$ export ORACLE_SID=+ASM
$ vi $ORACLE_HOME/dbs/init$ORACLE_SID.ora
asm_diskstring='ORCL:VOL*'
background_dump_dest='/u01/app/oracle/admin/+ASM/bdump'
core_dump_dest='/u01/app/oracle/admin/+ASM/cdump'
user_dump_dest='/u01/app/oracle/admin/+ASM/udump'
instance_type='asm'
large_pool_size=12M
remote_login_passwordfile='SHARED'