Rhel5+Oracle10g+asm+vm虚拟机(oracle集群)

一.安装前准备

1.使用VM自带工具划分共享磁盘 (VM虚拟机版本6.0)

进入VM所在目录使用以下工具划分共享磁盘空间

vmware-vdiskmanager.exe -c -s 1GB -a lsilogic -t 2 "盘符:\文件夹\文件名.vmdk"

分别创建三个1G.两个2G

2.创建,配置虚拟机

创建虚拟机时候注意删除软驱,添加一块网卡,(选择仅和主机通信)

在虚拟机配置文件中添加以下(是把刚才创建的磁盘添加近来,双节点都必须添加)

scsi1.present = "TRUE"

scsi1.virtualDev = "lsilogic"

scsi1.sharedBus = "virtual"

scsi1:1.present = "TRUE"

scsi1:1.mode = "independent-persistent"

scsi1:1.filename = "盘符:\文件夹\文件名.vmdk"

scsi1:1.deviceType = "plainDisk"

scsi1:2.present = "TRUE"

scsi1:2.mode = "independent-persistent"

scsi1:2.filename = "盘符:\文件夹\文件名.vmdk"

scsi1:2.deviceType = "plainDisk"

scsi1:3.present = "TRUE"

scsi1:3.mode = "independent-persistent"

scsi1:3.filename = "盘符:\文件夹\文件名.vmdk"

scsi1:3.deviceType = "plainDisk"

scsi1:4.present = "TRUE"

scsi1:4.mode = "independent-persistent"

scsi1:4.filename = "盘符:\文件夹\文件名.vmdk"

scsi1:4.deviceType = "plainDisk"

scsi1:5.present = "TRUE"

scsi1:5.mode = "independent-persistent"

scsi1:5.filename = "盘符:\文件夹\文件名.vmdk"

scsi1:5.deviceType = "plainDisk"

disk.locking = "FALSE"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.dataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize = "4096"

diskLib.maxUnsyncedWrites = "0"

3.安装系统 (rhel5)

采用默认安装,因为asm和ocfs2都需要图形化的配置,所以必须要有图形化界面. 关闭SELINUX,防火墙,配置系统只开机启动ssh.syslog,network,xfs服务。另外一个系统也做同样设置.(分区时,不要给共享磁盘分区,让他保持free状态)

4.安装所需包

#rpm -ivh compat-db-4.2.52-5.1.i386.rpm

#rpm -ivh libstdc++-devel-4.1.1-52.el5.i386.rpm

#rpm -ivh libgomp-4.1.1-52.el5.i386.rpm

#rpm -ivh glibc-headers-2.5-12.i386.rpm

#rpm -ivh glibc-devel-2.5-12.i386.rpm

#rpm -ivh gcc-4.1.1-52.el5.i386.rpm

#rpm -ivh gcc-c++-4.1.1-52.el5.i386.rpm

#rpm -ivh compat-gcc-34-3.4.6-4.i386.rpm

#rpm -ivh compat-gcc-34-c++-3.4.6-4.i386.rpm

#rpm -ivh compat-libgcc-296-2.96-138.i386.rpm

#rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm

#rpm -ivh cpp-4.1.1-52.el5.i386.rpm

#rpm -Uvh glibc-2.5-12.i386.rpm

#rpm -ivh libaio-0.3.106-3.2.i386.rpm

#rpm -ivh libXmu-1.0.2-5.i386.rpm

#rpm -ivh libXp-1.0.0-8.i386.rpm

#rpm -ivh make-3.81-1.1.i386.rpm

#rpm -ivh openmotif22-2.2.3-18.i386.rpm

#rpm -ivh openmotif-2.3.0-0.3.el5.i386.rpm

#rpm -ivh setarch-2.0-1.1.i386.rpm

#rpm -ivh sysstat-7.0.0-3.el5.i386.rpm

5.创建Oracle用户,建立SSH信任,编辑参数和变量 (以下没注明的都是双节点实现)

#vi /etc/sysctl.conf

kernel.sem = 250 32000 100 128

kernel.shmmni = 4096

kernel.shmall = 2097152

kernel.shmmax = 278396928

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default=262144

net.core.rmem_max=1048576

net.core.wmem_default=262144

net.core.wmem_max=1048576

注销原有kernel.shmmax, kernel.shmall (以上数值有待改变)

#sysctl -p

#vi /etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

#vi /etc/pam.d/login

session required /lib/security/pam_limits.so

#vi /etc/modprobe.conf

options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

#vi /etc/rc.d/rc.local

/sbin/modprobe hangcheck_timer

#modprobe hangcheck_timer

#grep hangcheck /var/log/messages | tail -2

#vi /etc/hosts

127.0.0.1 localhost

192.168.0.243 rac1

192.168.0.245 rac2

192.168.0.143 v-rac1

192.168.0.145 v-rac2

10.0.0.243 int-rac1

10.0.0.245 int-rac2

