Installing ASMLib

Installing ASMLib
divider.gif
 This document describes the steps required to install the Linux specific ASM library and its assocated driver. This library is provide to enable ASM I/O to Linux disks without the limitations of the standard Unix I/O API. The steps below are steps that the system administrator must follow.

Locating the ASMLib Packages
divider.gif
 The ASMLib software is available from the Oracle Technology Network. Go to ASMLib download page and follow the link for your platform.

You will see 4-6 packages for your Linux platform. The oracleasmlib package provides the actual ASM library. The oracleasm-support package provides the utilities used to get the ASM driver up and running. Both of these packages need to be installed.

The remaining packages provide the kernel driver for the ASM library. Each package provides the driver for a different kernel. You must install the appropriate package for the kernel you are running. Use the "uname -r command to determine the version of the kernel. The oracleasm kerel driver package will have that version string in its name. For example, if you were running Red Hat Enterprise Linux 4 AS, and the kernel you were using was the 2.6.9-5.0.5.ELsmp kernel, you would choose the oracleasm-2.6.9-5.0.5-ELsmp package. So, to install these packages on RHEL4 on an Intel x86 machine, you might use the command:

  rpm -Uvh oracleasm-support-2.0.0-1.i386.rpm \
    oracleasm-lib-2.0.0-1.i386.rpm \
    oracleasm-2.6.9-5.0.5-ELsmp-2.0.0-1.i686.rpm
If you were on a different machine, the package names would be slightly different, replacing 'i686' with the appropriate architecture. Use the package names relevant for your distribution.
NOTE: Distributions with the Linux 2.4 kernel still use the 1.0 kernel driver, while distributions based on the Linux 2.6 kernel use the 2.0 kernel driver. All distributions use version 2.0 of the support and library packages. See the driver matrix for more information.

Once the command completes, ASMLib is now installed on the system.

Configuring ASMLib
divider.gif
 Now that the ASMLib software is installed, a few steps have to be taken by the system administrator to make the ASM driver available. The ASM driver needs to be loaded, and the driver filesystem needs to be mounted. This is taken care of by the initialization script, /etc/init.d/oracleasm.

Run the /etc/init.d/oracleasm script. with the 'configure' option. It will ask for the user and group that default to owning the ASM driver access point. If the database was running as the 'oracle' user and the 'dba' group, the output would look like this:

  [root@ca-test1 /]# /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
  Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
  Writing Oracle ASM library driver configuration            [  OK  ]
  Creating /dev/oracleasm mount point                        [  OK  ]
  Loading module "oracleasm"                                 [  OK  ]
  Mounting ASMlib driver filesystem                          [  OK  ]
  Scanning system for ASM disks                              [  OK  ]
This should load the oracleasm.o driver module and mount the ASM driver filesystem. By selecting enabled = 'y' during the configuration, the system will always load the module and mount the filesystem on boot.

The automatic start can be enabled or disabled with the 'enable' and 'disable' options to /etc/init.d/oracleasm:

  [root@ca-test1 /]# /etc/init.d/oracleasm disable
  Writing Oracle ASM library driver configuration            [  OK  ]
  Unmounting ASMlib driver filesystem                        [  OK  ]
  Unloading module "oracleasm"                               [  OK  ]

  [root@ca-test1 /]# /etc/init.d/oracleasm enable
  Writing Oracle ASM library driver configuration            [  OK  ]
  Loading module "oracleasm"                                 [  OK  ]
  Mounting ASMlib driver filesystem                          [  OK  ]
  Scanning system for ASM disks                              [  OK  ]

Making Disks Available to ASMLib
divider.gif
 The system administrator has one last task. Every disk that ASMLib is going to be accessing needs to be made available. This is accomplished by creating an ASM disk. The /etc/init.d/oracleasm script. is again used for this task:
  [root@ca-test1 /]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdg1
  Creating Oracle ASM disk "VOL1"                            [  OK  ]
Disk names are ASCII capital letters, numbers, and underscores. They must start with a letter.

Disks that are no longer used by ASM can be unmarked as well:

  [root@ca-test1 /]# /etc/init.d/oracleasm deletedisk VOL1
  Deleting Oracle ASM disk "VOL1"                            [  OK  ]
