OracleVirtualBox 安装 11gR2RAC
第 1 页
Oracle VirtualBox 安装 11gR2RAC
日期 作者 版本号 变更参考文件
2011-05-17 Arthur.jin @126.com V1.0
OracleVirtualBox 安装 Oracle 11gR2 RAC
总体架构........................................................................................................................................... 2
1、 运行环境 ........................................................................................................................... 3
1.1、相关软件 .......................................................................................................................... 3
2、VirtualBox 配置第一个虚拟机 rac1 ........................................................................................... 4
2.1、新建一个 Oracle Linux 虚拟机 ........................................................................................ 4
2.2、配置 Oracle Linux 的网络设备 ........................................................................................ 8
2.3、安装 Oracle Linux 操作系统 ............................................................................................ 9
2.4、VirtualBox Oracle Linux 安装增强功能 ......................................................................... 12
2.5、配置 Oracle Linux 操作系统参数 .................................................................................. 13
2.5.1、配置共享内存文件系统 ..................................................................................... 13
2.5.2、配置 Host 文件 ................................................................................................... 14
2.5.3、配置 Linux 内核参数 .......................................................................................... 14
2.5.4、检查、安装必需软件包 ..................................................................................... 15
3、创建共享磁盘 ........................................................................................................................... 17
3.1、目标文件结构 ................................................................................................................ 17
3.2、创建磁盘 ........................................................................................................................ 17
3.3、连接虚拟机 .................................................................................................................... 18
3.4、设置共享 ........................................................................................................................ 19
3.5、检视虚拟机 .................................................................................................................... 19
4、虚拟机 rac1 中配置共享磁盘 .................................................................................................. 20
4.1、检视磁盘 ........................................................................................................................ 20
4.2、磁盘分区 ........................................................................................................................ 20
4.3、配置 ASM ....................................................................................................................... 21
5、VirtualBox Clone 第二个虚拟机 rac2 ....................................................................................... 23
5.1、文件结构 ........................................................................................................................ 23
5.2、执行 Clone ..................................................................................................................... 23
5.3、VirtualBox 新建 rac2 ...................................................................................................... 24
5.4、共享磁盘连接 rac2 ........................................................................................................ 24
5.5、VirtualBox 配置 rac2 的网络设备 ................................................................................. 25
5.6、虚拟机 rac2 中配置网络 ............................................................................................... 25
5.7、修改 rac2 中 oracle 用户 profile ................................................................................... 26
5.8、测试网络 ........................................................................................................................ 26
5.9、rac2 测试 ASMLib .......................................................................................................... 26
OracleVirtualBox 安装 11gR2RAC
第 2 页
6、安装 Grid Infrastructure ........................................................................................................... 27
7、安装 Oracle DB11gR2 ............................................................................................................... 32
8、验证 RAC ................................................................................................................................... 41
9、附 .............................................................................................................................................. 42
总体架构
OracleVirtualBox 安装 11gR2RAC
第 3 页
1、 运行环境
本实验以单台机器作为 Host 上,配置两个 Guest 虚拟机,安装 Oracle Grid Infrastructure
(Clusterware + ASM),运行两个数据库实例。
作为 Host 的主机,建议配置空闲 8G 内存、60G 硬盘空间,低于上述配置会很慢。
单台 Guest 虚机,建议配置 2G 内存以上(Oracle 11.2.0.2 建议 3G 内存)。
由于仅作为验证环境,而非生产系统,所以配置 SCAN 时,使用 hosts 文件,而非 DNS。
1.1、相关软件
Oracle Linux 5.5
Oracle VM VirtualBox - VirtualBox-4.0.8-71778-Win.exe
Oracle Database 11g Release 2 (11.2.0.1.0) for Linux x86
linux_11gR2_database_1of2.zip
linux_11gR2_database_2of2.zip
OracleVirtualBox 安装 11gR2RAC
第 4 页
linux_11gR2_grid.zip
oracleasmlib-2.0.4-1.el5.x86_64.rpm
2、VirtualBox 配置第一个虚拟机 rac1
2.1、新建一个 Oracle Linux 虚拟机
点“新建”
内存配置为 1280M
OracleVirtualBox 安装 11gR2RAC
第 5 页
下一步
下一步
OracleVirtualBox 安装 11gR2RAC
第 6 页
下一步
指定 rac1 虚拟机文件的路径,并配置大小,我配置为 20G
OracleVirtualBox 安装 11gR2RAC
第 7 页
下一步
点“完成”
OracleVirtualBox 安装 11gR2RAC
第 8 页
2.2、配置 Oracle Linux 的网络设备
点“设置”
配置两个网络设备
OracleVirtualBox 安装 11gR2RAC
第 9 页
2.3、安装 Oracle Linux 操作系统
OracleVirtualBox 安装 11gR2RAC
第 10 页
修改主机名
hostname: rac1.localdomain
IP Address eth0: 192.168.2.101 (public address)
Default Gateway eth0: 192.168.2.1 (public address)
IP Address eth1: 192.168.0.101 (private address)
Default Gateway eth1: none
配置主机名:rac1.localdomain
OracleVirtualBox 安装 11gR2RAC
第 11 页
按照下图,安装相关软件包
取消防火墙
OracleVirtualBox 安装 11gR2RAC
第 12 页
禁止 SELinux
2.4、VirtualBox Oracle Linux 安装增强功能
安装增强功能
OracleVirtualBox 安装 11gR2RAC
第 13 页
/etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Enterprise Linux (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
divider=10
initrd /initrd-2.6.18-194.el5.img
2.5、配置 Oracle Linux 操作系统参数
2.5.1、配置共享内存文件系统
# umount tmpfs
# mount -t tmpfs shmfs -o size=1500m /dev/shm
修改“/etc/fstab”
tmpfs /dev/shm tmpfs size=1500m 0 0
OracleVirtualBox 安装 11gR2RAC
第 14 页
2.5.2、配置 Host 文件
127.0.0.1 localhost.localdomain localhost
# Public
192.168.2.101 rac1.localdomain rac1
192.168.2.102 rac2.localdomain rac2
# Private
192.168.20.101 rac1-priv.localdomain rac1-priv
192.168.20.102 rac2-priv.localdomain rac2-priv
# Virtual
192.168.2.111 rac1-vip.localdomain rac1-vip
192.168.2.112 rac2-vip.localdomain rac2-vip
# SCAN
192.168.2.201 rac-scan.localdomain rac-scan
2.5.3、配置 Linux 内核参数
/etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1054504960
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586
执行
#/sbin/sysctl –p
修改/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
修改/etc/pam.d/login
session required pam_limits.so
禁止网络时间服务
# service ntpd stop
Shutting down ntpd: [ OK ]
OracleVirtualBox 安装 11gR2RAC
第 15 页
# chkconfig ntpd off
# mv /etc/ntp.conf /etc/ntp.conf.orig
# rm /var/run/ntpd.pid
创建用户、组和文件路径
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01/
修改 oracle 用户的.bash_profile
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=rac1.localdomain; export ORACLE_HOSTNAME
ORACLE_UNQNAME=RAC; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=RAC1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
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
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
2.5.4、检查、安装必需软件包
2.5.4.1、安装介质安装必须的软件包
rpm -Uvh binutils-2.*
rpm -Uvh compat-libstdc++-33*
OracleVirtualBox 安装 11gR2RAC
第 16 页
rpm -Uvh elfutils-libelf-0.*
rpm -Uvh elfutils-libelf-devel-*
rpm -Uvh gcc-4.*
rpm -Uvh gcc-c++-4.*
rpm -Uvh glibc-2.*
rpm -Uvh glibc-common-2.*
rpm -Uvh glibc-devel-2.*
rpm -Uvh glibc-headers-2.*
rpm -Uvh ksh-2*
rpm -Uvh libaio-0.*
rpm -Uvh libaio-devel-0.*
rpm -Uvh libgcc-4.*
rpm -Uvh libstdc++-4.*
rpm -Uvh libstdc++-devel-4.*
rpm -Uvh make-3.*
rpm -Uvh sysstat-7.*
rpm -Uvh unixODBC-2.*
rpm -Uvh unixODBC-devel-2.*
2.5.4.2、Grid 介质安装 rpm
2.5.4.3、下载 ASMLib 介质安装 rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm
oracleasm-support-2.1.3-1.el5.x86_64.rpm
oracleasm-2.6.18-164.el5-2.0.5-1.el5.x86_64.rpm
OracleVirtualBox 安装 11gR2RAC
第 17 页
3、创建共享磁盘
3.1、目标文件结构
3.2、创建磁盘
01.create.bat
D:\Oracle\VirtualBox406\VBoxManage.exe createhd -filename asm1.vdi -size 5120 -format VDI
-variant Fixed
D:\Oracle\VirtualBox406\VBoxManage.exe createhd -filename asm2.vdi -size 5120 -format VDI
-variant Fixed
D:\Oracle\VirtualBox406\VBoxManage.exe createhd -filename asm3.vdi -size 5120 -format VDI
-variant Fixed
D:\Oracle\VirtualBox406\VBoxManage.exe createhd -filename asm4.vdi -size 5120 -format VDI
-variant Fixed
D:\Oracle\VirtualBox406\VBoxManage.exe createhd -filename asm5.vdi -size 5120 -format VDI
-variant Fixed
OracleVirtualBox 安装 11gR2RAC
第 18 页
3.3、连接虚拟机
02.attach rac1.bat
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac1 --storagectl "SATA 控制器" --port
1 --device 0 --type hdd --medium asm1.vdi --mtype shareable
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac1 --storagectl "SATA 控制器" --port
2 --device 0 --type hdd --medium asm2.vdi --mtype shareable
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac1 --storagectl "SATA 控制器" --port
3 --device 0 --type hdd --medium asm3.vdi --mtype shareable
OracleVirtualBox 安装 11gR2RAC
第 19 页
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac1 --storagectl "SATA 控制器" --port
4 --device 0 --type hdd --medium asm4.vdi --mtype shareable
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac1 --storagectl "SATA 控制器" --port
5 --device 0 --type hdd --medium asm5.vdi --mtype shareable
3.4、设置共享
03.share.bat
D:\Oracle\VirtualBox406\VBoxManage.exe modifyhd asm1.vdi --type shareable
D:\Oracle\VirtualBox406\VBoxManage.exe modifyhd asm2.vdi --type shareable
D:\Oracle\VirtualBox406\VBoxManage.exe modifyhd asm3.vdi --type shareable
D:\Oracle\VirtualBox406\VBoxManage.exe modifyhd asm4.vdi --type shareable
D:\Oracle\VirtualBox406\VBoxManage.exe modifyhd asm5.vdi --type shareable
3.5、检视虚拟机
OracleVirtualBox 安装 11gR2RAC
第 20 页
4、虚拟机 rac1 中配置共享磁盘
4.1、检视磁盘
# cd /dev
# ls sd*
4.2、磁盘分区
# fdisk /dev/sdb
OracleVirtualBox 安装 11gR2RAC
第 21 页
4.3、配置 ASM
# oracleasm configure -i
# /usr/sbin/oracleasm init
创建共享盘
OracleVirtualBox 安装 11gR2RAC
第 22 页
# /usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
重复 sdc1, sdd1, sde1, sdf1
#/usr/sbin/oracleasm scandisks
#/usr/sbin/oracleasm listdisks
Root 用户能够得到这个结果,oracle 用户执行 listdisks 也应得到此结果。如果后面的 rac2
配置完成,rac2 上的 oracle 用户同样应得的相同结果,就说明 ASMLib 配置成功。
OracleVirtualBox 安装 11gR2RAC
第 23 页
5、VirtualBox Clone 第二个虚拟机 rac2
5.1、文件结构
5.2、执行 Clone
01.clone.bat
D:\Oracle\VirtualBox406\VBoxManage.exe clonehd D:\Oracle\VirtualBoxVM\rac1\rac1.vdi
D:\Oracle\VirtualBoxVM\rac2\rac2.vdi
OracleVirtualBox 安装 11gR2RAC
第 24 页
5.3、VirtualBox 新建 rac2
5.4、共享磁盘连接 rac2
04.attach rac2.bat
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac2 --storagectl "SATA 控制器" --port
1 --device 0 --type hdd --medium asm1.vdi --mtype shareable
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac2 --storagectl "SATA 控制器" --port
2 --device 0 --type hdd --medium asm2.vdi --mtype shareable
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac2 --storagectl "SATA 控制器" --port
3 --device 0 --type hdd --medium asm3.vdi --mtype shareable
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac2 --storagectl "SATA 控制器" --port
4 --device 0 --type hdd --medium asm4.vdi --mtype shareable
D:\Oracle\VirtualBox406\VBoxManage.exe storageattach rac2 --storagectl "SATA 控制器" --port
5 --device 0 --type hdd --medium asm5.vdi --mtype shareable
OracleVirtualBox 安装 11gR2RAC
第 25 页
5.5、VirtualBox 配置 rac2 的网络设备
5.6、虚拟机 rac2 中配置网络
Eth0: 192.168.2.102
OracleVirtualBox 安装 11gR2RAC
第 26 页
Eth1: 192.168.20.102
5.7、修改 rac2 中 oracle 用户 profile
$vi .bash_profile
ORACLE_SID=RAC2; export ORACLE_SID
ORACLE_HOSTNAME=rac2.localdomain; export ORACLE_HOSTNAME
5.8、测试网络
ping -c 3 rac1
ping -c 3 rac1-priv
ping -c 3 rac2
ping -c 3 rac2-priv
5.9、rac2 测试 ASMLib
$oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
DISK5
$
说明 rac2 使用 ASM 正常。
OracleVirtualBox 安装 11gR2RAC
第 27 页
6、安装 Grid Infrastructure
选择安装 Grid 基础架构
选择常规方式安装
添加一个 rac 节点:rac2.localdomain,rac2-vip.localdomain
OracleVirtualBox 安装 11gR2RAC
第 28 页
无需手动创建 SSH 无密码连接,直接点击”Setup”按钮即可自主创建 SSH 连接。
SCAN Name:改为 rac-scan——hosts 文件已有定义。点下一步
选择 Grid 的安装路径,选择自动存储管理,确定 ASM 的密码
OracleVirtualBox 安装 11gR2RAC
第 29 页
选择外部,如图选中所有磁盘
按默认,点下一步
如有错误,要么修正错误,要么选择忽略
OracleVirtualBox 安装 11gR2RAC
第 30 页
忽略全部,点下一步
按照提示在 rac1,rac2 上执行脚本:
OracleVirtualBox 安装 11gR2RAC
第 31 页
成功后点击 OK
此处出现如下提示
OracleVirtualBox 安装 11gR2RAC
第 32 页
可能是由于没有使用 DNS,忽略过去,结束,安装完成。
7、安装 Oracle DB11gR2
在节点 rac1 执行数据库的安装程序
取消这个 CheckBox
OracleVirtualBox 安装 11gR2RAC
第 33 页
创建和配置数据库
选择服务器类型
OracleVirtualBox 安装 11gR2RAC
第 34 页
OracleVirtualBox 安装 11gR2RAC
第 35 页
填写 ASM 口令,全局数据库名称改为:RAC.localdomain
下一步
OracleVirtualBox 安装 11gR2RAC
第 36 页
点结束,然后是漫长的等待
自动执行 DBCA
OracleVirtualBox 安装 11gR2RAC
第 37 页
OracleVirtualBox 安装 11gR2RAC
第 38 页
OracleVirtualBox 安装 11gR2RAC
第 39 页
OracleVirtualBox 安装 11gR2RAC
第 40 页
OracleVirtualBox 安装 11gR2RAC
第 41 页
8、验证 RAC
$ srvctl config database -d RAC
SQL Developer 配置连接通过 VIP 连接
OracleVirtualBox 安装 11gR2RAC
第 42 页
9、附
本文参考《Oracle Database 11g Release 2 RAC On Linux Using VirtualBox》完成。
本文档为【Oracle+VirtualBox+安装+Oracle+11gR2+RAC】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。