oracle-ASM(AMSLib)

ASM  (参考文献:http://www.oracle.com/technology/global/cn/pub/articles/smiley_10gdb_install.html
  http://www.oracle.com/technology/global/cn/products/database/asm/index.html
  http://www.oracle.com/technology/global/cn/tech/linux/asmlib/install.html
  http://www.oracle.com/technology/software/tech/linux/asmlib/index.html#oracleasm_2_0_0_rhel4_x86
 
  第一部分:asm跟css
    asm存储系统需要使用称之为asm的一个附加特别的实例,这个asm实例将为一组oracle数据库
 进行存储管理。为了在oracle数据库中使用asm 存储,首先需要确保你已经在oracle数据库中运行了
 css(cluster synchronization service,集群同步服务)
   css负责对asm实例和数据库实例进行同步,它是作为oracle软件的一部分安装,css也可以从一个
 asm实例故障中恢复,可以使用上面的命令来查看css服务是否在运行:
  
  [root@oracle9i ~]# ps -ef|grep css
oracle   19331     1  0 18:26 ?        00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/ocssd.bin
root     19575 19019  0 18:32 pts/3    00:00:00 grep css

 上面的ps -ef  输出说明css服务的确在运行,如果看到的信息是下面的,则意味着css服务没有启用

  [root@oracle9i ~]# ps -ef|grep css
root     19575 19019  0 18:32 pts/3    00:00:00 grep css

也可以使用crsctl实用程序来检查css进程,如下:
[root@oracle9i ~]# crsctl  check cssd
CSS appears healthy   ---说明css在启用
Failure 1 contacting  CSS  daemon  ---则说明没有启用

如果CSSD后台进程没有启用,必须通过下面的步骤来启用它:
(1):
 以root用户登录系统
 (2):
 确保 已经将oracle主目录添加到系统的PATH路径中的,如下所示:
 [root@oracle9i ~]# export  PATH=$PATH:/u01/app/oracle/product/10.2.0/db_1/bin
[root@oracle9i ~]# echo   $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/u01/app/oracle/product/10.2.0/db_1/bin


(3):
运行以下命令启动css 后台进程

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

(4):
再次检查css 后台进程服务:

[root@oracle9i ~]# crsctl  check cssd
CSS appears healthy
[root@oracle9i ~]#

init.cssd 脚本作为css后台进程的控制脚本用来启动和停止css服务,该脚本位于
$ORACLE_HOME/css/admin 目录下面。localconfig add  命令会自动把init.cssd脚本添加
到你的操作系统的 /etc/inittab  文件中,如下所示:

# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1  
   如果你使用dbca创建一个oracle的 asm实例,css后台进程会自动启用。

 


自动存储管理 (ASM)

我把最重要的内容留在了最后。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

在 Linux 平台上,ASM 可以使用原始设备,或通过 ASMLib 接口管理的设备。出于易于使用和性能方面的原因,Oracle 建议在原始设备上使用 ASMLib。ASMLib 现在可以从 OTN 免费下载。本部分逐步讲解使用 ASMLib 配置一个简单 ASM 实例和构建一个使用 ASM 进行磁盘存储的数据库的全过程。

确定所需的 ASMLib 版本

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

[root@oracle9i asmlib]# ll
total 236
-rw-r--r-- 1 root root 130075 Dec  4  2009 oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
-rw-r--r-- 1 root root  13929 Dec  9  2009 oracleasmlib-2.0.4-1.el5.i386.rpm
-rw-r--r-- 1 root root  85382 Dec  4  2009 oracleasm-support-2.1.3-1.el5.i386.rpm

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

uname -rm

例如:
[root@oracle9i asmlib]# uname  -rm
2.6.18-164.el5 i686

该示例表明,这是一个使用 Intel i686 CPU 的 SMP(多处理器)系统的 2.4.9 内核。

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

将 Web 浏览器指向 http://www.oracle.com/global/cn/technology/tech/linux/asmlib
选择适用于您的 Linux 版本的链接。
下载适用于您的 Linux 版本的 oracleasmlib 和 oracleasm-support 程序包
下载与您的内核相对应的 oracleasm 程序包。对于以上示例,下载 oracleasm-2.4.9-e-smp-1.0.0-1.i686.rpm 程序包。
接下来,通过以 root 用户身份执行以下命令来安装程序包:

rpm  -Uvh  oracleasm-support-2.1.3-1.el5.i386.rpm
rpm -Uvh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm

例如:

[root@oracle9i asmlib]# rpm  -Uvh  oracleasm-support-2.1.3-1.el5.i386.rpm
warning: oracleasm-support-2.1.3-1.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [100%]

如果安装RHEL5 的ASM Lib 时出现 oracleasm >= 1.0.4 错误的解决办法
1. 先安装 oracleasm-support-2.1.3-1.el5.i386.rpm
2. 再直接运行 [root@RHEL5 ~]# oracleasm update-driver
[root@oracle9i asmlib]#  oracleasm update-driver

Kernel:         2.6.18-164.el5 i686
Driver name:    oracleasm-2.6.18-164.el5
Latest version: oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
Installing driver...
warning: /tmp/oracleasm.Ps3344/oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
        package oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686 is already installed
Driver not installed
[root@oracle9i asmlib]# rpm  -Uvh  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%]
        package oracleasmlib-2.0.4-1.el5.i386 is already installed
[root@oracle9i asmlib]# rpm  -Uvh  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%]
        package oracleasmlib-2.0.4-1.el5.i386 is already installed


配置 ASMLib

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

# /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 []:oinstall
Start Oracle ASM library driver on boot (y/n) [n]:y
Fix permissions of Oracle ASM disks on boot (y/n) [y]:y

Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks: [  OK  ]
--------------------------------------------------------------------
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  ]
--------------------------------------------------------------------

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


[root@oracle9i asmlib]# /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  ]

为 ASM 配置磁盘

(这里配置的磁盘需要先进行分区,然后才能配置磁盘信息)

[root@oracle9i asmlib]# fdisk  /dev/sdc
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.


The number of cylinders for this disk is set to 1044.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 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-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):
Using default value 1044

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

Calling ioctl() to re-read partition table.
Syncing disks.


[root@oracle9i ~]# fdisk  -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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        2610    20860402+  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: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        1044     8385898+  83  Linux
[root@oracle9i ~]#


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

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

/etc/init.d/oracleasm createdisk DISK_NAME device_name

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

例如:
[root@oracle9i asmlib]# /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  ]
[root@oracle9i asmlib]# /etc/init.d/oracleasm   createdisk  JESTOO1  /dev/sdb
Marking disk "JESTOO1" as an ASM disk: [FAILED]
[root@oracle9i asmlib]# /etc/init.d/oracleasm   createdisk  JESTOO1  /dev/sdb1
Marking disk "JESTOO1" as an ASM disk: [  OK  ]
[root@oracle9i asmlib]# /etc/init.d/oracleasm   createdisk  JESTOO2  /dev/sdc1
Marking disk "JESTOO2" as an ASM disk: [  OK  ]

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

# /etc/init.d/oracleasm listdisks
JESTOO1
JESTOO2


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

以 oracle 身份登录并启动 DBCA:


 

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

转载于:http://blog.itpub.net/15713890/viewspace-668720/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值