裸设备创建AMS磁盘
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实例数据库
本文出自 “侯志清” 博客,谢绝转载!