ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 探索ORACLE之ASM02_安装

探索ORACLE之ASM02_安装

原创 Linux操作系统 作者:wuweilong 时间:2012-04-09 19:36:17 0 删除 编辑

探索ORACLEASM02_安装

作者:吴伟龙

 

好了,现在开始谈谈有关于ASM安装的相关内容,ASM的安装必须建立在操作系统和数据库软件已经安装完成的及实例未创建之前来进行安装,之后再进行选择ASM方式建库。ASM不仅可以应用于单实例的数据库,同时更适用于RAC集群方式的数据库,并且ASM只被ORACLE所认,同时也是ORACLE最佳的存储解决方案,可以有效的替代RAID技术和卷管理技术,比裸设备的管理更加方便;所以现在大部分企业都在迅速的向ASM技术迁移。

在上一篇中我们已经探讨过了ASM的三种模式,及其的一些应用,在这里我们就不对其进行过多的累述。正式进入这篇的主题,如何安装ASM软件,安装ASM需要具备哪些条件。

 

ASM安装步骤:

一、基础环境准备

1、  检查操作系统和数据库软件是否安装完成:

 

Installation in progress (Mon Apr 09 19:12:44 CST 2012)

...............................................................  18% Done.

...............................................................  36% Done.

...............................................................  54% Done.

...............................................................  73% Done.

............                                                     76% Done.

Install successful

 

Linking in progress (Mon Apr 09 19:19:34 CST 2012)

Link successful

 

Setup in progress (Mon Apr 09 19:23:13 CST 2012)

..............                                                  100% Done.

Setup successful

 

End of install phases.(Mon Apr 09 19:23:26 CST 2012)

WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.

To register the new inventory please run the script. '/oracle/oraInventory/orainstRoot.sh' with root privileges.

If you do not register the inventory, you may not be able to update or patch the products you installed.

 

The following configuration scripts

/oracle/orahome/10.2.0/db_1/root.sh

need to be executed as root for configuring the system. If you skip the execution of the configuration tools, the configuration will not be complete and the product wont function properly. In order to get the product to function properly, you will be required to execute the scripts and the configuration tools after exiting the OUI.

 

The installation of Oracle Database 10g was successful.

 

从如上信息我们可以看到数据库已经安装完成,操作系统肯定也是没有问题的。

 

 

2、  检查数据库和操作系统版本:

[oracle@wwl db_1]$ lsb_release -a

LSB Version:    :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch

Distributor ID: EnterpriseEnterpriseServer

Description:    Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)

Release:        5.4

Codename:       Carthage

[oracle@wwl db_1]$

 

[oracle@wwl db_1]$ uname -a

Linux wwl 2.6.18-164.el5 #1 SMP Thu Sep 3 02:16:47 EDT 2009 i686 i686 i386 GNU/Linux

操作系统版本为5.4 X86,内核版本为2.6.18-164.el5,后面下载ASM包必须要对应

 

 

[oracle@wwl db_1]$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 9 19:41:54 2012

 

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

 

Connected to an idle instance.

 

SQL>

 

数据库版本是10.2.0.1.

 

 

3、  我们已经知道了这些信息后,我们就可以有针对性的下载ASM:

 

ASM下载地址,版本不一样,用的ASM包也不一样

http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html

 

找到Intel IA32 (x86) Architecture系列中的这个包下载下来:

Drivers for kernel 2.6.18-164.el5

·         oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm

·         以及如下两个包下载下来就可以了:

Library and Tools

·         oracleasm-support-2.1.7-1.el5.i386.rpm

·         oracleasmlib-2.0.4-1.el5.i386.rpm

·          

 

4、  下载完了之后开始安装asmrpm包,root用户安装,注意安装顺序,如下:

 

[root@wwl asmpark]# ls

oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm

oracleasmlib-2.0.4-1.el5.i386.rpm

oracleasm-support-2.1.7-1.el5.i386.rpm

