1、首先添加3塊磁碟
2、安裝包
[root@myorcl asm]# ls
Oracleasm-2.6.18-348.6.1.el5-2.0.5-1.el5.i686.rpm
oracleasm-2.6.18-348.6.1.el5debug-2.0.5-1.el5.i686.rpm
oracleasm-2.6.18-348.6.1.el5PAE-2.0.5-1.el5.i686.rpm
oracleasm-2.6.18-348.6.1.el5xen-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.8-1.el5.i386.rpm
3、查看3塊磁碟
[root@myorcl asm]# fdisk -l
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
3、按照下面類似的方法建立分區
root@myorcl asm]# fdisk /dev/sdc
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.
The number of cylinders for this disk is set to 2610.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
eextended
pprimary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@myorcl asm]# partprobe /dev/sdb
[root@myorcl asm]# partprobe /dev/sdc
[root@myorcl asm]# partprobe /dev/sdd
[root@myorcl asm]# vi /etc/udev/rules.d/60-raw.rules 添加
ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw100 %N"
ACTION=="add",KERNEL=="sdc1",RUN+="/bin/raw /dev/raw/raw101 %N"
ACTION=="add",KERNEL=="sdd1",RUN+="/bin/raw /dev/raw/raw102 %N"
[root@myorcl asm]# vi /etc/udev/rules.d/90-raw.rules 添加
KERNEL=="raw10*",OWNER="oracle",GROUP="dba",MODE="0660"--已raw10*的裝置屬於oracle。
開啟start_udev服務
[root@myorcl asm]# start_udev
Starting udev: [OK]
查看許可權
[root@myorcl asm]# ll /dev/raw
total 0
crw-rw---- 1 oracle dba 162, 100 Jul5 07:43 raw100
crw-rw---- 1 oracle dba 162, 101 Jul5 07:43 raw101
crw-rw---- 1 oracle dba 162, 102 Jul5 07:43 raw102
4、添加叢集就緒服務
[root@myorcl asm]# /u01/app/oracle/product/10.2.0/db_1/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.
myorcl
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@myorcl asm]# 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 []: oinstall
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
5、然後通過DBCA配置
[oracle@myorcl ~]$ dbca
選擇配置ASM
就可以看到之前的裸裝置
冗餘機制有normal :兩個磁碟組,hight:三個磁碟組,external:外部冗餘:一個磁碟組
然後完成,不配置其他選項
6、訪問執行個體
[oracle@myorcl ~]$ export ORACLE_SID=+ASM
[oracle@myorcl ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 5 07:59:01 2013
Copyright (c) 1982, 2005, Oracle.All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
+ASM
查看ASM磁碟組
SQL> desc v$asm_diskgroup
NameNull?Type
----------------------------------------- -------- ----------------------------
GROUP_NUMBERNUMBER
NAMEVARCHAR2(30)
SECTOR_SIZENUMBER
BLOCK_SIZENUMBER
ALLOCATION_UNIT_SIZENUMBER
STATEVARCHAR2(11)
TYPEVARCHAR2(6)
TOTAL_MBNUMBER
FREE_MBNUMBER
REQUIRED_MIRROR_FREE_MBNUMBER
USABLE_FILE_MBNUMBER
OFFLINE_DISKSNUMBER
UNBALANCEDVARCHAR2(1)
COMPATIBILITYVARCHAR2(60)
DATABASE_COMPATIBILITYVARCHAR2(60)
7、查看資料庫執行個體是否能夠使用ASM磁碟組
[oracle@myorcl asm]$ export ORACLE_SID=orcl
[oracle@myorcl asm]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jul 5 08:03:07 2013
Copyright (c) 1982, 2005, Oracle.All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
SQL>
SQL> select name from v$asm_diskgroup;
NAME
--------------------------------------------------------------------------------
DB
8、建立ASM執行個體資料庫