VMware虚拟机搭建Linux Oracle 10g ASM环境

1.新增磁盘进行分区

这里我们将新增磁盘分成3部分:/dev/sdb1,/dev/sdb2,/dev/sdb3

[root@ocp db10g]# fdisk /dev/sdb
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.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-783, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-783, default 783): +2G

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         244     1959898+  83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (245-783, default 245):
Using default value 245
Last cylinder or +size or +sizeM or +sizeK (245-783, default 783): +2g

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         244     1959898+  83  Linux
/dev/sdb2             245         488     1959930   83  Linux

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (489-783, default 489):
Using default value 489
Last cylinder or +size or +sizeM or +sizeK (489-783, default 783):
Using default value 783

Command (m for help): p

Disk /dev/sdb: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         244     1959898+  83  Linux
/dev/sdb2             245         488     1959930   83  Linux
/dev/sdb3             489         783     2369587+  83  Linux

Command (m for help): w
The 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.rpm
warning: oracleasm-support-2.1.7-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [100%]
[root@ocp asm2.6.18.164-el5]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
warning: oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.18-164.el########################################### [100%]
[root@ocp asm2.6.18.164-el5]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm        warning: oracleasmlib-2.0.4-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasmlib           ########################################### [100%]

3.初始化ASM

[root@ocp asm2.6.18.164-el5]# /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 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 []: orainstall
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  ]

4.创建asm磁盘

[root@ocp asm2.6.18.164-el5]# /etc/init.d/oracleasm createdisk vol1 /dev/sdb1
Marking disk "vol1" as an ASM disk:                        [  OK  ]
[root@ocp asm2.6.18.164-el5]# /etc/init.d/oracleasm createdisk vol2 /dev/sdb2
Marking disk "vol2" as an ASM disk:                        [  OK  ]
[root@ocp asm2.6.18.164-el5]# /etc/init.d/oracleasm createdisk vol3 /dev/sdb3
Marking disk "vol3" as an ASM disk:                        [  OK  ]

列出所有asm磁盘

[root@ocp ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3

扫描asm磁盘

[root@ocp ~]# /etc/init.d/oracleasm scandisks
Scanning 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=30m
core_dump_dest='/u01/oracle/admin/+ASM/cdump'

6.创建密码文件,注意在dbs目录下

[oracle@ocp dbs]$ orapwd file=orapw+ASM password=oracle

7.启动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 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.
        ocp
CSS 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 /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 7 14:17:19 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn sys as sysdba
Enter password:
Connected to an idle instance.
SQL> startup
ASM instance started

Total System Global Area  104857600 bytes
Fixed Size                  1217956 bytes
Variable Size              78473820 bytes
ASM Cache                  25165824 bytes
ORA-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_SIZE      STATE       TYPE
------------ ------------------------------ ---------- ----------- ------
           1     ORADATA                              4096                            MOUNTED     NORMAL
           2     FLA                                         4096                             MOUNTED     EXTERN

ASM实例已经启动,这个时候我们就可以用DBCA来创建数据库了,唯一需要注意的是在选择数据文件和闪回区存放位置的时候设置一下


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15592508/viewspace-734962/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15592508/viewspace-734962/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值