本文献给刚刚使用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软件的话不会输出以上信息。
配置虚拟机资源
更多选项...
创建自定义虚拟机
RAC1、RAC2、rawdisks目录需要自己手工创建,名称随意
加载OracleLinux操作系统的iso文件 - 连接CD/DVD
安装操作系统
为rac1主添加第二块网卡
将网络适配器、网络适配器2都设置为“仅宿主机模式”,也就是host only方式。 注意:如果您的网络环境不会经常变化,不会切换网段可以将第一块网络适配器设置为“桥接模式”
启动虚拟机安装操作系统
注意:为了快速部署安装,此处省略了划分磁盘的步骤
etho为public IP,和虚拟网卡一个网段172.16.228.x
eth0为privateIP,IP地址自定义
禁用IPv6设置
Gateway设置为虚拟网卡地址,方便使用
冰城哈尔滨Asia/Harbin
此处不选择任何项目,后面会采用更好的方法来补充安装所需的包 yum install oracle-validated
测试环境关闭防火墙
测试环境关闭SELinux
此处不创建用户,在后面统一创建用户
克隆虚拟机
退出当前虚拟机的光盘 - 创建完整克隆
采用克隆的方法可以大大缩短创建第二台虚拟机的时间
克隆路径为RAC2
RAC2克隆完成
修改rac2主机名、IP地址
由于rac2是克隆主机,所以主机名和IP地址需要手工改动
创建共享磁盘
rac1主机上添加新硬盘
ocr_vote_disk
ocr_vote_disk2
ocr_vote_disk3
data_disk1
data_disk2
data_disk3
data_disk4
arch_disk
“预先非配磁盘空间”必须勾选,这是共享磁盘的必要条件之一
在rac2主机创建新磁盘
只需要共享刚刚由rac1主机创建好的磁盘就可以了
与创建此虚拟磁盘的虚拟机共享此虚拟磁盘
创建完成后,rac1、rac2的主机配置
使用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---- 1 grid 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
启动工具Xquartz
Xquartz在启动图形安装时不需要export DISPLAY
连接grid用户
ssh -X grid@172.16.228.101
/grid_base/11203_grid_install/grid/runInstaller
grid的base目录和home目录要分开
Task.resolv.conf Integrity错误可以忽略,不影响安装
以下错误提示不影响安装
安装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
设置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
推荐使用SSH互信安装,省去手工配置的过程
此处的验证错误可以忽略,不影响安装
创建数据库
集群数据库
数据库安装成功!
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
环境介绍:
主机操作系统: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软件的话不会输出以上信息。
配置虚拟机资源
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540504gj1J.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540505oKXB.png?x-oss-process=style/bb)
更多选项...
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540510tJ37.png?x-oss-process=style/bb)
创建自定义虚拟机
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540513nIRr.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540518OLul.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540522m13s.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540526Mzu9.png?x-oss-process=style/bb)
RAC1、RAC2、rawdisks目录需要自己手工创建,名称随意
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540532F6u6.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105405366g35.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540541yC07.png?x-oss-process=style/bb)
加载OracleLinux操作系统的iso文件 - 连接CD/DVD
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_141054054224oD.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540546AfZE.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540547j22V.png?x-oss-process=style/bb)
安装操作系统
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540550eX6g.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_141054055337K7.png?x-oss-process=style/bb)
为rac1主添加第二块网卡
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540557AzEz.png?x-oss-process=style/bb)
将网络适配器、网络适配器2都设置为“仅宿主机模式”,也就是host only方式。 注意:如果您的网络环境不会经常变化,不会切换网段可以将第一块网络适配器设置为“桥接模式”
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540558bDNJ.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105405591Hb1.png?x-oss-process=style/bb)
启动虚拟机安装操作系统
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540563ya0x.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540801ZPWt.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105408066V9x.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540811pnLp.png?x-oss-process=style/bb)
注意:为了快速部署安装,此处省略了划分磁盘的步骤
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105408194Nc4.png?x-oss-process=style/bb)
etho为public IP,和虚拟网卡一个网段172.16.228.x
eth0为privateIP,IP地址自定义
禁用IPv6设置
Gateway设置为虚拟网卡地址,方便使用
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541234Ve8H.png?x-oss-process=style/bb)
冰城哈尔滨Asia/Harbin
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540834AXIl.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540838XG7x.png?x-oss-process=style/bb)
此处不选择任何项目,后面会采用更好的方法来补充安装所需的包 yum install oracle-validated
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540842kIDd.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540847k5Rl.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540850b2AO.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540855JJx4.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105408658e3o.png?x-oss-process=style/bb)
测试环境关闭防火墙
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540869axYS.png?x-oss-process=style/bb)
测试环境关闭SELinux
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105408742tjI.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540879WY00.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540883Kh63.png?x-oss-process=style/bb)
此处不创建用户,在后面统一创建用户
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410540888Js19.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541225xWx1.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541229gQQv.png?x-oss-process=style/bb)
克隆虚拟机
退出当前虚拟机的光盘 - 创建完整克隆
采用克隆的方法可以大大缩短创建第二台虚拟机的时间
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541235AvVR.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541237teCU.png?x-oss-process=style/bb)
克隆路径为RAC2
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541243ttZF.png?x-oss-process=style/bb)
RAC2克隆完成
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541249WQ8A.png?x-oss-process=style/bb)
修改rac2主机名、IP地址
由于rac2是克隆主机,所以主机名和IP地址需要手工改动
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541255yJjv.png?x-oss-process=style/bb)
创建共享磁盘
rac1主机上添加新硬盘
ocr_vote_disk
ocr_vote_disk2
ocr_vote_disk3
data_disk1
data_disk2
data_disk3
data_disk4
arch_disk
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105412588cJ4.png?x-oss-process=style/bb)
“预先非配磁盘空间”必须勾选,这是共享磁盘的必要条件之一
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541261Pw81.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541264I9uh.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105412684EKE.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541271p1it.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541274ZVvZ.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541277FinE.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541281TCF6.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541285S1dE.png?x-oss-process=style/bb)
在rac2主机创建新磁盘
只需要共享刚刚由rac1主机创建好的磁盘就可以了
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541288FJZF.png?x-oss-process=style/bb)
与创建此虚拟磁盘的虚拟机共享此虚拟磁盘
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541293WVJl.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105412972Ea5.png?x-oss-process=style/bb)
创建完成后,rac1、rac2的主机配置
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541367fSmD.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541372npXp.png?x-oss-process=style/bb)
使用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---- 1 grid 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
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410543920IKjO.png?x-oss-process=style/bb)
启动工具Xquartz
Xquartz在启动图形安装时不需要export DISPLAY
连接grid用户
ssh -X grid@172.16.228.101
/grid_base/11203_grid_install/grid/runInstaller
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541373hq56.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105413758AzN.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105413773uuh.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541379l2O3.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541381BB2b.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541383eiKE.png?x-oss-process=style/bb)
推荐使用图形化SSH互信,省去很多手工配置的时间
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541386Omhb.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541388MI2i.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541390OiX1.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105413932m92.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_141054139549vX.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105413972o9C.png?x-oss-process=style/bb)
grid的base目录和home目录要分开
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105414014EJE.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541403Xugl.png?x-oss-process=style/bb)
Task.resolv.conf Integrity错误可以忽略,不影响安装
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541405GKLK.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541408y2dU.png?x-oss-process=style/bb)
顺序执行以下脚本,执行完毕点击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 |
以下错误提示不影响安装
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541795zW1q.png?x-oss-process=style/bb)
安装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
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541797T76O.png?x-oss-process=style/bb)
设置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
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541798m9Fh.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105417992Qu8.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541801O3tl.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541803y5Iq.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541805OQKt.png?x-oss-process=style/bb)
推荐使用SSH互信安装,省去手工配置的过程
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541807a02a.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541809iIC4.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541812B11B.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541814e7t6.png?x-oss-process=style/bb)
此处的验证错误可以忽略,不影响安装
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541817u4z6.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541820M5l0.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105418222iX8.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105418242x2S.png?x-oss-process=style/bb)
按照提示执行脚本 [root@rac1 ~]# /oracle/product/11.2.0/dbhome_1/root.sh [root@rac2 ~]# /oracle/product/11.2.0/dbhome_1/root.sh |
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105418262fPV.png?x-oss-process=style/bb)
创建数据库
集群数据库
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541828K5P5.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541892uP0p.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541896Bh34.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541899M4fV.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105419013d26.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541903ZUsQ.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541906E003.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541909UHA0.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_14105419112jA4.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541913w24B.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541915rrOH.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541917whml.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541920rY3Z.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541926G3Qg.png?x-oss-process=style/bb)
![](http://img.blog.itpub.net/blog/attachment/201409/13/29047826_1410541928EE5Y.png?x-oss-process=style/bb)
数据库安装成功!
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
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29047826/viewspace-1268923/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29047826/viewspace-1268923/