1.资源准备
最近,在VmwareStation 10虚拟机上,基于CentOS5.4安装Oracle 11g RAC,并把过程记录下来.刚开始时,是基于CentOS 6.4安装Oracle 11g RAC, 没有成功,主要是Oracle 11g RAC安装,没有针对CentOS 6.4的内核的一些包.
本文内容详实,包括安装过程中遇到的一些问题,也单独编一章节,第四章节的FAQ.
http://blog.chinaunix.net/xmlrpc.php?r=blog/article&id=4681351&uid=29655480
1.1. 软件准备
- SecureCRT:用于客户机通过SSH连接LINUX
- VmWareStation10:
VMware-workstation-full-10.0.1-1379776.exe
5C4A7-6Q20J-6ZD58-K2C72-0AKPE (已测,可用)
1Y0W5-0W205-7Z8J0-C8C5M-9A6MF
NF2A7-AYK43-CZCT8-FCAN6-CA84
4A4QH-6Q195-XZW10-6K8N2-A3CJX
5A6ZT-20JD2-LZWZ9-H38N0-92L62
- CentOS5.4: CentOS-5.4-x86_64-bin-DVD1.iso、CentOS-5.4-x86_64-bin-DVD2.iso
- Oracle 11g: linux.x64_11gR2_database_1of2.zip、linux.x64_11gR2_database_1of2.zip、linux.x64_11gR2_grid.zip
http://public-yum.oracle.com
http://mirrors.163.com/centos/
https://www.centos.org/download/mirrors/
http://download.chinaunix.net/download.php?id=30562&ResourceID=12271
- Oracle ASMlib下载地址:
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html
1.2. 硬件准备
- Windows环境:
- 虚拟机环境:
-
- 2.搭建环境-2.1创建虚拟机
2.1.1. 创建虚拟机节点1
2.1.2. 创建虚拟机节点2
操作如节点1.
2.2. 安装操作系统CentOS5.4
两个虚拟机都安装,此步骤在创建虚拟机节点时:
2.3.配置共享磁盘
2.3.1.创建共享磁盘
在cmd中进入WMware Workstation 10.0 安装目录:
1.创建存储Oracle Clusterware文件 (Oracle Cluster Registry and voting disk) 的磁盘: vmware-vdiskmanager.exe -c -s 4Gb -a lsilogic -t 2 "E:\SoftwareInstall\vmware\SharedDiskASM"\ShareDiskOCR.vmdk 2.创建存储Oracle共享数据文件的磁盘: vmware-vdiskmanager.exe -c -s 20Gb -a lsilogic -t 2 "E:\SoftwareInstall\vmware\SharedDiskASM"\ShareDiskData01.vmdk vmware-vdiskmanager.exe -c -s 20Gb -a lsilogic -t 2 "E:\SoftwareInstall\vmware\SharedDiskASM"\ShareDiskData02.vmdk
vmware-vdiskmanager.exe -c -s 5Gb -a lsilogic -t 2 "E:\SoftwareInstall\vmware\SharedDiskASM"\ShareDiskFlash.vmdk |
2.3.2. 编辑虚拟机配置文件
关闭两台虚拟机,用记事本打开虚拟机名字.wmx,到虛拟机的目录比如 E:\SoftwareInstall\vmware\linuxrac1,直接编辑*.vmx 文件, 加上下面语句(所有虛拟机节点):
scsi1:1.deviceType = "disk" scsi1:1.present = "TRUE" scsi1:1.fileName = "E:\SoftwareInstall\vmware\SharedDiskASM\ShareDiskOCR.vmdk" scsi1:1.mode = "independent-persistent" scsi1:1.redo = ""
scsi1:2.deviceType = "disk" scsi1:2.present = "TRUE" scsi1:2.fileName = "E:\SoftwareInstall\vmware\SharedDiskASM\ShareDiskData01.vmdk" scsi1:2.mode = "independent-persistent" scsi1:2.redo = ""
scsi1:3.deviceType = "disk" scsi1:3.present = "TRUE" scsi1:3.fileName = "E:\SoftwareInstall\vmware\SharedDiskASM\ShareDiskData02.vmdk" scsi1:3.mode = "independent-persistent" scsi1:3.redo = ""
scsi1:4.deviceType = "disk" scsi1:4.present = "TRUE" scsi1:4.fileName = "E:\SoftwareInstall\vmware\SharedDiskASM\ShareDiskFlash.vmdk" scsi1:4.mode = "independent-persistent" scsi1:4.redo = "" scsi1.pciSlotNumber = "37" usb:0.present = "TRUE" usb:0.deviceType = "hid" usb:0.port = "0" usb:0.parent = "-1" |
注意:这个文件中的每一行都不能重复,否则会报错, 而且不要去改变文件的编码格式
(如果提示需要存储为其他编码格式,比如unicode, 那么就是拷贝的格式有问题,需要手工写入 )。
最后开启虚拟机程序(注意,一定要重新启动vmware界面程序),查看每个节点虚拟机
Devices部分,在未开启各个虚拟机的时候就应该可以看到磁盘挂载情况 。 然后开机
再次确认 。 如果在未开启时没有看到磁盘信息, 那么就是写入vmx文件的语法有问题,
可以手工写入(而不是拷贝)。
当然也可以通过VMWare图形界面建立磁盘,注意共享磁盘选择SCSI 1而不是0才可以。我这里就是用的图形界面方式,总之不管是图形界面还是命令创建,最后添加到虚拟机里的每一个磁盘属性应当如下图所示,
注意选择磁盘时候需要选取 SCSI 1:1,SCSI 1:2,我这里有四个共享磁盘,那么就依次是SCSI 1:1,SCSI 1:2,SCSI 1:3,SCSI 1:4
2.4.安装JDK
2.4.1.准备JDK
在百度搜索:JDK下载
2.4.2.上传JDK
put E:\软件安装文件\jdk-8u11-linux-x64.rpm /home/linuxrac1/Downloads
put E:\软件安装文件\linux.x64_11gR2_database_1of2.zip /home/linuxrac1/Downloads
put E:\软件安装文件\linux.x64_11gR2_database_2of2.zip /home/linuxrac1/Downloads
put E:\软件安装文件\jdk-8u11-linux-x64.rpm /home/linuxrac1/Downloads
2.4.3.安装JDK
安装JDK: |
[linuxrac1@localhost Downloads]# su root Password: [linuxrac1@localhost Downloads]# rpm -ivh jdk-8u11-linux-x64.rpm Preparing... ###########################################[100%] 1:jdk ###########################################[100%] Unpacking JAR files... rt.jar... jsse.jar... charsets.jar... tools.jar... localedata.jar... jfxrt.jar...
[root@localhost Downloads]#
total 16 lrwxrwxrwx 1 root root 16 Sep 3 18:40 default -> /usr/java/latest drwxr-xr-x 8 root root 4096 Sep 3 18:40 jdk1.8.0_11 lrwxrwxrwx 1 root root 21 Sep 3 18:40 latest -> /usr/java/jdk1.8.0_11 [root@linuxrac1 java]# cd jdk1.8.0_11 [root@linuxrac1 jdk1.8.0_11]# ls bin javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt COPYRIGHT jre README.html THIRDPARTYLICENSEREADME.txt db lib release include LICENSE src.zip [root@linuxrac1 jdk1.8.0_11]# pwd /usr/java/jdk1.8.0_11 |
2.4.4.配置JDK环境变量
查看安装JDK的目录:/usr/java/ |
[root@linuxrac1 ~]# cd /usr/java/ [root@linuxrac1 java]# ll total 16 lrwxrwxrwx 1 root root 16 Sep 3 18:40 default -> /usr/java/latest drwxr-xr-x 8 root root 4096 Sep 3 18:40 jdk1.8.0_11 lrwxrwxrwx 1 root root 21 Sep 3 18:40 latest -> /usr/java/jdk1.8.0_11 [root@linuxrac1 java]# cd jdk1.8.0_11 [root@linuxrac1 jdk1.8.0_11]# ls bin javafx-src.zip man THIRDPARTYLICENSEREADME-JAVAFX.txt COPYRIGHT jre README.html THIRDPARTYLICENSEREADME.txt db lib release include LICENSE src.zip [root@linuxrac1 jdk1.8.0_11]# pwd /usr/java/jdk1.8.0_11 |
编辑profile |
[root@linuxrac1 ~]# cd /etc [root@linuxrac1 etc]# ls profile profile [root@linuxrac1 etc]# vi profile # /etc/profile
# System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc pathmunge () { if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi }
# ksh workaround if [ -z "$EUID" -a -x /usr/bin/id ]; then EUID=`id -u` UID=`id -ru` fi
# Path manipulation # if [ "$EUID" = "0" ]; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin # fi # set environment by HondaHsu 2014 JAVA_HOME=/usr/java/jdk1.8.0_11 JRE_HOME=/usr/java/jdk1.8.0_11/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tool.jar:$JRE_HOME/lib: export JAVA_HOME JRE_HOME PATH CLASSPATH
[root@linuxrac1 etc]# java -version java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode) |
2.5. 配置网络
2.5.1. 配置网络
Oracle Rac数据库涉及到公用网络和私有网络,因此要做网络划分和IP地址规划,下表列出了要安装的RAC数据库对应的IP地址、主机名以及网络连接类型:
Rac1 |
||||
主机名 |
IP址址 |
子网 |
网络类型 |
解析方式 |
Eth0 |
10.10.97.161 |
255.255.255.0 |
公用网络 |
|
Eth1 |
192.168.2.116 |
255.255.255.0 |
私有网络 |
|
|
10.10.97.181 |
255.255.255.0 |
虚拟网络 |
|
/etc/hosts |
||||
#eth0 public 10.10.97.161 linuxrac1 10.10.97.167 linuxrac2 #eth1 private 192.168.2.116 linuxrac1-pri 192.168.2.216 linuxrac2-priv #virtual 10.10.97.181 linuxrac1-vip 10.10.97.183 linuxrac2-vip #scan 10.10.97.193 linuxrac-scan
|
Rac2 |
||||
主机名 |
IP址址 |
子网 |
网络类型 |
解析方式 |
Eth0 |
10.10.97.167 |
255.255.255.0 |
公用网络 |
|
Eth1 |
192.168.2.216 |
255.255.255.0 |
私有网络 |
|
|
10.10.97.183 |
255.255.255.0 |
虚拟网络 |
|
/etc/hosts |
||||
#eth0 public 10.10.97.161 linuxrac1 10.10.97.167 linuxrac2 #eth1 private 192.168.2.116 linuxrac1-pri 192.168.2.216 linuxrac2-priv #virtual 10.10.97.181 linuxrac1-vip 10.10.97.183 linuxrac2-vip #scan 10.10.97.193 linuxrac-scan |
公网与私网IP设置在网卡上,虚拟IP不用设置.
通过ifdown,ifup使配置的IP生效:
[root@linuxrac2 Desktop]# ifdown eth0 Device state: 3 (disconnected) [root@linuxrac2 Desktop]# ifdown eth1 Device state: 3 (disconnected) [root@linuxrac2 Desktop]# ifup eth0 Active connection state: activating Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2 state: activated Connection activated [root@linuxrac2 Desktop]# ifup eth1 Active connection state: activated Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/3 |
2.6. 安装Oracle所依赖的必要包
2.6.1. 检查Oracle所依赖的必要rpm包
[root@localhost /]#rpm -q binutils compat-libstdc elfutils-libelf elfutils-libelf-devel expat gcc |
2.6.2. 准备Oracle所依赖的必要包
- 在Linux安装文件的CentOS-5.4-x86_64-bin-DVD1\Packages文件夹查找缺少的依赖包:
- yum 使用http://mirror.centos.org的镜像更新:http://mirror.centos.org/centos/5/os/x86_64/CentOS/
另外,也可以通过修改yum.repos.d下的CenOS的镜像仓库地址,如访问163的镜像,操作如下:
1) 备份系统原来的CentOS-Base.repo文件:
[root@localhost /]#cd /etc/yum.repos.d/ [root@localhost /]#cp -a CentOS-Base.repo CentOS-Base.repo.bak |
2) 用vi打开CentOS-Base.repo文件:
[root@localhost /]#vim CentOS-Base.repo |
然后,按Insert键进入文本编辑状态
3) 修改后的CentOS-Base.repo文件,代码如下:
# CentOS-Base.repo
# CentOS-Base.repo [base] gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #released updates gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #packages used/produced in the build but not released gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 |
保存:先按Esc,然后按“:”,再:“wq”。
2.6.3. 上传到虚拟机LINUX上
通过SecureCRT上传:oracle 所依赖的一些包 |
put E:\temp\ rpms.zip/home/linuxrac2/Downloads |
然后解压:
解压所上传的压缩包: |
put E:\temp\ rpms.zip /home/linuxrac2/Downloads |
2.6.4.安装Oracle所依赖的必要包
例如:
[root@localhost rpms]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm [root@localhost rpms]# rpm -ivh unixODBC-2.2.14-12.el6_3.x86_64.rpm [root@localhost rpms]# rpm -ivh unixODBC-devel-2.2.14-12.el6_3.x86_64.rpm [root@localhost rpms]# rpm -ivh gcc-4.4.7-3.el6.x86_64.rpm |
- 在安装 oracle x64 时,需要安装 32 位的 compat-libstdc++,但是,直接运行安装时,会由于依赖关系,安装不能完成,如果手工输入这么多的包,就过于复杂了。更关键的是,它列出的名字与包的名字并不一一对应。
[root@localhost rpms]#rpm -ivh compat-libstdc++-33-3.2.3-69.el6.i686.rpm |
本文转自 张冲andy 博客园博客,原文链接: http://www.cnblogs.com/andy6/p/5759189.html ,如需转载请自行联系原作者