完成操作系统的安装后
1)增加两个8G硬盘,1个1G,修改“Red Hat Enterprise Linux 4.vmx”
scsi1.present = "TRUE"
scsi1:0.present = "TRUE"
scsi1:0.fileName = "K:\LiuGuanXue\RH_1\Red Hat Enterprise Linux 4 (2).vmdk"
scsi1:0.mode = "independent-persistent"
scsi1:1.present = "TRUE"
scsi1:1.fileName = "K:\LiuGuanXue\RH_1\Red Hat Enterprise Linux 4 (3).vmdk"
scsi1:1.mode = "independent-persistent"
scsi1.virtualDev = "lsilogic"
scsi1:2.present = "TRUE"
scsi1:2.fileName = "K:\LiuGuanXue\RH_1\Red Hat Enterprise Linux 4 (4).vmdk"
scsi1:2.mode = "independent-persistent"
disk.locking="FALSE"
diskLib.dataCacheMaxSize="0"
diskLib.dataCacheMaxReadAheadSize="0"
diskLib.dataCacheMinReadAheadSize="0"
diskLib.dataCacheMaxPageSize="4096"
diskLib.maxUnsyncedWrites="0"
2)添加一张新网卡eth1.
eth0 为RAC的公共网络NAT
eth1 为RAC的私有网络HOST ONLY
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.245.255
IPADDR=192.168.245.11
NETMASK=255.255.255.0
HWADDR=00:0C:29:B9:4B:E8
ONBOOT=yes
TYPE=Ethernet
#vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.31.31
GATEWAY=192.168.31.1
HWADDR=00:0C:29:B9:4B:F2
ONBOOT=yes
TYPE=Ethernet
#service network restart
3)修改主机名和hosts
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node1
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.245.11 node1
192.168.245.12 node2
192.168.245.21 node1-vip
192.168.245.22 node2-vip
192.168.31.31 node1-priv
192.168.31.32 node2-priv
4)创建组oinstall, dba,用户oracle
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba oracle
#passwd oracle
#id oracle
5)修改oracle用户的初始化参数文件
#vi /home/oracle/.bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/opt/ora10g
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=RACDB1
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin/
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
unset USERNAME
6)创建oracle的安装目录并授权
#mkdir /opt/ora10g
#chown oracle:oinstall /opt/ora10g
7)修改操作系统内核参数
/*配置内核参数*/
#vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
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
/*设置oracle 使用的文件数权限*/
#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
/*配置Hangcheck 计时器*/
#vi /etc/rc.local
modprobe hangcheck-timer hangcheck-tick=30 hangcheck_margin=180
8)磁盘分区
[root@node1 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 8704716 2362200 5900328 29% /
/dev/sda1 101086 12218 83649 13% /boot
none 403460 0 403460 0% /dev/shm
[root@node2 ~]# 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 13 104391 83 Linux
/dev/sda2 14 204 1534207+ 82 Linux swap
/dev/sda3 205 1305 8843782+ 83 Linux
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 83 Linux
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 1044 8385898+ 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 130 1044193+ 83 Linux
/dev/sdd2 131 261 1052257+ 83 Linux
9)配置裸设备
+用服务的方式绑定,开机时自动加载裸设备
#vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sdd2
然后启动服务:
#service rawdevices stop
#service rawdevices start
10)修改裸设备的属主
+修改/etc/udev/permissions.d/50-udev.permissions文件
将/etc/udev/permissions.d/50-udev.permissions的113行
从
raw/*:root:disk:0660
修改为
raw/*:oracle:oinstall:0660
11)安装oracleasmlib程序包
compat-gcc-7.3-2.96.128.i386.rpm
compat-gcc-c++-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
oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
oracleasmlib-2.0.2-1.i386.rpm
oracleasm-support-2.1.1-1.el4.i386.rpm
# rpm -Uvh oracleasm-support-2.1.1-1.el4.i386.rpm
# rpm -Uvh oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
# rpm -Uvh oracleasmlib-2.0.2-1.i386.rpm
+安装包compat-libstdc++-7.3-2.96.128.i386.rpm时有冲突,需要删除compat-libstdc++-296-2.96-132.7.2
[root@node2 ~]# mount.cifs //192.168.245.1/linux /mnt/share -o user=administrator
[root@node2 share]# rpm -Uvh compat-libstdc++-7.3-2.96.128.i386.rpm
warning: compat-libstdc++-7.3-2.96.128.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
file /usr/lib/libstdc++-2-libc6.1-1-2.9.0.so from install of compat-libstdc++-7.3-2.96.128 conflicts with file from package compat-libstdc++-296-2.96-132.7.2
file /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so from install of compat-libstdc++-7.3-2.96.128 conflicts with file from package compat-libstdc++-296-2.96-132.7.2
[root@node2 share]# rpm -e compat-libstdc++-296-2.96-132.7.2
[root@node2 share]# rpm -Uvh compat-libstdc++-7.3-2.96.128.i386.rpm
warning: compat-libstdc++-7.3-2.96.128.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:compat-libstdc++ ########################################### [100%]
12)COPY新节点node2
+修改HOSTNAME
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node2
+修改IP,MAC
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.245.255
IPADDR=192.168.245.12
NETMASK=255.255.255.0
HWADDR=00:0C:29:B9:4B:E8
ONBOOT=yes
TYPE=Ethernet
#vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.31.32
GATEWAY=192.168.31.1
HWADDR=00:0C:29:B9:4B:F2
ONBOOT=yes
TYPE=Ethernet
+修改.bash_profile
export ORACLE_SID=RACDB2
13)时间同步
+在node1节点启动时间服务
chkconfig time on
如果不启动该服务,则其他节点与该节点同步时间时会报错:Connect Refused
在node2节点与node1节点同步时间
rdate -s 192.168.245.11
# crontab -l
*/1 * * * * rdate -s 192.168.245.11
14)配置clusterware安装环境
+两节点能相互ping通
+oracle 用户下生成公钥和私钥
++in node1
#su - oracle
$mkdir ~/.ssh
$chmod 700 ~/.ssh
$ssh-keygen -t rsa
$ssh-keygen -t dsa
++in node2
#su - oracle
$mkdir ~/.ssh
$chmod 700 ~/.ssh
$ssh-keygen -t rsa
$ssh-keygen -t dsa
++in node1
$cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ssh node2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ssh node2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$scp ~/.ssh/authorized_keys node2:~/.ssh/authorized_keys
+在两个节点测试相互执行是否需要输入密码
ssh node1 date
ssh node2 date
ssh node1-priv date
ssh node2-priv date
15)配置ASM
+in node1
[root@node1 ~]#/etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
+in node2
[root@node2 ~]#/etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
+in node1
[root@node1 ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk: [ OK ]
[root@node1 ~]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "VOL2" as an ASM disk: [ OK ]
[root@node1 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@node1 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
+in node2
[root@node2 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@node2 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
16)安装clusterware
+in node1检查安装前环境
$clusterware/cluvfy/runcluvfy.sh stage -pre crsinst -n node1,node2 -verbose
此时只有一处错误,是由bug引起的,可以忽略。DOC ID:338924.1
====================================
Suitable interfaces for the private interconnect on subnet "192.168.245.0":
node2 eth0:192.168.245.12
node1 eth0:192.168.245.11
Suitable interfaces for the private interconnect on subnet "192.168.31.0":
node2 eth1:192.168.31.32
node1 eth1:192.168.31.31
ERROR:
Could not find a suitable set of interfaces for VIPs.
Result: Node connectivity check failed.
====================================
17)安装CRS
+in node1
#xhost +
#su - oracle
$./runInstaller
..
...
....
[root@node2 ~]# sh /opt/ora10g/oraInventory/orainstRoot.sh
Changing permissions of /opt/ora10g/oraInventory to 770.
Changing groupname of /opt/ora10g/oraInventory to oinstall.
The execution of the script is complete
[root@node2 ~]# sh /opt/ora10g/product/10.2.0/crs_1/root.sh
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
Checking to see if Oracle CRS stack is already configured
/etc/oracle does not exist. Creating it now.
Setting the permissions on OCR backup directory
Setting up NS directories
Oracle Cluster Registry configuration upgraded successfully
WARNING: directory '/opt/ora10g/product/10.2.0' is not owned by root
WARNING: directory '/opt/ora10g/product' is not owned by root
WARNING: directory '/opt/ora10g' is not owned by root
assigning default hostname node1 for node 1.
assigning default hostname node2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node
:
node 1: node1 node1-priv node1
node 2: node2 node2-priv node2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /dev/raw/raw4
Format of 1 voting devices complete.
Startup will be queued to init within 90 seconds.
Adding daemons to inittab
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
node1
node2
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
The given interface(s), "eth0" is not public. Public interfaces should be used to configure virtual IPs.
[root@node2 ~]#
/*手工重新配置node1-vip和node2-vip*/
[root@node2 ~]# /opt/ora10g/product/10.2.0/crs_1/bin/vipca
IP Alias Name IP address
node1-vip 192.168.245.21
node2-vip 192.168.245.22
安装结束后Exit.回到node1,按OK结束.
在Configuration Assistants中
Oracle Cluster Verification Utility 检查失败,但不影响正常运行。
Next -> Finish完成clusterware安装.
+检查安装后cluster的状态
[root@node1 ~]# /opt/ora10g/product/10.2.0/crs_1/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
[root@node1 ~]#
18)安装database软件
+in node1
过程略
19)创建ASM实例和数据库
+in node1
过程略