欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

VMware虚拟机上Oracle 10g R2 RAC 安装

程序员文章站 2024-01-17 23:59:16
...

VMware虚拟机上Oracle 10g R2 RAC 安装

项目流程如下:
一、RAC安装
1、实验平台:Oracle 10gR2 RAC + RHEL 5.4 +VMware-server-1.0.9
2、安装步骤:
(1)系统需求:
操作系统:红帽5.0或5.4
内存:800M
交换空间:2048M
硬盘:10G
网卡:2(public IP + Virtual IP,priv IP)
主机节点:2(node1,node2)
存储设备:1(DB files)
(2)网络规划:
主机名 类型 IP地址
node1 公共 142.105.100.111
node2 公共 142.105.100.112
node1-vip 虚拟 142.105.100.211
node2-vip 虚拟 142.105.100.212
node1-priv 专用 192.168.100.111
node2-priv 专用 192.168.100.112
(3)安装流程
>安装虚拟机(vmware server 1.0.9)
>安装操作系统(RHEL 5.4)
>配置操作系统
>复制虚拟机
>配置双机信任关系
>安装clusterware软件
>安装database软件
>配置监听listener
>建立数据库实例
>客户端TAF(transparent application failover)配置(透明切换)
(4)安装前准备及OS安装配置,准备好安装包,包括:
VMware-server-1.0.9-156507.i386.rpm(虚拟机包),rhel-server-5.4-i386-dvd.iso(红帽镜像),Oracle10201_clusterware_linux32.zip(集群软件),oracleasm-support-2.1.3-1.el5.i386.rpm(ASM包),oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm(ASM包),oracleasmlib-2.0.4-1.el5.i386.rpm(ASM包),compat-gcc-7.3-2.96.128.i386.rpm(集群软件包),compat-libstdc++-7.3-2.96.128.i386.rpm(集群软件包),compat-libstdc++-devel-7.3-2.96.128.i386.rpm(集群软件包),compat-gcc-c++-7.3-2.96.128.i386.rpm(集群软件包),oracle10g01_10.2.0.1.0_database_linux32.zip(数据库包)

RAC1 Votingdisk
OCRdisk
vmware sharedisk ASMdisk1(两个ASM,一个用于用户数据,一个闪回数据)
ASMdisk2
RAC2