#ping -c 3 rac1

#ping -c 3 rac2

#ping -c 3 int-rac1

#ping -c 3 int-rac2

#groupadd oinstall

#groupadd dba

#useradd -u 200 -g oinstall -G dba -d /home/oracle -r oracle -m

#passwd oracle

#id oracle

#su - oracle

#mkdir ~/.ssh

#chmod 700 ~/.ssh

#ssh-keygen -t rsa (一路回车)

#ssh-keygen -t dsa (一路回车)

使用节点1执行

#cd ~/.ssh

#cat id_rsa.pub >>authorized_keys

#cat id_dsa.pub >>authorized_keys

#scp authorized_keys rac2:/home/oracle/.ssh/

#ssh rac2

#cd .ssh

#cat id_rsa.pub >>authorized_keys

#cat id_dsa.pub >>authorized_keys

#exit

使用节点2执行

#cd ~/.ssh

#scp authorized_keys rac1:/home/oracle/.ssh/

双节点实现

#ssh-agent $SHELL

#ssh-add

#ssh rac1 date

#ssh rac2 date

#vi /home/oracle/.bash_profile

umask 022

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/10.2.0/rac_db

export ORA_CRS_HOME=$ORACLE_BASE/10.2.0/crs

export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin

export ORACLE_SID=orcl1 (节点2为oracl2)

export NLS_LANG=AMERICAN_AMERICA.zhs16gbk

export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"

export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin

export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin

export ORACLE_TERM=xterm

export TNS_ADMIN=$ORACLE_HOME/network/admin

export ORA_NLS10=$ORACLE_HOME/nls/data

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

export CLASSPATH=$ORACLE_HOME/JRE

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export THREADS_FLAG=native

export TEMP=/tmp

export TMPDIR=/tmp

export DISPLAY=192.168.0.244:0.0

6.切换root用户创建安装目录,分配权限

mkdir -p /u01/app/oracle/10.2.0/rac_db

mkdir -p /u01/app/oracle/10.2.0/crs

chown -R root.oinstall /u01/

chmod -R 775 /u01/

mkdir -p /u02/oradata/orcl

chown -R oracle.dba /u02/

chmod -R 775 /u02/

7.节点1给磁盘分区

# fdisk /dev/sdb (同样方法格式/dev/sdc /dev/sdd/ dev/sde/ dev/sdf/)

n>p>1>回车>回车>w

重新启动两台计算机,让另外一台机器能认到被格式化过的磁盘

8.安装ocfs2,配置ocfs2 (双节点)

#rpm -ivh ocfs2-tools-1.2.6-1.el5.i386.rpm

#rpm -ivh ocfs2-2.6.18-8.el5-1.2.6-6.el5.i686.rpm (根据不同的内核打不同的包)

#rpm -ivh ocfs2console-1.2.6-1.el5.i386.rpm

#ocfs2console X下使用

#vi /etc/init.d/o2cb

删除以下行

### BEGIN INIT INFO

## Provides: o2cb

## Required-Start: $network

## Should-Start:

## Required-Stop:

## Default-Start: 2 3 5

## Default-Stop:

## Description: Load O2CB cluster services at system boot.

### END INIT INFO

#/etc/init.d/o2cb offline ocfs2

#/etc/init.d/o2cb unload

#/etc/init.d/o2cb configure

在节点1格式/dev/sdb1为ocfs2

#mkfs.ocfs2 -b 4k -C 32k -L oradatafiles /dev/sdb1

最好在重新启动一下双节点,因为是虚拟环境,所以担心另外一台虚拟机同步的慢

#mount -t ocfs2 -o datavolume /dev/sdb1 /u02/oradata/orcl

#vi /etc/fstab

/dev/sdb1 /u02/oradata/orcl ocfs2 _netdev,datavolume 0 0

#vi /etc/sysconfig/o2cb

O2CB_HEARTBEAT_THRESHOLD=601

9.安装asm,配置asm

#rpm -ivh oracleasm-support-2.0.4-1.el5.i386.rpm

# rpm -ivh oracleasm-2.6.18-8.el5-2.0.4-1.el5.i686.rpm (根据不同的内核打不同的包)

# rpm -ivh oracleasmlib-2.0.3-1.el5.i386.rpm

#/etc/init.d/oracleasm configure

oracle,dba,y,y

节点1执行

#/etc/init.d/oracleasm createdisk VOL1 /dev/sdc1

#/etc/init.d/oracleasm createdisk VOL2 /dev/sdd1

#/etc/init.d/oracleasm createdisk VOL3 /dev/sde1

#/etc/init.d/oracleasm createdisk VOL4 /dev/sdf1

#/etc/init.d/oracleasm listdisks

#ls -l /dev/oracleasm/disks/

节点2执行

#/etc/init.d/oracleasm scandisks

#/etc/init.d/oracleasm listdisks

#ls -l /dev/oracleasm/disks/

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyddgw.html