[root@wwl asmpark]# 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@wwl asmpark]# 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@wwl asmpark]# 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%]

[root@wwl asmpark]#

 

 

5、  好了,现在ASM相关包已经安装完成,现在来开始创建用于ASM的磁盘分区(不是一定要做,裸盘也可以做ASM

 

[root@wwl asmpark]# fdisk -l

 

Disk /dev/sda: 16.1 GB, 16106127360 bytes

255 heads, 63 sectors/track, 1958 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        1958    15623212+  8e  Linux LVM

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdb doesn't contain a valid partition table

 

Disk /dev/sdc: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

Disk /dev/sdc doesn't contain a valid partition table

[root@wwl asmpark]#

 

我们从上图可以看出系统中有两块空闲的磁盘没有使用,我们首先需要对磁盘创建分区,但不能格式化,命令如下:

fdisk /dev/sdb /n/p/1/回车/回车/w

fdisk /dev/sdc /n/p/1/回车/回车/w

 

如下就已经创建好了分区:

 

[root@wwl asmpark]# fdisk -l

 

Disk /dev/sda: 16.1 GB, 16106127360 bytes

255 heads, 63 sectors/track, 1958 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14        1958    15623212+  8e  Linux LVM

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1        1305    10482381   83  Linux

 

Disk /dev/sdc: 10.7 GB, 10737418240 bytes

255 heads, 63 sectors/track, 1305 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1               1        1305    10482381   83  Linux

 

 

二、ASM配置

以上已将准备环境准备好,下一步骤就是开始配置了,这里面配置包括如下几个步骤

开始创建ASM实例,创建ASM实例的方式有两种,一种是通过命令行,还有一种是通过图形界面,执行DBCA后有一步是创建ASM实例,图形界面实在太简单了,跟创建DB是一样的,在这里就不累赘了。

 

在使用ASM之前首先要配置ASMLib驱动程序,如下:

 

我们首先可以看下asm的配置工具 oracleasm的语法和功能,如下:

 [root@wwl asmpark]# /etc/init.d/oracleasm --help

Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}

[root@wwl asmpark]#

 

1、开始配置ASMLib

 [root@wwl asmpark]# /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 []: 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  ]

 

2、启用ASMLib驱动程序:

[root@wwl asmpark]# /etc/init.d/oracleasm enable

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver: [  OK  ]

Scanning the system for Oracle ASMLib disks: [  OK  ]

 

 

3、通过以root用户身份运行以下命令来标记由 ASMLib 使用的磁盘:

[root@wwl asmpark]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1

Marking disk "VOL1" as an ASM disk: [  OK  ]

[root@wwl asmpark]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1

Marking disk "VOL2" as an ASM disk: [  OK  ]

[root@wwl asmpark]#

 

4、通过如下命令查看ASM所能使用的磁盘及状态,一切显示都是正常的。

[root@wwl asmpark]# oracleasm querydisk VOL1

Disk "VOL1" is a valid ASM disk

[root@wwl asmpark]# oracleasm querydisk /dev/sdb1

Device "/dev/sdb1" is marked an ASM disk with the label "VOL1"

 

[root@wwl asmpark]# oracleasm querydisk VOL2

Disk "VOL2" is a valid ASM disk

[root@wwl ~]# oracleasm querydisk /dev/sdc1

Device "/dev/sdc1" is marked an ASM disk with the label "VOL2"

 

[root@wwl asmpark]# oracleasm listdisks

VOL1

VOL2

 

[root@wwl asmpark]# ls -l /dev/oracleasm/disks/*

brw-rw---- 1 oracle dba 8, 17 Apr 10 00:25 /dev/oracleasm/disks/VOL1

brw-rw---- 1 oracle dba 8, 33 Apr 10 00:25 /dev/oracleasm/disks/VOL2

 

[root@wwl asmpark]# oracleasm status

Checking if ASM is loaded: yes

