.新增磁盘进行分区这里我们将新增磁盘分成3部分:/dev/sdb1,/dev/sdb2,/dev/sdb3[root@ocp db10g]# fdisk /dev/sdbDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabelBuilding a new DOS disklabel. Changes will remain in memory only,until you decide to write them. After that, of course, the previouscontent won't be recoverable.Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)Command (m for help): pDisk /dev/sdb: 6442 MB, 6442450944 bytes255 heads, 63 sectors/track, 783 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device BootStart EndBlocks IdSystemCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 1First cylinder (1-783, default 1): 1Last cylinder or +size or +sizeM or +sizeK (1-783, default 783): +2GCommand (m for help): pDisk /dev/sdb: 6442 MB, 6442450944 bytes255 heads, 63 sectors/track, 783 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device BootStart EndBlocks IdSystem/dev/sdb1 1 244 1959898+83LinuxCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 2First cylinder (245-783, default 245):Using default value 245Last cylinder or +size or +sizeM or +sizeK (245-783, default 783): +2gCommand (m for help): pDisk /dev/sdb: 6442 MB, 6442450944 bytes255 heads, 63 sectors/track, 783 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device BootStart EndBlocks IdSystem/dev/sdb1 1 244 1959898+83Linux/dev/sdb2 245 488 1959930 83LinuxCommand (m for help): nCommand action e extended p primary partition (1-4)pPartition number (1-4): 3First cylinder (489-783, default 489):Using default value 489Last cylinder or +size or +sizeM or +sizeK (489-783, default 783):Using default value 783Command (m for help): pDisk /dev/sdb: 6442 MB, 6442450944 bytes255 heads, 63 sectors/track, 783 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device BootStart EndBlocks IdSystem/dev/sdb1 1 244 1959898+83Linux/dev/sdb2 245 488 1959930 83Linux/dev/sdb3 489 783 2369587+83LinuxCommand (m for help): wThe partition table has been altered!Calling ioctl() to re-read partition table.Syncing disks.2.安装asm包[root@ocp asm2.6.18.164-el5]# rpm -ivh oracleasm-support-2.1.7-1.el5.i386.rpmwarning: oracleasm-support-2.1.7-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159Preparing...########################################### [100%] 1
racleasm-support########################################### [100%][root@ocp asm2.6.18.164-el5]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpmwarning: oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159Preparing...########################################### [100%] 1
racleasm-2.6.18-164.el########################################### [100%][root@ocp asm2.6.18.164-el5]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpmwarning: oracleasmlib-2.0.4-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159Preparing...########################################### [100%] 1
racleasmlib ########################################### [100%]3.初始化ASM[root@ocp asm2.6.18.164-el5]# /etc/init.d/oracleasm ISO27001configureConfiguring the Oracle ASM library driver.This will configure the on-boot properties of the Oracle ASM librarydriver.The following questions will determine whether the driver isloaded on boot and what permissions it will have.The current valueswill be shown in brackets ('[]').Hitting without typing ananswer will keep that current value.Ctrl-C will abort.Default user to own the driver interface []
racleDefault group to own the driver interface []
rainstallStart Oracle ASM library driver on boot (y/n) [n]: yScan for Oracle ASM disks on boot (y/n) [y]: yWriting Oracle ASM library driver configuration: doneInitializing the Oracle ASMLib driver: [OK]Scanning the system for Oracle ASMLib disks: [OK]4.创建asm磁盘[root@ocp asm2.6.18.164-el5]# /etc/init.d/oracleasm createdisk vol1 /dev/sdb1Marking disk "vol1" as an ASM disk:[OK][root@ocp asm2.6.18.164-el5]# /etc/init.d/oracleasm createdisk vol2 /dev/sdb2Marking disk "vol2" as an ASM disk:[OK][root@ocp asm2.6.18.164-el5]# /etc/init.d/oracleasm createdisk vol3 /dev/sdb3Marking disk "vol3" as an ASM disk:[OK]列出所有asm磁盘[root@ocp ~]# /etc/init.d/oracleasm listdisksVOL1VOL2VOL3扫描asm磁盘[root@ocp ~]# /etc/init.d/oracleasm scandisksScanning the system for Oracle ASMLib disks: [OK]5.创建ASM实例设置当前sid为asm[oracle@ocp ~]$ export ORACLE_SID=+ASM取一个pfile模板文件,并进行修改[oracle@ocp ~]$ cat $ORACLE_HOME/dbs/init.ora |grep -v ^# >$ORACLE_HOME/dbs/init+ASM.ora[oracle@ocp ~]$ mkdir /u01/oracle/admin/+ASM/{b,c,u}dump -p[oracle@ocp ~]$ cd $ORACLE_HOME/dbs修改初始化文件[oracle@ocp dbs]$ vi init+ASM.ora注意:这里需要删除原先的内容,新增以下内容:asm_diskstring='ORCL:VOL*'background_dump_dest='/u01/oracle/admin/+ASM/bdump'user_dump_dest='/u01/oracle/admin/+ASM/udump'instance_type='asm'large_pool_size=30mcore_dump_dest='/u01/oracle/admin/+ASM/cdump'6.创建密码文件,注意在dbs目录下[oracle@ocp dbs]$ orapwd file=orapw+ASM password=oracle7.启动css集群服务[oracle@ocp dbs]$ exit[root@ocp ~]# cd /u01/oracle/product/10gr2/db10g/bin[root@ocp 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 initializedAdding to inittabStartup 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.ocpCSS is active on all nodes.Oracle CSS service is installed and running under init(1M)8.启动asm实例[root@ocp bin]# su - oracle[oracle@ocp ~]$ export ORACLE_SID=+ASM[oracle@ocp ~]$ sqlplus /nologSQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 7 14:17:19 2012Copyright (c) 1982, 2005, Oracle.All rights reserved.SQL> conn sys as sysdbaEnter password:Connected to an idle instance.SQL> startupASM instance startedTotal System Global Area104857600 bytesFixed Size1217956 bytesVariable Size78473820 bytesASM Cache25165824 bytesORA-15110: no diskgroups mounted因为我们还没有进行磁盘组的分配,所以报错ORA-15110是正常的。创建磁盘组第一个我们是用来放数据文件的用的是normal方式SQL> create diskgroup oradata normal redundancy disk 'ORCL:VOL1','ORCL:VOL2';Diskgroup created.这里我们是用来放闪回区的,选择为外部冗余的方式SQL> create diskgroup fla external redundancy disk 'ORCL:VOL3' size 2G;Diskgroup created.查看一下我们的磁盘组SQL> select GROUP_NUMBER,NAME,BLOCK_SIZE,STATE,TYPE from v$asm_diskgroup;GROUP_NUMBER NAME BLOCK_SIZESTATE TYPE------------ ------------------------------ ---------- ----------- ------ 1 ORADATA4096MOUNTED NORMAL 2 FLA 4096 MOUNTED EXTERNASM实例已经启动,这个时候我们就可以用DBCA来创建数据库了,唯一需要注意的是在选择数据文件和闪回区存放位置的时候设置一下DevOps