1.确定kernel版本
[root@D620 ASMLIB]# uname -a
Linux D620.localhost.com 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux
[root@D620 ASMLIB]#
2.下载安装相应版本的ASMLIB和Linux RPM,注意顺序和依赖关系
rpm -Uvh oracleasm-support-2.1.4-1.el5.i386.rpm
rpm -Uvh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
rpm -Uvh oracleasmlib-2.0.4-1.el5.i386.rpm
rpm -Uvh kernel-xen-2.6.18-164.el5.i686.rpm
rpm -Uvh oracleasm-2.6.18-164.el5xen-2.0.5-1.el5.i686.rpm
rpm -Uvh kernel-PAE-2.6.18-164.el5.i686.rpm
rpm -Uvh oracleasm-2.6.18-164.el5PAE-2.0.5-1.el5.i686.rpm
rpm -Uvh kernel-debug-2.6.18-164.el5.i686.rpm
rpm -Uvh oracleasm-2.6.18-164.el5debug-2.0.5-1.el5.i686.rpm
rpm -Uvh oracleasm-2.6.18-164.el5-debuginfo-2.0.5-1.el5.i686.rpm
3.配置ASM,扫描磁盘
[root@D620 ~]# ls -l /etc/init.d/oracleasm
-rwxr-xr-x 1 root root 7124 Jan 11 08:23 /etc/init.d/oracleasm
[root@D620 ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
[root@D620 ~]# /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
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@D620 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@D620 ~]# /etc/init.d/oracleasm listdisks
没有空闲的raw设备了。
[root@D620 ~]# fdisk -l
Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 522 4192933+ b W95 FAT32
/dev/sda2 * 523 6773 50211157+ 83 Linux
/dev/sda3 6774 7295 4192965 82 Linux swap / Solaris
[root@D620 ~]#
4.创建ASM instance
首先执行localconfig.
[root@D620 ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin
[root@D620 bin]# ls -l localconfig
-rwxr-xr-x 1 oracle oinstall 21995 Aug 17 2010 localconfig
[root@D620 bin ]# ./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
d620
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@D620 bin]#
手工编辑一个pfile文件:
vi /tmp/init+ASM.ora
只写一句: INSTANCE_TYPE=ASM
创建instance
export ORACLE_SID=+ASM
sqlplus / as sysdba
SQL> CREATE SPFILE FROM PFILE='/tmp/init+ASM.ora';
File created.
SQL> startup nomount
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
SQL>
如果用startup mount ,会提示:
SQL> startup
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1217812 bytes
Variable Size 53308140 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
SQL>
接下来可以创建diskgroup了。
例如:
ALTER DISKGROUP ALL MOUNT ;
CREATE DISKGROUP FLASH External REDUNDANCY DISK '/dev/raw/raw1' SIZE 2870M ;
CREATE DISKGROUP data External REDUNDANCY DISK '/dev/raw/raw2' SIZE 2870M ,
'/dev/raw/raw3' SIZE 2870M ;
参考资料:
http://www.oracle-base.com/articles/10g/AutomaticStorageManagement10g.php