ITPub博客

首页 > 数据库 > Oracle > 【BUILD_ORACLE】使用ASMLib包搭建ASM磁盘

【BUILD_ORACLE】使用ASMLib包搭建ASM磁盘

原创 Oracle 作者:Attack_on_Jager 时间:2021-01-22 10:49:20 0 删除 编辑

前言

虽然目前主流使用的是UDEV去搭建ASM磁盘,但ASMLib包依旧是Oracle官方推荐的搭建方式,此文档适用于Linux 6和Linux 7,也适用于ASM单实例和RAC环境(唯一的区别是ASMLib包需要分别下载对应OS支持的版本)。本文档以Linux 6的ASM单实例数据库举例。

注:udev绑定的方式参考:

http://blog.itpub.net/69992972/viewspace-2754349/


实验环境准备

OS:RHEL 6.4

ASM&DB:Oracle 11.2.0.4

RPM:oracleasm-support-2.1.8-1.el6.x86_64.rpm,kmod-oracleasm-2.0.6.rh1-2.el6.x86_64.rpm,oracleasmlib-2.0.4-1.el6.x86_64.rpm(缺一不可)

RPM下载地址:

OL6:

OL7:


安装步骤

1. 给磁盘分区

# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x37d16a21.

Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p):
p    ##只需要一个主分区就行,不需要扩展分区,逻辑分区这些

Partition number (1-4, default 1): 1
First sector (2048-106587366, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-106587366, default 106587366):
+2G    ##随便给个大小,全部划分给主分区都行
Partition 1 of type Linux and of size 2 GiB is set

Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.


2.  安装Oracle缺失rpm包:

# rpm -ivh libaio-devel-0.3.106-3.2.x86_64.rpm

# rpm -ivh pdksh-5.2.14-30.x86_64.rpm

# rpm -ivh elfutils-libelf-devel-0.152-1.el6.x86_64.rpm


3. 安装ASMLIB包:

# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm

# rpm -ivh kmod-oracleasm-2.0.6.rh1-2.el6.x86_64.rpm

# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm

# oracleasm -V     ##安装后查看oracleasm命令是否可用


4. 创建相关用户,组,环境变量和安装目录:

DB:

# groupadd -g 501 oinstall

# groupadd -g 502 dba

# groupadd -g 503 oper

# groupadd -g 504 asmadmin

# groupadd -g 505 asmoper

# groupadd -g 506 asmdba

Grid:

# useradd -g oinstall -G dba,asmdba,oper -u 501 oracle

# passwd oracle

# useradd -g oinstall -G asmadmin,asmdba,asmoper,dba -u 502 grid

# passwd grid


# Oracle Settings     oracle用户环境变量

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_SID=

export ORACLE_TERM=xterm

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export NLS_LANG=american_america.zhs16cgb231280


$source .bash_profile生效


# grid Settings    grid用户环境变量

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_SID=+ASM

export ORACLE_BASE=/oracle/app/grid

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_TERM=xterm

export PATH=/usr/sbin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

export NLS_LANG=american_america.zhs16cgb231280


$source .bash_profile生效


# mkdir -p /oracle/app/oracle/product/11.2.0/db_1       ##oracle用户$ORACLE_HOME

# mkdir -p /oracle/app/grid/product/11.2.0/db_1          ##grid用户$GI_HOME

# chown -R oracle:oinstall /oracle/

# chown -R grid:oinstall /oracle/app/grid

# chmod -R 775 /oracle


5. 创建ASM磁盘

# /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 <ENTER> without typing an

answer will keep that current value.  Ctrl-C will abort.


Default user to own the driver interface []: grid

Default group to own the driver interface []: oinstall

Start Oracle ASM library driver on boot (y/n) [y]: 

Scan for Oracle ASM disks on boot (y/n) [y]: 

Writing Oracle ASM library driver configuration: done

Initializing the Oracle ASMLib driver:                     [  OK  ]

Scanning the system for Oracle ASMLib disks:               [  OK  ]


# fdisk -l

# oracleasm createdisk ORACLEASM1 /dev/sdb1     ##创建ASM

# oracleasm listdisks    ##查看是否创建成功

# ls -l /dev/oracleasm/disks    ##查看创建的asm磁盘


6. 后续操作

接下来就可以安装grid软件,db软件和建库了


注意:

单实例在安装Grid软件的时候,需要选择下图的第二项,因为需要选择ASM磁盘(RAC可以直接选第一项):

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

请登录后发表评论 登录
全部评论
小小DBA一枚

注册时间:2021-01-11

  • 博文量
    20
  • 访问量
    28113