Oracle 11g R2 要使用ASM需要安装Grid Infrastructure,本文就如何安装Grid Infrastructure以及通过asm建库进行简单的文本记录
1、安装操作系统 RHEL5U4
[root@dbabc ~]# uname -r
2.6.18-164.el5
[root@dbabc ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
2、检查并安装必须的安装包
rpm -q –qf ‘%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})n’ binutils
compat-libstdc++-33
elfutils-libelf
elfutils-libelf-devel
gcc
gcc-c++
glibc
glibc-common
glibc-devel
glibc-headers
ksh
libaio
libaio-devel
libgcc
libstdc++
libstdc++-devel
make
sysstat
unixODBC
unixODBC-devel
需要以下安装包,当然也可以加grep 直接查看未安装的包
rpm -q –qf ‘%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})n’ binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common
glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel | grep not
* binutils-2.17.50.0.6
* compat-libstdc++-33-3.2.3
* compat-libstdc++-33-3.2.3(32 位)
* elfutils-libelf-0.125
* elfutils-libelf-devel-0.125
* elfutils-libelf-devel-static-0.125
* gcc-4.1.2
* gcc-c++-4.1.2
* glibc-2.5-24
* glibc-2.5-24(32 位)
* glibc-common-2.5
* glibc-devel-2.5
* glibc-devel-2.5(32 位)
* glibc-headers-2.5
* ksh-20060214
* libaio-0.3.106
* libaio-0.3.106(32 位)
* libaio-devel-0.3.106
* libaio-devel-0.3.106(32 位)
* libgcc-4.1.2
* libgcc-4.1.2(32 位)
* libstdc++-4.1.2
* libstdc++-4.1.2(32 位)
* libstdc++-devel 4.1.2
* make-3.81
* sysstat-7.0.2
* unixODBC-2.2.11
* unixODBC-2.2.11(32 位)
* unixODBC-devel-2.2.11
* unixODBC-devel-2.2.11(32 位)
挂载iso
[root@dbabc ~]# mount -o loop /u01/packages/linux_iso/RedHat 5.0_U4_64.iso /mnt/temp/
通过rpm -ivh进行安装需要的软件包
通常情况下会缺少如下几个安装包
[root@dbabc Server]# rpm -ivh elfutils-libelf-devel-*
warning: elfutils-libelf-devel-0.137-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing… ########################################### [100%]
package elfutils-libelf-devel-static-0.137-3.el5.x86_64 is already installed
package elfutils-libelf-devel-0.137-3.el5.x86_64 is already installed
[root@dbabc Server]# rpm -q –qf ‘%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})n’ binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++
glibc glibc-common glibc-devel glibc-headers ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel | grep not
package libaio-devel is not installed
package sysstat is not installed
package unixODBC is not installed
package unixODBC-devel is not installed
[root@dbabc Server]# rpm -ivh libaio-devel-0.3.106-3.2.*
warning: libaio-devel-0.3.106-3.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing… ########################################### [100%]
1:libaio-devel ########################################### [ 50%]
2:libaio-devel ########################################### [100%]
[root@dbabc Server]# rpm -ivh sysstat-7.0.2-3.el5.x86_64.rpm
warning: sysstat-7.0.2-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing… ########################################### [100%]
1:sysstat ########################################### [100%]
[root@dbabc Server]# rpm -ivh unixODBC-2.2.11-7.1.*
warning: unixODBC-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing… ########################################### [100%]
1:unixODBC ########################################### [ 50%]
2:unixODBC ########################################### [100%]
[root@dbabc Server]# rpm -ivh unixODBC-devel-2.2.11-7.1.*
warning: unixODBC-devel-2.2.11-7.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing… ########################################### [100%]
1:unixODBC-devel ########################################### [ 50%]
2:unixODBC-devel ########################################### [100%]
3、创建用户以及目录
/usr/sbin/groupadd -g 500 oinstall
/usr/sbin/groupadd -g 501 dba
/usr/sbin/groupadd -g 502 oper
/usr/sbin/groupadd -g 600 asmadmin
/usr/sbin/groupadd -g 601 asmoper
/usr/sbin/groupadd -g 602 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid
mkdir -p /u01/product/grid -p
mkdir -p /u01/product/db -p
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/product/db
chmod -R 775 /u01
passwd oracle
passwd grid
创建grid用户的登录脚本
在/home/grid/.bash_profile中添加一下信息
ORACLE_SID=+ASM; export ORACLE_SID
ORACLE_BASE=/u01/product; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/grid; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
PATH=$PATH:$HOME/bin
PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
创建Oracle用户的登录脚本
4、配置Linux服务器
配置内核参数
cat /etc/sysctl.conf <> /etc/security/limits.conf <> /etc/pam.d/login <> /etc/profile <<EOF
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF
5、安装并配置 ASMLib 2.0
根据操作系统获得安装包 http://www.oracle.com/technology/software/tech/linux/asmlib/rhel5.html
[root@dbabc asm]# uname -r
2.6.18-164.el5
[root@dbabc asm]# ll
total 252
-rw-r–r– 1 root root 136910 Sep 29 19:33 oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm
-rw-r–r– 1 root root 14176 Sep 29 19:33 oracleasmlib-2.0.4-1.el5.x86_64.rpm
-rw-r–r– 1 root root 90444 Sep 29 19:33 oracleasm-support-2.1.3-1.el5.x86_64.rpm
[root@dbabc asm]# rpm -ivh oracleasm-support-2.1.3-1.el5.x86_64.rpm
warning: oracleasm-support-2.1.3-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing… ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@dbabc asm]# rpm -ivh oracleasm-
oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm oracleasm-support-2.1.3-1.el5.x86_64.rpm
[root@dbabc asm]# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm
warning: oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing… ########################################### [100%]
1:oracleasm-2.6.18-164.el########################################### [100%]
[root@dbabc asm]# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing… ########################################### [100%]
1:oracleasmlib ########################################### [100%]
验证
[root@dbabc asm]# rpm -qa –queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})n"| grep oracleasm | sort
oracleasm-2.6.18-164.el5-2.0.5-1.el5 (x86_64)
oracleasmlib-2.0.4-1.el5 (x86_64)
oracleasm-support-2.1.3-1.el5 (x86_64)
配置 ASMLib
查看ASMlib配置
[root@dbabc ~]# oracleasm configure
ORACLEASM_ENABLED=false
ORACLEASM_UID=
ORACLEASM_GID=
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
配置ASMlib
[root@dbabc ~]# oracleasm configure -i
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 []: grid
Default group to own the driver interface []: asmadmin
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
该脚本完成以下任务:
* 创建 /etc/sysconfig/oracleasm 配置文件
* 创建 /dev/oracleasm 挂载点
* 挂载 ASMLib 驱动程序文件系统
注:ASMLib 驱动程序文件系统并非常规的文件系统。它只用于自动存储管理库与自动存储管理驱动程序的通讯。
加载 oracleasm 内核模块:
[root@dbabc ~]# /usr/sbin/oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module “oracleasm”: oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
为 Oracle 创建 ASM 磁盘
在创建ASM磁盘之前先看一下主机的磁盘情况
[root@dbabc ~]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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 5221 41833260 8e Linux LVM
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn’t contain a valid partition table
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn’t contain a valid partition table
Disk /dev/sdd: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn’t contain a valid partition table
其中sda 用来安装Linux操作系统了,sdb(2147M)、sdc(8589M)、sdd(10.7G)是新增加的磁盘,用来做asm磁盘
[root@dbabc ~]# fdisk /dev/sdb
Command (m for help): p
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 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-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261
Command (m for help): p
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 261 2096451 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@dbabc ~]# oracleasm createdisk crs /dev/sdb1
Writing disk header: done
Instantiating disk: done
同样把 sdc和sdd创建为fra和data磁盘组
查看asm磁盘
[root@dbabc ~]# oracleasm listdisks
CRS
DATA
FRA
6、安装Oracle 11g r2 Grid Infrastructure 软件
解压软件unzip linux.x64_11gR2_grid.zip
使用gird用户来安装Oracle 11g r2 Grid Infrastructure
进入grid目录运行./runInstaller
[root@dbabc grid]# ./runInstaller
选择[Install and Configure Grid Infrastructure for a Standalone Server]–>Next–>【添加语言】–>Next[]剩下的图形界面就简单了,暂到这里