Oracle 10gR2 下配置简单ASM实例

1. 从Oracle官方网站根据自己的操作系统下载 oracleasmlib 包,oracleasm-support 包 和 oracleasm-

     下载地址:http://www.oracle.com/technology/software/tech/linux/asmlib/rhel4.html

2. 下载完成后以root用户安装

[root@localhost ~]# rpm -qa |grep oracleasm
     [root@localhost software]# rpm -Uvh oracleasm-support-2.1.3-1.el4.x86_64.rpm \
> oracleasm-2.6.9-55.ELsmp-2.0.3-1.x86_64.rpm \
> oracleasmlib-2.0.4-1.el4.x86_64.rpm
     Preparing...                ########################################### [100%]
1:oracleasm-support      ########################################### [ 33%]
2:oracleasm-2.6.9-55.ELsm########################################### [ 67%]
3:oracleasmlib           ########################################### [100%]
[root@localhost software]#

3.   以root身份做localconfig 配置

[orarms@localhost bin]$ ./localconfig add
You must be logged in as root to run ./localconfig.
Log in as root and restart ./localconfig execution.
[orarms@localhost bin]$

     [root@localhost ~]# /home/orarms/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 30 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.
localhost
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)

    【附】可以通过crsclt check cssd命令检查cssd service的状态是否正常
[orarms@localhost ~]$ crsctl check cssd
CSS appears healthy
[orarms@localhost ~]$

4.   以root身份做oracleasm的配置
     [root@localhost software]# /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 []: orarms
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@localhost software]#

5.   以root身份做添加磁盘和分区操作

[root@localhost ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 121601.
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)

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System
/dev/sdb1               1       51200   411263968+ 83 Linux
/dev/sdb2           51201      121601   565496032+ 83 Linux

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Selected partition 2

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 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-121601, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-121601, default 121601): 10145

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System
/dev/sdb1               1       10145    81489681   83 Linux

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

Command (m for help): p

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id System
/dev/sdb1               1       10145    81489681   83 Linux
/dev/sdb2           10146      121601   895270320   83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#

6. 创建ASM磁盘

[root@localhost software]# /etc/init.d/oracleasm listdisk
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[root@localhost software]# /etc/init.d/oracleasm listdisks
MYVOL1
[root@localhost software]# /etc/init.d/oracleasm deletedisk MYVOL1
Removing ASM disk "MYVOL1": [ OK ]
[root@localhost software]# /etc/init.d/oracleasm listdisks
[root@localhost software]# /etc/init.d/oracleasm createdisk MYVOL1 /dev/sda8
Marking disk "MYVOL1" as an ASM disk: [ OK ]
[root@localhost software]# /etc/init.d/oracleasm createdisk MYVOL2 /dev/sdb2
Marking disk "MYVOL2" as an ASM disk: [ OK ]
[root@localhost software]# /etc/init.d/oracleasm listdisks
MYVOL1
MYVOL2      

【注】oracleasm scandisks 可以用在rac环境下同步ASM磁盘信息,包含操作系统中获取的磁盘信息。       

7. 切换用户为oracle或者其他安装了oracle的用户,本例中为orarms。在$ORACLE_HOME/dbs/下创建+ASM实例的init.ora文件和密码文件

[orarms@localhost ~]$ cd $ORACLE_HOME
[orarms@localhost db_1]$ cd dbs
[orarms@localhost dbs]$ vi init+ASM.ora

*.asm_diskstring='ORCL:MYVOL*'
*.background_dump_dest='/home/orarms/admin/+ASM/bdump'
*.core_dump_dest='/home/orarms/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/home/orarms/admin/+ASM/udump'

[orarms@localhost dbs]$ orapwd file=orapw+ASM password=dba

8.   设置SID,启动实例,创建磁盘组
[orarms@localhost ~]$ export ORACLE_SID=+ASM
[orarms@localhost dbs]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Sep 8 16:45:00 2009

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ASM instance started

Total System Global Area 130023424 bytes
Fixed Size                  2082208 bytes
Variable Size             102775392 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted

