MACVmwareFusion+OracleLinux+Oracle11gRAC

本文献给刚刚使用mac系统,并且正在学习怎样在虚拟机下安装oracle rac的同学。 大量的截图花费了我好多时间,希望能为您带来帮助!

环境介绍:
主机操作系统:OS X 10.9.4
虚拟机软件:VMware Fusion 专业版6.0.3
虚拟机系统:Oracle Linux 5.7
数据库版本:Oracle 11g R2 11.2.0.3

如果您也使用笔记本安装虚拟机运行Oracle,并且希望在家里或者公司无线网络不是同一个网段都能使用的同学,将虚拟网卡设置host only的方式会减少很多切换的麻烦。如果您不知道虚拟网卡是什么,参考本文做就可以了。

启动Fusion虚拟机后在终端中输入ifconfi查看虚拟网卡
ifconfig
vmnet1: flags=8863 mtu 1500
ether 00:50:56:c0:00:01
inet 172.16.228.1 netmask 0xffffff00 broadcast 172.16.228.255
vmnet8: flags=8863 mtu 1500
ether 00:50:56:c0:00:08
inet 172.16.150.1 netmask 0xffffff00 broadcast 172.16.150.255

其中vmnet1为host only模式,我们的虚拟机public IP、vip、scanip要设置该网段内。如果不启动Fusion软件的话不会输出以上信息。

配置虚拟机资源


MAC Vmware Fusion+OracleLinux+Oracle11gRAC
     MAC Vmware Fusion+OracleLinux+Oracle11gRAC
              更多选项...
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
        创建自定义虚拟机
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
   RAC1、RAC2、rawdisks目录需要自己手工创建,名称随意
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
        加载OracleLinux操作系统的iso文件 - 连接CD/DVD

       MAC Vmware Fusion+OracleLinux+Oracle11gRAC
MAC Vmware Fusion+OracleLinux+Oracle11gRAC      MAC Vmware Fusion+OracleLinux+Oracle11gRAC

       安装操作系统


MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
为rac1主添加第二块网卡
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
将网络适配器、网络适配器2都设置为“仅宿主机模式”,也就是host only方式。注意:如果您的网络环境不会经常变化,不会切换网段可以将第一块网络适配器设置为“桥接模式”

MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC

       启动虚拟机安装操作系统
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
       注意:为了快速部署安装,此处省略了划分磁盘的步骤


MAC Vmware Fusion+OracleLinux+Oracle11gRAC
        etho为public IP,和虚拟网卡一个网段172.16.228.x
        eth0为privateIP,IP地址自定义
        禁用IPv6设置
        Gateway设置为虚拟网卡地址,方便使用
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
    冰城哈尔滨Asia/Harbin
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
       此处不选择任何项目,后面会采用更好的方法来补充安装所需的包yum install oracle-validated
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
       测试环境关闭防火墙
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
       测试环境关闭SELinux
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
       此处不创建用户,在后面统一创建用户
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
克隆虚拟机

退出当前虚拟机的光盘 - 创建完整克隆
采用克隆的方法可以大大缩短创建第二台虚拟机的时间

MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
        克隆路径为RAC2
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
        RAC2克隆完成
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
        修改rac2主机名、IP地址
        由于rac2是克隆主机,所以主机名和IP地址需要手工改动
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
创建共享磁盘
rac1主机上添加新硬盘
ocr_vote_disk
ocr_vote_disk2
ocr_vote_disk3
data_disk1
data_disk2
data_disk3
data_disk4
arch_disk
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
       “预先非配磁盘空间”必须勾选,这是共享磁盘的必要条件之一
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
          在rac2主机创建新磁盘
                只需要共享刚刚由rac1主机创建好的磁盘就可以了
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
        与创建此虚拟磁盘的虚拟机共享此虚拟磁盘
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
       创建完成后,rac1、rac2的主机配置
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
   使用FTP工具上传安装介质到rac1主机

     设置rac1、rac2 /etc/hosts文件

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6

172.16.228.101 rac1
172.16.228.201 rac1-vip

172.16.228.102 rac2
172.16.228.202 rac2-vip

172.16.228.91  cluster-scan
172.16.228.92  cluster-scan
172.16.228.93  cluster-scan

182.168.1.101  rac1-priv
182.168.1.102  rac2-priv

创建用户和组
[root@rac1 ~]# groupadd -g 5000 asmadmin
[root@rac1 ~]# groupadd -g 5001 asmdba
[root@rac1 ~]# groupadd -g 5002 asmoper
[root@rac1 ~]# groupadd -g 6000 oinstall
[root@rac1 ~]# groupadd -g 6001 dba
[root@rac1 ~]# groupadd -g 6002 oper

[root@rac1 ~]# useradd -g oinstall -G asmadmin,asmdba,asmoper grid
[root@rac1 ~]# echo "grid"|passwd --stdin grid

[root@rac1 ~]# useradd -g oinstall -G dba,asmdba oracle
[root@rac1 ~]# echo "oracle"|passwd --stdin oracle