Any operating system disk can be queried to see if it is used by ASM:
  [root@ca-test1 /]# /etc/init.d/oracleasm querydisk /dev/sdg1
  Checking if device "/dev/sdg1" is an Oracle ASM disk        [  OK  ]
  [root@ca-test1 /]# /etc/init.d/oracleasm querydisk /dev/sdh1
  Checking if device "/dev/sdh1" is an Oracle ASM disk        [FAILED]
Existing disks can be listed and queried:
  [root@ca-test1 /]# /etc/init.d/oracleasm listdisks
  VOL1
  VOL2
  VOL3
  [root@ca-test1 /]# /etc/init.d/oracleasm querydisk VOL1
  Checking for ASM disk "VOL1"                               [  OK  ]
When a disk is added to a RAC setup, the other nodes need to be notified about it. Run the 'createdisk' command on one node, and then run 'scandisks' on every other node:
  [root@ca-test1 /]# /etc/init.d/oracleasm scandisks
  Scanning system for ASM disks                              [  OK  ]

Discovery Strings for Linux ASMLib
divider.gif
 ASMLib uses discovery strings to determine what disks ASM is asking for. The generic Linux ASMLib uses glob strings. The string must be prefixed with "ORCL:". Disks are specified by name. A disk created with the name "VOL1" can be discovered in ASM via the discovery string "ORCL:VOL1". Similarly, all disks that start with the string "VOL" can be queried with the discovery string "ORCL:VOL*".

Disks cannot be discovered with path names in the discovery string. If the prefix is missing, the generic Linux ASMLib will ignore the discovery string completely, expecting that it is intended for a different ASMLib. The only exception is the empty string (""), which is considered a full wildcard. This is precisely equivalent to the discovery string "ORCL:*".

NOTE: Once you mark your disks with Linux ASMLib, Oracle Database 10g R1 (10.1) OUI will not be able to discover your disks. It is recommended that you complete a Software Only install and then use DBCA to create your database (or use the custom install).

 

学习......

ASM 是 Oracle 数据库 10g 中一个非常出色的新特性,它以平台无关的方式提供了文件系统、逻辑卷管理器以及软件 RAID 等服务。ASM 可以条带化和镜像磁盘,从而实现了在数据库被加载的情况下添加或移除磁盘以及自动平衡 I/O 以删除“热点”。它还支持直接和异步的 I/O 并使用 Oracle9i 中引入的 Oracle 数据管理器 API(简化的 I/O 系统调用接口)。


 

ASM 不是一个通用的文件系统,并只能用于 Oracle 数据文件、重做日志以及控制文件。ASM 中的文件既可以由数据库自动创建和命名(通过使用 Oracle 管理文件特性),也可以由 DBA 手动创建和命名。由于操作系统无法访问 ASM 中存储的文件,因此对使用 ASM 文件的数据库执行备份和恢复操作的唯一途径就是通过恢复管理器 (RMAN)。

ASM 作为单独的 Oracle 实例实施,只有它在运行时其他数据库才能访问它。在 Linux 上,只有运行 OCSSD 服务(由 Oracle 通用安装程序默认安装)才能使用 ASM。ASM 需要的内存不多:对大多数系统,只需 64 MB。

安装 ASM

确定所需的 ASMLib 版本

ASMLib 以三个 Linux 程序包组成的程序包集提供:

oracleasmlib - ASM 库
oracleasm-support - 用于管理 ASMLib 的实用程序
oracleasm - ASM 库的内核模块
每个 Linux 发行套件都有其自己的 ASMLib 程序包集。在每个发行套件中,每个内核版本都有一个相应的 oracleasm 程序包。以下部分介绍如何确定所需的程序包集。
首先,以 root 用户身份登录并运行以下命令来确定所使用的内核:

uname -rm


例如:
oracle:/home/oracle # uname -rm
2.6.16.21-0.8-default i686

使用此信息在 OTN 上查找相应的 ASMLib 程序包:

将 Web 浏览器指向 http://www.oracle.com/technology/global/cn/tech/linux/asmlib
1, 选择适用于您的 Linux 版本的链接。
2, 下载适用于您的 Linux 版本的 oracleasmlib 和 oracleasm-support 程序包
3, 下载与您的内核相对应的 oracleasm 程序包。