【注】启动实例的时候出现ORA-15110错误非常正常,因为我们还没有创建diskgroup

SQL> select path,mount_status from v$asm_disk order by disk_number;

     PATH
--------------------------------------------------------------------------------
MOUNT_S
-------
ORCL:MYVOL1
     CLOSED

     ORCL:MYVOL2
     CLOSED

【注】此时查询 v$asm_disk,可以看到我们之前创建的ASM磁盘MYVOL1和MYVOL2,如果没有看到,则是设置的asm_diskstring参数不正确,需要调整。

-- 开始创建磁盘组
SQL> create diskgroup diskgrp1 normal redundancy
2     failgroup failgrp1 disk 'ORCL:MYVOL1'
3     failgroup failgrp2 disk 'ORCL:MYVOL2';

Diskgroup created.

SQL> select path,mount_status from v$asm_disk order by disk_number;

PATH
--------------------------------------------------------------------------------
MOUNT_S
-------
ORCL:MYVOL1
     CACHED

ORCL:MYVOL2
     CACHED
【注】创建磁盘组后,再次查询v$asm_disk视图,发现ASM磁盘的状态由closed变成cached    

9. 创建spfile,重启实例

-- 创建spfile     
SQL> create spfile from pfile;

File created.

SQL> shut immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area 130023424 bytes
Fixed Size                  2082208 bytes
Variable Size             102775392 bytes
ASM Cache                  25165824 bytes
     ORA-15110: no diskgroups mounted
【注】非常奇怪,这个地方有提示没有磁盘组mounted,决定手动mount看看

SQL> alter diskgroup all mount;
alter diskgroup all mount
*
ERROR at line 1:
ORA-15110: no diskgroups mounted
【注】手动mount失败,继续提示没有磁盘组,参考oracle错误信息,看一下asm的参数设置,发现asm_diskgroups 没有值,设置上,手动mount成功,再次重启成功。
ORA-15110: no diskgroups mounted
Cause:          No diskgroups were specified in the ASM_DISKGROUPS parameter, so instance startup or the ALTER DISKGROUP ALL MOUNT command did not mount any diskgroups.

Action:           Specify valid diskgroups in the ASM_DISKGROUPS parameter or ignore the error.


SQL> show parameter asm

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
     asm_diskgroups                       string
asm_diskstring                       string      ORCL:MYVOL*
asm_power_limit                      integer     1
SQL> alter system set asm_diskgroups="diskgrp1" scope=both;

System altered.

SQL> alter diskgroup all mount;

Diskgroup altered.

SQL> shut immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area 130023424 bytes
Fixed Size                  2082208 bytes
Variable Size             102775392 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL>

至此,ASM简单实例配置成功,创建使用ASM管理存储的数据库就很简单了,dbca一路下去就ok

下面我在配置ASM出现问题和解决方法:

db_Standby-> export ORACLE_SID=+ASM
db_Standby-> sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 9 12:52:48 2010

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

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1217836 bytes
Variable Size              57502420 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted


SQL>  select path,mount_status from v$asm_disk order by disk_number;

PATH                 MOUNT_S
-------------------- -------
ORCL:VOL1            CLOSED
ORCL:VOL2            CLOSED
ORCL:VOL3            CLOSED
ORCL:VOL4            CLOSED

SQL> show parameter asm


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups                       string
asm_diskstring                       string
asm_power_limit                      integer     1

alter system set asm_diskgroups="DATA" ;

System altered.

SQL> show parameter asm

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups                       string      DATA
asm_diskstring                       string
asm_power_limit                      integer     1
SQL>  alter diskgroup all mount;


Diskgroup altered.

SQL> shut immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1217836 bytes
Variable Size              57502420 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted

 

 

【参考资料】
1. http://www.oracle.com/technology/tech/linux/asmlib/install.html
2. http://www.oracle.com/technology/global/cn/pub/articles/10gdba/week8_10gdba.html
3. http://jackjw.itpub.net/post/602/487507
4. http://blog.csdn.net/wyzxg/archive/2008/03/13/2176517.aspx


 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值