创建目录
[root@rac1 ~]# mkdir /grid_base
[root@rac1 ~]# mkdir /grid_home
[root@rac1 ~]# chown grid:oinstall /grid_base
[root@rac1 ~]# chown grid:oinstall /grid_home
[root@rac1 ~]# mkdir /oracle
[root@rac1 ~]# chown oracle:oinstall /oracle

关闭ntpd
[root@rac1 ~]# chkconfig ntpd off
[root@rac1 ~]# mv /etc/ntp.conf /etc/ntp.conf.bak

挂载光盘
[root@rac1 ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only

安装操作系统所需的各种包
注意:该操作比图形化安装系统依赖包更加方便。
echo "[oel5]

name = Enterprise Linux 5.7 DVD

baseurl=file:///mnt/Server/

gpgcheck=0

enabled=1" >> /etc/yum.repos.d/public-yum-el5.repo

[root@rac1 ~]# yum install oracle-validated

补充grid用户的配置
echo "grid   soft   nofile    131072
grid   hard   nofile    131072

grid   soft   nproc    131072

grid   hard   nproc    131072

grid   soft   core    unlimited

grid   hard   core    unlimited

grid   soft   memlock    50000000

grid   hard   hemlock    50000000" >> /etc/security/limits.conf

关闭rac1、rac2主机
[root@rac1 ~]# init 0
[root@rac2 ~]# init 0

解除VMware Fusion不支持共享磁盘的限制

找到RAC1安装路径下的虚拟机文件rac1,右键点击rac1,选择”显示包内容”
用文本工具打开rac1.vmx,添加下面的配置信息
#shared disks configure
disk.locking="false"
diskLib.dataCacheMaxSize="0"
diskLib.dataCacheMaxReadAheadSize="0"
diskLib.DataCacheMinReadAheadSize="0"
diskLib.dataCachePageSize="4096"
diskLib.maxUnsyncedWrites="0"
scsi0:1.deviceType="disk"
scsi0:1.mode = "independent-persistent"
scsi0.sharedBus = “VIRTUAL"

同样在RAC2路径下找到rac2文件执行相同的操作
#shared disks configure
disk.locking="false"
diskLib.dataCacheMaxSize="0"
diskLib.dataCacheMaxReadAheadSize="0"
diskLib.DataCacheMinReadAheadSize="0"
diskLib.dataCachePageSize="4096"
diskLib.maxUnsyncedWrites="0"
scsi0:1.deviceType="disk"
scsi0:1.mode = "independent-persistent"
scsi0.sharedBus = “VIRTUAL"


重新启动rac1、rac2

查看共享磁盘
[root@rac1 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8,   0 Sep 11 22:52 /dev/sda
brw-r----- 1 root disk 8,   1 Sep 11 22:53 /dev/sda1
brw-r----- 1 root disk 8,   2 Sep 11 22:52 /dev/sda2
brw-r----- 1 root disk 8,  16 Sep 11 22:52 /dev/sdb
brw-r----- 1 root disk 8,  32 Sep 11 22:52 /dev/sdc
brw-r----- 1 root disk 8,  48 Sep 11 22:52 /dev/sdd
brw-r----- 1 root disk 8,  64 Sep 11 22:52 /dev/sde
brw-r----- 1 root disk 8,  80 Sep 11 22:52 /dev/sdf
brw-r----- 1 root disk 8,  96 Sep 11 22:52 /dev/sdg
brw-r----- 1 root disk 8, 112 Sep 11 22:52 /dev/sdh
brw-r----- 1 root disk 8, 128 Sep 11 22:52 /dev/sdi

udev配置共享磁盘
for i in b c d e f g h i ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""  >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done

[root@rac1 ~]# start_udev
Starting udev: [  OK  ]

查看配置结果
[root@rac1 ~]# ls -l /dev/asm*
brw-rw---- 1grid asmadmin 8,  16 Sep 11 23:08 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8,  32 Sep 11 23:08 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8,  48 Sep 11 23:08 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8,  64 Sep 11 23:08 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8,  80 Sep 11 23:08 /dev/asm-diskf
brw-rw---- 1 grid asmadmin 8,  96 Sep 11 23:08 /dev/asm-diskg
brw-rw---- 1 grid asmadmin 8, 112 Sep 11 23:08 /dev/asm-diskh
brw-rw---- 1 grid asmadmin 8, 128 Sep 11 23:08 /dev/asm-diski

配置rac2主机的udev
[root@rac1 ~]# scp /etc/udev/rules.d/99-oracle-asmdevices.rules rac2:/etc/udev/rules.d/99-oracle-asmdevices.rules

[root@rac2 ~]# start_udev
Starting udev: [  OK  ]
[root@rac2 ~]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8,  48 Sep 11 23:10 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8,  32 Sep 11 23:10 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8,  16 Sep 11 23:10 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8, 112 Sep 11 23:10 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8,  96 Sep 11 23:10 /dev/asm-diskf
brw-rw---- 1 grid asmadmin 8,  80 Sep 11 23:10 /dev/asm-diskg
brw-rw---- 1 grid asmadmin 8,  64 Sep 11 23:10 /dev/asm-diskh
brw-rw---- 1 grid asmadmin 8, 128 Sep 11 23:10 /dev/asm-diski

配置grid用户bash_pofile
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ vi .bash_profile

CRS_HOME=/grid_home/11.2.0/grid
ORACLE_BASE=/grid_base
ORACLE_SID=+ASM1
stty erase ^h
alias s="sqlplus / as sysasm"
PATH=$CRS_HOME/bin:$PATH:$HOME/bin

[grid@rac1 ~]$ scp .bash_profile rac2:~/

[root@rac2 ~]# su - grid
[grid@rac2 ~]$ vi .bash_profile
CRS_HOME=/grid_home/11.2.0/grid
ORACLE_BASE=/grid_base
ORACLE_SID=+ASM2
stty erase ^h
alias s="sqlplus / as sysasm"
PATH=$CRS_HOME/bin:$PATH:$HOME/bin
export PATH CRS_HOME ORACLE_BASE ORACLE_SID


解压缩集群软件安装包
[grid@rac1 ~]$ cd /grid_base
[grid@rac1 grid_base]$ mkdir 11203_grid_install
[grid@rac1 grid_base]$ cd 11203_grid_install/
[grid@rac1 11203_grid_install]$ unzip /tmp/p10404530_112030_Linux-x86-64_3of7.zip

MAC Vmware Fusion+OracleLinux+Oracle11gRAC
启动工具Xquartz
Xquartz在启动图形安装时不需要export DISPLAY
连接grid用户
ssh -X grid@172.16.228.101
/grid_base/11203_grid_install/grid/runInstaller
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
MAC Vmware Fusion+OracleLinux+Oracle11gRAC

    推荐使用图形化SSH互信,省去很多手工配置的时间

MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
  grid的base目录和home目录要分开
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC

  Task.resolv.conf Integrity错误可以忽略,不影响安装
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC

顺序执行以下脚本,执行完毕点击ok
[root@rac1 ~]# /grid_home/oraInventory/orainstRoot.sh
[root@rac2 ~]# /grid_home/oraInventory/orainstRoot.sh
[root@rac1 ~]# /grid_home/11.2.0/grid/root.sh
[root@rac2 ~]# /grid_home/11.2.0/grid/root.sh
 
   以下错误提示不影响安装
MAC Vmware Fusion+OracleLinux+Oracle11gRAC

安装ASM磁盘组

在Xquartz输入asmca后配置如下
OCRVOTE:
ocr_vote_disk
ocr_vote_disk2
ocr_vote_disk3

DATA:
data_disk1
data_disk2
data_disk3
data_disk4

ARCH:
arch_disk

MAC Vmware Fusion+OracleLinux+Oracle11gRAC

设置Oracle用户bash_profile
[oracle@rac1 ~]$ vi .bash_profile
ORACLE_BASE=/oracle
ORACLE_HOME=/oracle/product/11.2.0/dbhome_1
ORACLE_SID=PROD1
PATH=$ORACLE_HOME/OPatch:$ORACLE_HOME/bin:$PATH:$HOME/bin
export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID

[oracle@rac2 ~]$ vi .bash_profile
ORACLE_BASE=/oracle
ORACLE_HOME=/oracle/product/11.2.0/dbhome_1
ORACLE_SID=PROD2
PATH=$ORACLE_HOME/OPatch:$ORACLE_HOME/bin:$PATH:$HOME/bin
export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID

su - oracle
cd /oracle
mkdir 11203_db_install
cd 11203_db_install
unzip /tmp/p10404530_112030_Linux-x86-64_1of7.zip
unzip /tmp/p10404530_112030_Linux-x86-64_2of7.zip

安装数据库软件
重新开启XQuartz,使用oracle用户连接
ssh -X oracle@172.16.228.101
/oracle/11203_db_install/database/runInstaller
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC

  推荐使用SSH互信安装,省去手工配置的过程
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
  此处的验证错误可以忽略,不影响安装
MAC Vmware Fusion+OracleLinux+Oracle11gRAC
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC
按照提示执行脚本
[root@rac1 ~]# /oracle/product/11.2.0/dbhome_1/root.sh
[root@rac2 ~]# /oracle/product/11.2.0/dbhome_1/root.sh

MAC Vmware Fusion+OracleLinux+Oracle11gRAC

创建数据库
  集群数据库
MAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRACMAC Vmware Fusion+OracleLinux+Oracle11gRAC

数据库安装成功!

SQL> select INST_ID,INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,STATUS,THREAD# from gv$instance;

   INST_ID INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME  STATUS          THREAD#
---------- --------------- ---------------- ---------- ------------ ----------
         1               1 PROD1            rac1       OPEN                  1
         2               2 PROD2            rac2       OPEN                  2

网页题目:MACVmwareFusion+OracleLinux+Oracle11gRAC
标题路径:http://myzitong.com/article/jpsosi.html