Checking if /dev/oracleasm is mounted: yes

 

5、如上ASMLib已经安装完成,并且也将磁盘标记为可用,接下来要做的就是创建ASM实例,并构建一个使用ASM磁盘来存储数据的数据库,可以使用DBCA,当然也可以使用手工的方式来创,在这里,我就采用手工方式创建ASM实例,步骤如下:

 

6、创建初始化参数文件,信息如下:

[oracle@wwl dbs]$ vi $ORACLE_HOME/dbs/init$ORACLE_SID.ora

asm_diskstring='WWL:VOL*'

background_dump_dest='/oracle/admin/+ASM/bdump'

core_dump_dest='/oracle/admin/+ASM/cdump'

user_dump_dest='/oracle/admin/+ASM/udump'

instance_type='asm'

large_pool_size=12M

remote_login_passwordfile='SHARED'

 

7、增加实例信息到/etc/oratab

$ vi /etc/oratab

+ASM:/u01/app/oracle/product/10.2.0/db_1:Y

 

8、创建ASM实例密码文件:

[oracle@wwl dbs]$ $ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password='oracle' force=y;

[oracle@wwl dbs]$

 

9、创建ASM实例相应的目录:

[oracle@wwl dbs]$  mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump

[oracle@wwl dbs]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump

[oracle@wwl dbs]$ mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump

[oracle@wwl dbs]$

 

10、开启CSS服务

$ su - root

[root@wwl ~]# /oracle/orahome/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.

        wwl

CSS is active on all nodes.

Oracle CSS service is installed and running under init(1M)

 

11、启动ASM实例,并创建ASM磁盘组:

 

[oracle@wwl dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Apr 10 01:23:44 2012

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> startup nomount;

ASM instance started

Total System Global Area   83886080 bytes

Fixed Size                  1217836 bytes

Variable Size              57502420 bytes

ASM Cache                  25165824 bytes

 

SQL> select instance_name,status from v$instance;

 

INSTANCE_NAME    STATUS

---------------- ------------

+ASM             STARTED

 

SQL>

现在实例我已经将其启动到nomount状态,下一步开始创建ASM磁盘组。

 

12、创建ASM组并将其启动到MOUNT状态,

 

SQL> create diskgroup ASMGROUP1 normal redundancy disk '/dev/oracleasm/disks/VOL1','/dev/oracleasm/disks/VOL2';

 

Diskgroup created.

 

好了,磁盘组已经创建好了,并且也已经挂载了

SQL> select name,state from v$asm_diskgroup;

 

NAME                           STATE

------------------------------ -----------

ASMGROUP1                      MOUNTED

 

SQL>

 

可以看到如下,参数文件也随着更新了:

SQL> show parameter asm_diskgroups;

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

asm_diskgroups                       string      ASMGROUP1

 

 

13、检查ASM进程是否都正常启动了,我们之前提到的几个进程名称,这里面都有了,说明现在ASM已经是正常运行状态。

[oracle@wwl ~]$ ps -ef | grep asm

oracle    3887     1  0 02:58 ?        00:00:00 asm_pmon_+ASM

oracle    3889     1  0 02:58 ?        00:00:00 asm_psp0_+ASM

oracle    3891     1  0 02:58 ?        00:00:00 asm_mman_+ASM

oracle    3893     1  0 02:58 ?        00:00:00 asm_dbw0_+ASM

oracle    3895     1  0 02:58 ?        00:00:00 asm_lgwr_+ASM

oracle    3897     1  0 02:58 ?        00:00:00 asm_ckpt_+ASM

oracle    3899     1  0 02:58 ?        00:00:00 asm_smon_+ASM

oracle    3901     1  0 02:58 ?        00:00:00 asm_rbal_+ASM

oracle    3903     1  0 02:58 ?        00:00:00 asm_gmon_+ASM

 

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

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2010-01-08

  • 博文量
    249
  • 访问量
    1958597