操作系统版本RHEL5.5-64bit,Oracle10g,vmware workstation6.5,clusterware10.0.2版本的
两台虚拟机双网卡,本地磁盘40G,共享磁盘9G,共享磁盘选择立即分配所有磁盘空间,两台虚拟机内存都是1.5G
1.配置hosts文件可以让两台虚拟机可以通过名称互相解析
192.168.183.131 node1
192.168.183.132 node2
192.168.183.141 node1-vip
192.168.183.142 node2-vip
172.16.1.1 node1-priv
172.16.1.2 node2-priv
2.给虚拟机添加共享磁盘,首先在node1上面添加一块共享磁盘,选择分配全部的空间(虚拟机下一定要这么设置,否则会导致共享存储配置不成功)
node1添加共享磁盘(sharedisk.vmdk)-开机-关机,然后编辑node1的虚拟机配置文件,添加如下选项:
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "VIRTUAL"
scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.fileName = "sharedisk.vmdk"
scsi1:1.deviceType = "disk"
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
然后编辑node2的虚拟机配置文件,添加如下选项:
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "VIRTUAL"
scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.fileName = "D:vmware workstationnode1sharedisk.vmdk"
scsi1:1.deviceType = "disk"
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
关闭虚拟机软件,然后分别打开两台虚拟机的电源,共享磁盘配置完毕
3.oracle安装环境准备
这里参照我以前的文章,oracle安装前期准备工作的设置
http://lymrg.blog.51cto.com/1551327/754136
在两个节点上面创建对应文件夹
[root@node1 oracle]# ll
总计 12
drwxr-xr-x 2 oracle oinstall 409603-0816:08 oraasm
drwxr-xr-x 2 oracle oinstall 409603-0816:08 orabase
drwxr-xr-x 2 root oinstall 409603-0816:08 oracrs
这里oracle的变量设置做下更改
PATH=$PATH:$HOME/bin
export ORACLE_BASE=/home/oracle/orabase
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=/home/oracle/oracrs/product/10.2.0/crs
export ORA_ASM_HOME=/home/oracle/oraasm/product/10.2.0/asm
export ORACLE_SID=orcl1 PATH=$PATH:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:$ORA_ASM_HOME/bin
export PATH
4.建立hangcheck模块加载(在两个节点上面操作)
[root@node1 ~]# find /lib/modules -name "hangcheck-timer.ko"
[root@node1 ~]# vi /etc/modprobe.conf
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
[root@node1 ~]# vi /etc/rc.local
/sbin/modprobe hangcheck_timer
启动 /sbin/modprobe hangcheck_timer
查看启动是否成功
[root@node1 ~]# grep hangcheck /var/log/messages|tail -2
Mar 1215:25:47 node1 kernel: Hangcheck: starting hangcheck timer 0.9.0 (tick is30 seconds, margin is180 seconds).
5.配置两台机器无密码访问,这里的配置要在两个节点上面进行
(1)以oracle 用户登录
(2)在oracle 用户的主目录内创建.ssh 目录并设置正确的权限
[oracle@node1 ~]$ mkdir ~/.ssh
[oracle@node1 ~]$ chmod 700 ~/.ssh
[oracle@node1 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
17:e4:7c:79:8d:a0:00:3b:d9:f7:7a:56:f3:ac:54:4d oracle@node1
[oracle@node1 ~] $ cd ~/.ssh
[oracle@node1 .ssh]$ ssh node1 cat /home/oracle/.ssh/id_rsa.pub >>
authorized_keys
[oracle@node1 .ssh]$ ssh node2 cat /home/oracle/.ssh/id_dsa.pub
>>authorized_keys
[oracle@node1 .ssh]$ scp authorized_keys node2:/home/oracle/.ssh/
[oracle@node1 .ssh]$ chmod 600 ~/.ssh/authorized_keys
完成后,在node1 上执行:
[oracle@node1 ~]$ ssh node1 date
[oracle@node1 ~]$ ssh node2 date
如果不需要输入密码就出现系统日期,说明SSH 配置成功。
6.磁盘规划
这里我把共享磁盘分成6个区,sdb1和sdb2配制成裸设备,作为OCR镜像,sdb5,6,7也配置成裸设备,作votedisk镜像,sdb配置成ASM用来存放数据库
fdisk -l
Disk /dev/sdb: 9663 MB, 9663676416 bytes
255 heads, 63 sectors/track, 1174 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 16350601683 Linux
/dev/sdb2 64126506047+ 83 Linux
/dev/sdb3 127117484180605 Extended
/dev/sdb5 12718950601683 Linux
/dev/sdb6 19025250601683 Linux
/dev/sdb7 25331550601683 Linux
/dev/sdb8 3161174689988683 Linux
配置裸设备
vi /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdb8", RUN+="/bin/raw /dev/raw/raw6 %N"
KERNEL=="raw1", OWNER="root", GROUP="oinstall", MODE="660"
KERNEL=="raw2", OWNER="root", GROUP="oinstall", MODE="660"
KERNEL=="raw3", OWNER="root", GROUP="oinstall", MODE="660"
KERNEL=="raw4", OWNER="root", GROUP="oinstall", MODE="660"
KERNEL=="raw5", OWNER="root", GROUP="oinstall", MODE="660"
KERNEL=="raw6", OWNER="oracle", GROUP="oinstall", MODE="664"
[root@node1 ~]# start_udev
启动 udev: [确定]
[root@node1 ~]# ll /dev/raw/raw*
crw-rw---- 1 root oinstall 162, 103-1122:43 /dev/raw/raw1
crw-rw---- 1 root oinstall 162, 203-1122:43 /dev/raw/raw2
crw-rw---- 1 root oinstall 162, 303-1122:43 /dev/raw/raw3
crw-rw---- 1 root oinstall 162, 403-1122:43 /dev/raw/raw4
crw-rw---- 1 root oinstall 162, 503-1122:43 /dev/raw/raw5
crw-rw-r-- 1 oracle oinstall 162, 603-1122:43 /dev/raw/raw6
在node2上面执行 partprobe,然后同样建立裸设备
7.在两个节点上面安装,注意要下载和自己内核版本对应的包
rpm -ivh oracleasm-support-2.1.7-1.el5.x86_64.rpm
rpm -ivh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm
在两个节点上面执行/etc/init.d/oracleasm configure
分别输入oracle,dba,y,y
在node1上面配置ASM
[root@node1 ~]#/etc/init.d/oracleasm createdisk VOL1 /dev/sdb8
[root@node1 ~]#/etc/init.d/oracleasm scandisks
[root@node1 ~]#/etc/init.d/oracleasm listdisks
VOL1
在node2上面执行扫描(不需要配置)
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm listdisks
VOL1
8.开启安装进程,在两个节点上面以root用户身份运行
然后切换到oracle用户,开始安装clusterware
1)选择CRS的安装目录
2)两个集群节点的配置
3)选择eth0网卡为公网IP
4)配置OCR存储位置
5)配置votedisk存储位置
6)安装
7)执行最后的安装脚本
在节点node1上面执行
[root@node1 oracrs]# /home/oracle/orabase/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/orabase/oraInventory to 770.
Changing groupname of /home/oracle/orabase/oraInventory to oinstall.
The execution of the script is complete
在节点node2上面执行
[root@node2 oracrs]# /home/oracle/orabase/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/orabase/oraInventory to 770.
Changing groupname of /home/oracle/orabase/oraInventory to oinstall.
The execution of the script is complete
在节点node1上面执行
[root@node1 oracle]# /home/oracle/oracrs/product/10.2.0/crs/root.sh
在节点node2上面执行
[root@node2 oracle]# /home/oracle/oracrs/product/10.2.0/crs/root.sh
安装结束,查看节点状态
[root@node2 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2