oracle:/home/oracle # ls
.Xauthority .fonts .profile .xinitrc.template oracleasm-2.6.16.21-0.8-default-2.0.3-1.i586.rpm
.bash_history .gnu-emacs .urlview .xtalkrc oracleasm-support-2.0.3-1.i386.rpm
.bashrc .inputrc .viminfo 10201_database_linux32.zip oracleasmlib-2.0.2-1.i386.rpm
.dvipsrc .kermrc .xcoralrc Documents public_html
.emacs .mozilla .xemacs bin
.exrc .muttrc .xim.template database
oracle:/home/oracle # rpm -aq oracleasm*
oracle:/home/oracle # rpm -ivh oracleasm*.rpm
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [ 33%]
2:oracleasm-2.6.16.21-0.8########################################### [ 67%]
3:oracleasmlib ########################################### [100%]
oracle:/home/oracle #


配置 ASMLib

使用 ASMLib 之前,必须运行配置脚本以准备驱动程序。以 root 用户身份运行以下命令,并响应如下示例中所显示的提示。


oracle:/home/oracle # /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
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Creating /dev/oracleasm mount point: done
Loading module "oracleasm": done
Mounting ASMlib driver filesystem: done
Scanning system for ASM disks: done
oracle:/home/oracle #

现在,如下所示启用 ASMLib 驱动程序。

oracle:/home/oracle # /etc/init.d/oracleasm enable
Writing Oracle ASM library driver configuration: done
Scanning system for ASM disks: done
oracle:/home/oracle #

为 ASM 配置磁盘

接下来,告诉 ASM 驱动程序您要使用的磁盘。请注意,这些磁盘是不包含任何内容(甚至不包含分区)的空磁盘。可以将磁盘分区用于 ASM,但建议您不要这样做。

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

/etc/init.d/oracleasm createdisk DISK_NAME device_name

(提示:DISK_NAME 应由大写字母组成。当前版本有一个错误,即如果使用小写字母,ASM 实例将无法识别磁盘。)

例如:
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb
Marking disk "/dev/sdb" as an ASM disk [ OK ]


不过我按照上面说的运行
oracle:/home/oracle # /etc/init.d/oracleasm createdisk VOL1 /dev/sdb
Marking disk "/dev/sdb" as an ASM disk: asmtool: Device "/dev/sdb" is not a partition
failed

然后我把/dev/sdb重新分区了就可以
oracle:/home/oracle # /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk: done
oracle:/home/oracle # /etc/init.d/oracleasm createdisk VOL2 /dev/sdb2
Marking disk "/dev/sdb2" as an ASM disk: done
oracle:/home/oracle # /etc/init.d/oracleasm createdisk VOL3 /dev/sdb3
Marking disk "/dev/sdb3" as an ASM disk: done
oracle:/home/oracle # /etc/init.d/oracleasm createdisk VOL4 /dev/sdb5
Marking disk "/dev/sdb5" as an ASM disk: done

以下示例演示了如何列出标记为由 ASMLib 使用的所有磁盘。

oracle:/home/oracle # /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
oracle:/home/oracle #

既然已经安装了 ASMLib,且已将磁盘标记为可用,下面,您便可以创建一个 ASM 实例,并构建一个使用 ASM 进行磁盘存储的数据库。最容易的方法就是使用数据库配置助手 (DBCA) 来完成此操作。

以 oracle 身份登录并启动 DBCA:

dbca


1,欢迎
单击 Next。
2,操作
选择 Create a Database。
3,数据库模板
选择 General Purpose。
4,数据库标识
输入全局数据库名称。
5,管理选项
选择 Configure the Database with Enterprise Manager。
选择 Use Database Control for Database Management。
6,数据库证书
选择 Use Same Password for All Accounts。
输入口令并确认。
7,存储选项
选择 Automatic Storage Management (ASM)。
8,弹出一个对话框需要以root用户运行一个脚本 。
运行如下:
oracle:/u01/app/oracle/product/10.2.0/bin # /u01/app/oracle/product/10.2.0/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.
oracle
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
oracle:/u01/app/oracle/product/10.2.0/bin #