1)安装vmware-1.0.9版虚拟机
rpm -ivh VMware-server-1.0.9-156507.i386.rpm
RAC1 (新建->选择桥结->LSI Logic->SCSI->RAC1.vmdk(10G)->Votingdisk.vmdk(0.1G)(scsi1:1)(Independent)->OCRdisk.vmdk(0.1G)(scsi1:2)(Independent)->ASMdisk1(2G)(scsi1:3)(Independent)->ASMdisk2(1G)(scsi1:4)(Independent))->ethernet(加一块网卡(桥结))
RAC2(同一,也可待建完后复制)
2)安装RedHat Linux 5.4 操作系统
关键点:
分区(swap,sda1)包(开发全选,基本系统全选,服务器FTP)
防火墙(禁用),SELINUX(禁用),RAC1.vmx.
[root@node1 ~]# uname -a
Linux node1 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux
[root@node1 ~]# tail -7 /etc/hosts
127.0.0.1 localhost.localdomain localhost
142.105.100.111 node1
142.105.100.112 node2
142.105.100.211 node1-vip
142.105.100.212 node2-vip
192.168.100.111 node1-priv
192.168.100.112 node2-priv
[root@node1 ~]# tail -7 /etc/sysctl.conf
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[root@node1 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[root@node1 ~]#sysctl -p
[root@node1 ~]# tail -1 /etc/rc.local
modprobe hangcheck-timer hangcheck-tick=30 hangcheck_margin=20
[root@node1 ~]# vi /etc/redhat-release
[root@node1 ~]#> /etc/resolv.conf
[root@node1 ~]#groupadd oinstall
[root@node1 ~]#groupadd dba
[root@node1 ~]#useradd oracle
[root@node1 ~]#passwd oracle
[root@node1 ~]# tail -7 /home/oracle/.bash_profile
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=RACDB1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:$PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[root@node1 ~]#mkdir -p /u01/app/oracle
[root@node1 ~]#chown -R oracle:oinstall /u01
[root@node1 ~]#chmod -R 775 /u01
[root@node1 ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1241 9968301 83 Linux
/dev/sda2 1242 1305 514080 82 Linux swap / Solaris
Disk /dev/sdb: 107 MB, 107374080 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 102 104432 83 Linux
Disk /dev/sdc: 107 MB, 107374080 bytes
64 heads, 32 sectors/track, 102 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 102 104432 83 Linux
Disk /dev/sdd: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 1 261 2096451 83 Linux
Disk /dev/sde: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sde1 1 130 1044193+ 83 Linux
[root@node1 ~]#rpm -ivh oracleasm-support-2.1.3-1.el5.i386.rpm
[root@node1 ~]#rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
[root@node1 ~]#rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm
[root@node1 ~]#/etc/init.d/oracleasm configure
Default user to own the driver interface []:oracle
Default group to own the driver interface []:dba
Start oracle ASM library driver interdace on boot (y/n)[n]:y
Scan for oracle ASM disks on boot (y/n) [y]:y
[root@node1 ~]#/etc/init.d/oracleasm createdisk VOL1 /dev/sdd1
[root@node1 ~]#/etc/init.d/oracleasm createdisk VOL2 /dev/sde1
[root@node1 ~]#/etc/init.d/oracleasm listdisks
[root@node1 ~]# tail -5 /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="17", RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="33", RUN+="/bin/raw /dev/raw/raw2 %M %m"
KERNEL=="raw[1-2]",OWNER="oracle",GROUP="oinstall",MODE="640"
[root@node1 ~]#start_udev
[root@node1 ~]#ls -l /dev/raw
[root@node1 ~]#rpm -ivh /oradisk/compat-gcc-7.3-2.96.128.i386.rpm
[root@node1 ~]#rpm -ivh /oradisk/compat-libstdc++-7.3-2.96.128.i386.rpm —force
[root@node1 ~]#rpm -ivh /oradisk/compat-libstdc++-devel-7.3-2.96.128.i386.rpm
[root@node1 ~]#rpm -ivh /oradisk/compat-gcc-c++-7.3-2.96.128.i386.rpm
Node2
[root@node1 ~]#mkdir /vmware/RAC2
[root@node1 ~]#Cp /vmware/RAC1/* /vmware/RAC1/ -rf
[root@node1 ~]#Vim rac2.vmx(rac1改为rac2)
打开vmware下RAC2,(create)
[root@node1 ~]#Hostname node2
[root@node2 ~]#Cat /etc/sysconf/network
[root@node2 ~]#Cd /etc/sysconfig/network-scripts/
[root@node2 network-scripts]#Mv ifcfg-eth0.bak ifcfg-eth0
[root@node2 network-scripts]#Mv ifcfg-eth1.bak ifcfg-eth1
[root@node2 network-scripts]#Ifconfig eth0 | grep Hwaddr
[root@node2 network-scripts]#Ifconfig eth1 | grep Hwaddr
[root@node2 network-scripts]#Vim ifconfig eth0(改硬件地址)
[root@node2 network-scripts]#Vim ifconfig eth1(改硬件地址)
[root@node2 network-scripts]#Service network restart
[root@node2 network-scripts]#vim /home/oracle/.bash_profile(改ORACLE_SID为RACDB2)
[root@node2 ~]#ping node1
[root@node2 ~]#ping node2
[root@node2 ~]#ping node1-priv
[root@node2 ~]#ping node1-priv
[root@node2 ~]#/etc/init.d/oracleasm scandisks
[root@node2 ~]#/etc/init.d/oracleasm listdisks
[root@node2 ~]#service xinetd start
[root@node2 ~]#chkconfig time-stream on
[root@node2 ~]#exit
[root@node2 ~]#crontab -e
* * * * rdate -s 142.105.100.112
[root@node1 ~]#su - oracle
[oracle@node1 ~]#mkdir .ssh
[oracle@node1 ~]#chmod 700 .ssh
[oracle@node1 ~]#ssh-keygen -t rsa
[oracle@node1 ~]#ssh-keygen -t dsa
[root@node2 ~]#su - oracle
[oracle@node2 ~]#mkdir .ssh
[oracle@node2 ~]#chmod 700 .ssh
[oracle@node2 ~]#ssh-keygen -t rsa
[oracle@node2 ~]#ssh-keygen -t dsa
[oracle@node1 ~]#cat /home/oracle/.ssh/id_rsa.pub >>/home/oracle/.ssh/authorized_keys
[oracle@node1 ~]#cat /home/oracle/.ssh/id_dsa.pub >>/home/oracle/.ssh/authorized_keys
[oracle@node1 ~]#ssh node2 cat /home/oracle/.ssh/id_rsa.pub >> /home/oracle/.ssh/authorized_keys
[oracle@node1 ~]#ssh node2 cat /home/oracle/.ssh/id_dsa.pub >> /home/oracle/.ssh/authorized_keys
[oracle@node1 ~]#scp /home/oracle/.ssh/authorized_keys node2:/home/oracle/.ssh/authorized_keys
[oracle@node1 ~]#ssh node1 date
[oracle@node1 ~]#ssh node2 date
[oracle@node1 ~]#ssh node1-priv date
[oracle@node1 ~]#ssh node1-priv date
[oracle@node1 ~]#ssh node2
[oracle@node2 ~]#ssh node1 date
[oracle@node2 ~]#ssh node2 date
[oracle@node2 ~]#ssh node1-priv date
[oracle@node2 ~]#ssh node2-priv date
安装Oracle 10gR2 clusterware:
[oracle@node1 ~]#cd /oradisk
[oracle@node1 ~]#unzip Oracle10201_clusterware_linux32.zip
[oracle@node1 ~]#chown -R oracle:oinstall /oradisk
[oracle@node1 ~]#chmod -R 775 /oradisk
[oracle@node1 ~]#cd /oradisk/clusterware
[oracle@node1 clusterware]#/oradisk/clusterware/cluvfy/runcluvfy.sh stage -pre crsinst -n node1,node2 -verbose
[oracle@node1 ~]#su - root
[root@node1 ~]#cd /oradisk/clusterware/rootpre
[root@node1 ~]#exit
[oracle@node1 ~]#cd /oradisk/clusterware
[oracle@node1 clusterware]#export LANG=en_US.UTF-8
[oracle@node1 clusterware]#./runInstaller -ignoreSysPreReqs

VMware虚拟机上Oracle 10g R2 RAC 安装