将VMServer的版本改为1.9.安装cluster软件时报错了,原因是时间不一致.
DBCA建库又出错了,cancle之后在来一次就一点问题也没有.
VMServer太不稳定,每次装都出现不同的问题.
但只是安装cluster和database软件正确,其它问题都很好解决.
1)crs_stat -t 看到状态有为unknow的,/etc/init.d/init.crs start解决.
2)rdate同步两节点的时间,同步频率要高,避免cluster时间不一致而导致节点重启
关闭sendmail服务,加快启动
# chkconfig sendmail off
完成操作系统的安装后
1)增加两个硬盘,修改Red Hat Enterprise Linux 4.vmx
disk.locking="FALSE"
diskLib.dataCacheMaxSize="0"
diskLib.dataCacheMaxReadAheadSize="0"
diskLib.dataCacheMinReadAheadSize="0"
diskLib.dataCacheMaxPageSize="4096"
diskLib.maxUnsyncedWrites="0
scsi1:0.deviceType = "disk"
scsi1:1.deviceType = "disk"
2)添加一张新网卡eth1.
eth0 为RAC的公共网络NAT
eth1 为RAC的私有网络HOST ONLY
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.179.255
IPADDR=192.168.179.11
GATEWAY=192.168.179.2
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.240.31
GATEWAY=192.168.240.2
BROADCAST=192.168.240.255
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.179.11 node1
192.168.179.12 node2
192.168.179.21 node1-vip
192.168.179.22 node2-vip
192.168.240.31 node1-priv
192.168.240.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=/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的安装目录并授权
#groupadd oinstall
#groupadd dba
#useradd -g oinstall -G dba oracle
#passwd oracle
#id oracle
5)修改oracle用
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 /]# fdisk -l
Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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 1566 10940265 83 Linux
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Disk /dev/sdd: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 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 260 1044225 83 Linux
/dev/sdd3 261 390 1044225 83 Linux
/dev/sdd4 391 1566 9446220 5 Extended
/dev/sdd5 391 520 1044193+ 83 Linux
/dev/sdd6 521 650 1044193+ 83 Linux
/dev/sdd7 651 780 1044193+ 83 Linux
/dev/sdd8 781 910 1044193+ 83 Linux
/dev/sdd9 911 1040 1044193+ 83 Linux
/dev/sdd10 1041 1170 1044193+ 83 Linux
/dev/sdd11 1171 1300 1044193+ 83 Linux
/dev/sdd12 1301 1430 1044193+ 83 Linux
/dev/sdd13 1431 1566 1092388+ 83 Linux
Disk /dev/sde: 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/sde1 1 130 1044193+ 83 Linux
/dev/sde2 131 261 1052257+ 83 Linux
[root@node1 /]#
9)配置裸设备
+用服务的方式绑定,开机时自动加载裸设备
#vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdd1
/dev/raw/raw2 /dev/sdd2
/dev/raw/raw3 /dev/sdd3
/dev/raw/raw4 /dev/sdd5
/dev/raw/raw5 /dev/sdd6
/dev/raw/raw6 /dev/sdd7
/dev/raw/raw7 /dev/sdd8
/dev/raw/raw8 /dev/sdd9
/dev/raw/raw9 /dev/sdd10
/dev/raw/raw10 /dev/sdd11
/dev/raw/raw11 /dev/sdd12
/dev/raw/raw12 /dev/sdd13
/dev/raw/raw13 /dev/sde1
/dev/raw/raw14 /dev/sde2
然后启动服务:
#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)安装rpm包
rpm -Uvh compat-gcc-7.3-2.96.128.i386.rpm
rpm -Uvh compat-libstdc++-7.3-2.96.128.i386.rpm
rpm -Uvh compat-libstdc++-devel-7.3-2.96.128.i386.rpm
rpm -Uvh compat-gcc-c++-7.3-2.96.128.i386.rpm
[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.179.255
IPADDR=192.168.179.12
GATEWAY=192.168.179.2
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.240.32
GATEWAY=192.168.240.2
BROADCAST=192.168.240.255
HWADDR=00:0C:29:B9:4B:F2
ONBOOT=yes
TYPE=Ethernet
#service network restart
+修改.bash_profile
export ORACLE_SID=RACDB2
13)时间同步
+在node1节点启动时间服务
chkconfig time on
如果不启动该服务,则其他节点与该节点同步时间时会报错:Connect Refused
在node2节点与node1节点同步时间
rdate -s 192.168.179.11
# crontab -l
*/1 * * * * rdate -s 192.168.179.11
*/1 * * * * sleep 20; rdate -s 192.168.179.11
*/1 * * * * sleep 40; rdate -s 192.168.179.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
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
..
...
/dev/raw/raw13
....
/dev/raw/raw14
...
[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.179.21
node2-vip 192.168.179.22
安装结束后Exit.回到node1,按OK结束.
在Configuration Assistants中
Oracle Cluster Verification Utility 检查失败,但不影响正常运行。
Next -> Finish完成clusterware安装.
+检查安装后cluster的状态
[root@node1 ~]# /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)创建数据库
+in node1
+裸设备的配置文件
[oracle@node1 ~]$ cat raw.conf
control1=/dev/raw/raw1
control2=/dev/raw/raw2
redo1_1=/dev/raw/raw3
redo1_2=/dev/raw/raw4
redo2_1=/dev/raw/raw5
redo2_2=/dev/raw/raw6
sysaux=/dev/raw/raw7
system=/dev/raw/raw8
temp=/dev/raw/raw9
undotbs1=/dev/raw/raw10
undotbs2=/dev/raw/raw11
users=/dev/raw/raw12
19)dbca成功后
[root@node1 ~]# /ora10g/product/10.2.0/crs_1/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE node1
ora....B2.inst application ONLINE ONLINE node2
ora.RACDB.db application ONLINE ONLINE node2
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
[root@node1 ~]#
20)listener.ora, tnsnames.ora
[oracle@node2 admin]$ cat listener.ora
# listener.ora Network Configuration File: /ora10g/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER_NODE2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = RACDB2)
(ORACLE_HOME = /ora10g/product/10.2.0/db_1)
(SID_NAME = RACDB2)
)
)
LISTENER_NODE2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.179.12)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
[oracle@node2 admin]$
[oracle@node2 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /ora10g/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
RACDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RACDB)
(INSTANCE_NAME = RACDB1)
)
)
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RACDB)
)
)
LISTENERS_RACDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
)
RACDB2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RACDB)
(INSTANCE_NAME = RACDB2)
)
)
[oracle@node2 admin]$