9,创建 ASM 实例
输入 ASM 实例的口令并确认。
10,弹出一个窗口,提示 DBCA 将立即创建并启动 ASM 实例。
单击 OK。
11,创建 ASM 实例时弹出一个带齿轮箱窗口。
12,ASM 磁盘组
由于这是新 ASM 实例且您尚未创建任何 ASM 实例,因此该窗口未显示可用磁盘组。
单击 Create New。
13,创建磁盘组
磁盘组名称
- 输入磁盘组名称,如 DATA1。
冗余
- High 镜像数据两次。
- Normal 镜像数据一次。
- External 不镜像 ASM 中的数据。如果外部 RAID 阵列提供冗余,则通常使用此选项。
选择成员磁盘
- 您必须手动指示 ASM 到什么地方查找 ASMLib 磁盘,因此,单击 Change Disk Discovery Path
- 弹出一个窗口,提示输入磁盘发现路径。如下所示将磁盘发现路径更改为“ORCL:*”。
- 单击 OK 继续。

您将返回到 Select Member Disks 窗口。您的所有 ASMLib 磁盘现在应显示在此窗口中。
单击该行开头的框,选择加入磁盘组的磁盘。完成后单击 OK。

14,ASM 磁盘组
您将返回到 ASM Disk Groups 窗口。此时,出现在上一步中创建的磁盘组。
单击该行开头的框选择此磁盘组。(在此实例中使用单个磁盘组。)
单击 Next。
15,数据库文件位置
选择 Use Oracle-Managed Files。
确保已将 Database Area 设置为您创建的磁盘组。它包含一个前导加号 — 例如,+DATA1。
16,恢复配置
选择 Specify Flash Recovery Area。
- 快速恢复区 — 输入要用于快速恢复的 ASM 磁盘组。
- 快速恢复区大小 — 接受默认值 2048。
如果要使用归档日志模式,则选中 Enable Archiving。对于评估数据库,可以不选该项。
17,数据库内容
选择 Sample Schemas。
我们不使用定制脚本,因此单击 Next。
18,初始化参数
接受默认值,然后单击 Next。
19,数据库存储
接受默认值,然后单击 Next。
20,创建选项
选择 Create Database(默认值)并单击 Finish。
21,确认
检查完数据库详细信息后单击 OK。
22,DBCA 显示一个操作列表和一个进度条。根据硬件的不同,数据库创建可能需要几分钟到几小时的时间。
23,当数据库创建完成时,将显示一个显示摘要窗口。记下 Enterprise Manager URL,然后单击 Exit。

 

 

Subject: Oracle VM: Oracleasm Createdisk Command Fails for OEL4/RHEL4 Paravirtualized (PVM) Guests
 Doc ID: Note:551713.1Type: PROBLEM
 Last Revision Date: 11-MAR-2008Status: PUBLISHED

In this Document
  Symptoms
  Cause
  Solution
  References


Applies to:

Linux x86-64
Linux x86
Oracle VM Server 2.1
Oracle Enterprise Linux 4 paravirtualized (PVM) guest
Red Hat Enterprise Linux 4 paravirtualized (PVM) guest

Symptoms

The 'oracleasm createdisk' command (/etc/init.d/oracleasm) fails for Oracle Enterprise Linux Release 4 (OEL4) and Red Hat Enterprise Linux Release 4 (RHEL4) Paravirtualized (PVM) guests, for example:

# /etc/init.d/oracleasm createdisk VOL1 /dev/xvdb1
Marking disk "/dev/xvdb1" as an ASM disk: asmtool: Device "/dev/xvdb1" is not a partition          [FAILED]


The 'oracleasm createdisk' command succeeds for OEL4 and RHEL4 fully/hardware virtualized (HVM) guest operating systems.

Cause

The inability of OEL4 and RHEL4 paravirtualised guests to run the 'oracleasm createdisk' command successfully is a known and documented issue - refer Oracle VM Server Release 2.1 Release Notes.

Solution

The issue can be worked around by using the asmtool utility (/usr/sbin/asmtool).

Run the asmtool command with the '-a force=yes' parameters to ignore the partition check.
Once the disk is created, run the 'oracleasm scandisks' command to correct the oracleasm disk permissions.

For example:

# /usr/sbin/asmtool -C -l /dev/oracleasm -n VOL1 -s /dev/xvdb1 -a force=yes
# /etc/init.d/oracleasm scandisks

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

转载于:http://blog.itpub.net/7301064/viewspace-466051/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值