使用 VMware 在 Oracle Enterprise Linux 上安装 Oracle RAC 10g

看了Wilson的视频讲座,也想安装一下rac,下面是安装的具体步骤。

1,安装虚拟机rac1
虚拟机版本:
VMware.GSX.Server.v3.2.0.14497

参考文档


1,环境
虚拟客户机环境
主机名 操作系统 处理器 内存
rac1 Oracle Enterprise linux 4 (32位) 1 1500M
rac2 Oracle Enterprise linux 4 (32位) 1 1500M

虚拟磁盘布局概况
主机操作系统上的虚拟磁盘 客户操作系统上的虚拟磁盘 虚拟设备节点 大小(MB) 描述
d:vm ac ac1localdisk.vmdk /dev/sda1 scsi 0:0 20000 "/"挂载点,交换空间,oracle二进制文件
d:vm acsharedstorageocfs2disk.vmdk /dev/sdb scsi 1:0 512 OCFS2磁盘
d:vm acsharedstorageasmdisk1.vmdk /dev/sdc scsi 1:1 3072 ASM 磁盘组 1
d:vm acsharedstorageasmdisk2.vmdk /dev/sdd scsi 1:2 3072 ASM 磁盘组 2
d:vm acsharedstorageasmdisk3.vmdk /dev/sde scsi 1:3 2048 ASM 闪回恢复区
(要配置共享存储,客户 OS 不能与共享存储共享同一个 SCSI 总线。指定客户 OS 使用 SCSI0,共享磁盘使用 SCSI1。)

RAC 数据库环境概况:
主机名 ASM实例名 RA实例名 数据库名 数据库文件存储 OCR 与表决磁盘 (Voting Disk)
rac1 +ASM1 devdb1 devdb ASM OCFS2
rac2 +ASM2 devdb2 devdb ASM OCFS2
在每个节点上安装 Oracle 主目录供冗余使用。每个节点上的 ASM 和 Oracle RAC 实例共享同一个 Oracle 主目录。


2. 配置第一个虚拟机
要创建和配置第一个虚拟机,您需要添加虚拟硬件设备,如磁盘和处理器。在继续执行安装之前,请创建以下 windows 文件夹以存放虚拟机和共享存储。

D:>mkdir vm ac ac1
D:>mkdir vm ac ac2
D:>mkdir vm acsharedstorage

双击桌面上的 VMware 图标以启动应用程序:
1,按 CTRL-N 创建一个新的虚拟机。
2,新建虚拟机向导:单击 Next。
3,选择适当的配置:
a,虚拟机配置:选择 Custom。
4,选择客户操作系统:
a,客户操作系统:选择 Linux。
b,版本:选择 Red Hat Enterprise Linux 4。
5,命名虚拟机:
a,虚拟机名称:输入“rac1”。
b,位置:输入“d:vm ac ac1”。
6,设置访问权限:
a,访问权限:选择 Make this virtual machine private。
7,启动/关闭选项:
a,虚拟机帐户:选择 User that powers on the virtual machine。
8,虚拟机内存:
a,内存:选择 1500MB。
9,网络类型:
a,网络连接:选择 Use bridged networking。
10,选择 I/O 适配器类型:
a,I/O 适配器类型:选择 LSI Logic。
11,选择磁盘:
a,磁盘:选择 Create a new virtual disk。
12,选择磁盘类型:
a,虚拟磁盘类型:选择 SCSI (Recommended)。
13,指定磁盘容量:
a,磁盘容量:输入“20GB”。
b,取消选择 Allocate all disk space now。为了节省空间,您现在不必分配所有磁盘空间。
14,指定磁盘文件:
a,磁盘文件:输入“localdisk.vmdk”。
b,单击 Finish。

重复步骤 16-24 以创建四个虚拟 SCSI 硬盘 — ocfs2disk.vmdk (512MB)、asmdisk1.vmdk (3GB)、asmdisk2.vmdk (3GB) 和 asmdisk3.vmdk (2GB)。

16,VMware Server控制台:选择虚拟机名字-右键选择“Virtual Machine Console"
17,Hardware--new
18,Add Hardware Wizard--next
19,Hardware types--Hard Disk--next
20,create a new virtual disk
21,Virtual Disk Type--SCSI(Recommended)
22,Disk size--0.5GB 选择allocate all disk space now
23,指定磁盘文件
a,磁盘文件:输入“d:vm acsharedstorageocfs2disk.vmdk”。
b,单击 Advanced。
24,新增硬件向导:
a,虚拟设备节点:选择 SCSI 1:0。
b,模式:选择 Independent,针对所有共享磁盘选择 Persistent。
c,单击 Finish。


最后,额外添加一个虚拟网卡以用于专用互联,并移除软盘驱动器(如果有)。

先按照文档设置增加:
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
scsi1.sharedBus = "virtual"


3. 在第一个虚拟机上安装并配置 Enterprise Linux
1,安装类型:自定义
2,分区:(sda)
/ 7G
swap 3G
/u01 其他所有

3,ip
eth0 172.25.1.131 255.255.0.0
eth1 10.10.10.31 255.255.255.0

hostname : rac1
gateway : 172.25.0.254

4,无防火墙,禁用selinux
5,语言:英文
6,时区:中国上海
7,软件:
选择 ocfs-2-2.6.9-42.0.0.0.1EL(UP 内核驱动程序),或者选择 ocfs-2-2.6.9-42.0.0.0.1ELsmp(SMP 内核驱动程序)。
选择 ocfs2-tools。
选择 ocfs2console。
选择 oracle oracleasm-2.6.9-42.0.0.0.1EL(UP 内核驱动程序),或者选择 oracleasm-2.6.9-42.0.0.0.1ELsmp(SMP 内核驱动程序)。


要确保成功安装 Oracle RAC,虚拟机上的时间必须与主机上的时间同步。
我们不选择安装vmtools,我们利用ntpd服务去同步另外一台服务器,这样的话两台客户机的时间也是一致的!

2,建立用户
[root@rac1 ~]# groupadd oinstall
[root@rac1 ~]# groupadd dba
[root@rac1 ~]# mkdir -p /export/home/oracle /ocfs
[root@rac1 ~]# useradd -d /export/home/oracle -g oinstall -G dba oracle
[root@rac1 ~]# chown oracle:dba /export/home/oracle /u01
[root@rac1 ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@rac1 ~]#

3,创建 oracle 用户环境文件。
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ ls
[oracle@rac1 ~]$ vi .bashrc
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export EDITOR=vi
export ORACLE_SID=devdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
umask 022
~
~
~
".bashrc" 16L, 458C written
[oracle@rac1 ~]$

创建文件系统目录结构。以 oracle 用户身份执行
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ mkdir -p $ORACLE_BASE/admin
[oracle@rac1 ~]$ mkdir -p $ORACLE_HOME
[oracle@rac1 ~]$ mkdir -p $ORA_CRS_HOME
[oracle@rac1 ~]$ mkdir -p /u01/oradata/devdb
[oracle@rac1 ~]$


提高 Oracle 用户的 shell 限制。使用文本编辑器将下面列出的行添加到 /etc/security/limits.conf、/etc/pam.d/login 和 /etc/profile。其他信息可以从文档中获得。

/etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

/etc/pam.d/login
session required /lib/security/pam_limits.so

/etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi


安装 Enterprise Linux 软件程序包。安装 Oracle 软件需要以下附加程序包。如果您已经安装了 64 位版本的 Enterprise Linux,则安装程序应该已安装了这些程序包。
libaio-0.3.105-2.i386.rpm
openmotif21-2.1.30-11.RHEL4.6.i386.rpm
从 ISO CD 解压缩这些程序包,并以 root 用户身份执行下面的命令。

[root@rac1 ~]# rpm -aq | grep libaio
[root@rac1 ~]# rpm -aq | grep openmotif
[root@rac1 ~]# ls
anaconda-ks.cfg install.log install.log.syslog libaio-0.3.105-2.i386.rpm openmotif21-2.1.30-11.RHEL4.6.i386.rpm
[root@rac1 ~]# rpm -Uvh *.rpm
warning: libaio-0.3.105-2.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing... ########################################### [100%]
1:openmotif21 ########################################### [ 50%]
2:libaio ########################################### [100%]
[root@rac1 ~]#


配置内核参数。使用文本编辑器将下面列出的行添加到 /etc/sysctl.conf。要使更改立即生效,请执行 /sbin/sysctl –p。
# more /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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


修改 /etc/hosts 文件。

127.0.0.1 localhost.localdomain localhost
172.25.1.131 rac1.mycorpdomain.com rac1
172.25.1.31 rac1-vip.mycorpdomain.com rac1-vip
10.10.10.31 rac1-priv.mycorpdomain.com rac1-priv
172.25.1.132 rac2.mycorpdomain.com rac2
172.25.1.32 rac2-vip.mycorpdomain.com rac2-vip
10.10.10.32 rac2-priv.mycorpdomain.com rac2-priv

配置 hangcheck timer 内核模块。hangcheck timer 内核模块可监控系统的运行情况,并重新启动出现故障的 RAC 节点。它使用两个参数,即 hangcheck_tick(定义系统检查频率)和 hangcheck_margin(定义在重置 RAC 节点前的最大挂起延时)来确定节点是否出现故障。
在 /etc/modprobe.conf 中添加以下行,以设置 hangcheck 内核模块参数。

/etc/modprobe.conf
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

要立即加载模块,执行“modprobe -v hangcheck-timer”。

执行效果:
[root@rac1 ~]# modprobe -v hangcheck-timer
insmod /lib/modules/2.6.9-42.0.0.0.1.ELsmp/kernel/drivers/char/hangcheck-timer.ko hangcheck_tick=30 hangcheck_margin=180
[root@rac1 ~]#


为 OCFS2 和 Oracle ASM 创建磁盘分区。为 OCFS2 (/dev/sdb) 和 Oracle ASM(/dev/sdc、/dev/sdd、/dev/sde)准备一组原始磁盘。

在 rac1 上,以 root 用户身份执行

[root@rac1 ~]# fdisk /dev/sdb

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-512, default 512):
Using default value 512

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]# fdisk /dev/sdc

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391):
Using default value 391

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]# fdisk /dev/sdd

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391):
Using default value 391

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]# fdisk /dev/sde

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-261, default 261):
Using default value 261

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 892 7164958+ 83 Linux
/dev/sda2 893 1274 3068415 82 Linux swap
/dev/sda3 1275 2610 10731420 83 Linux

Disk /dev/sdb: 536 MB, 536870912 bytes
64 heads, 32 sectors/track, 512 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 512 524272 83 Linux

Disk /dev/sdc: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdc1 1 391 3140676 83 Linux

Disk /dev/sdd: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdd1 1 391 3140676 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 261 2096451 83 Linux
[root@rac1 ~]#


安装 oracleasmlib 程序包。 从 OTN 下载 ASM 库,并以 root 用户身份安装 ASM RPM。

安装 oracleasmlib 程序包。 从 OTN 下载 ASM 库,并以 root 用户身份安装 ASM RPM。

[root@rac1 ~]# rpm -Uvh oracleasmlib-2.0.2-1.i386.rpm
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]

在这个阶段,您应该已经安装了以下 ASM 程序包。
[root@rac1 ~]# rpm -aq | grep oracleasm
oracleasm-support-2.0.3-2
oracleasmlib-2.0.2-1
oracleasm-2.6.9-42.0.0.0.1.ELsmp-2.0.3-2
[root@rac1 ~]#


为 ASM 磁盘映射原始设备。仅当您打算使用标准 Linux I/O 创建 ASM 磁盘时,才需要原始设备映射。创建 ASM 磁盘的另一个方法是使用 Oracle 提供的 ASM 库驱动程序。稍后,您将使用 ASM 库驱动程序配置 ASM 磁盘。
执行以下任务,将原始设备映射到先前创建的共享分区。每次引导集群节点时,原始设备都必须与块设备绑定。

将以下行添加到 /etc/sysconfig/rawdevices 中。

/etc/sysconfig/rawdevices

/dev/raw/raw1 /dev/sdc1
/dev/raw/raw2 /dev/sdd1
/dev/raw/raw3 /dev/sde1

要使映射立即生效,以 root 用户身份执行以下命令:

[root@rac1 ~]# service rawdevices restart
Assigning devices:
/dev/raw/raw1 --&gt /dev/sdc1
/dev/raw/raw1: bound to major 8, minor 33
/dev/raw/raw2 --&gt /dev/sdd1
/dev/raw/raw2: bound to major 8, minor 49
/dev/raw/raw3 --&gt /dev/sde1
/dev/raw/raw3: bound to major 8, minor 65
done
[root@rac1 ~]#

[root@rac1 ~]# chown oracle:dba /dev/raw/raw[1-3]
[root@rac1 ~]# chmod 660 /dev/raw/raw*
[root@rac1 ~]# ls -lat /dev/raw/raw*
crw-rw---- 1 oracle dba 162, 3 Sep 8 11:59 /dev/raw/raw3
crw-rw---- 1 oracle dba 162, 2 Sep 8 11:59 /dev/raw/raw2
crw-rw---- 1 oracle dba 162, 1 Sep 8 11:59 /dev/raw/raw1
[root@rac1 ~]#


以 oracle 用户身份执行

[oracle@rac1 ~]$ ln -sf /dev/raw/raw1 /u01/oradata/devdb/asmdisk1
[oracle@rac1 ~]$ ln -sf /dev/raw/raw2 /u01/oradata/devdb/asmdisk2
[oracle@rac1 ~]$ ln -sf /dev/raw/raw3 /u01/oradata/devdb/asmdisk3


修改 /etc/udev/permissions.d/50-udev.permissions。原始设备在引导时会重新映射。默认情况下,在引导时原始设备的拥有者将更改为 root 用户。如果拥有者不是 oracle 用户,则 ASM 在访问共享分区时会出现问题。在 /etc/udev/permissions.d/50-udev.permissions 中为原始行“raw/*:root:disk:0660”添加注释,然后添加一个新行“raw/*:oracle:dba:0660”。

/etc/udev/permissions.d/50-udev.permissions

# raw devices
ram*:root:disk:0660
#raw/*:root:disk:0660
raw/*:oracle:dba:0660

修改其他服务
vi /etc/inittab
id:3:initdefault:

chkconfig sendmail off


4. 创建并配置第二个虚拟机
要创建第二个虚拟机,只需关闭第一个虚拟机,将 d:vm ac ac1 中的所有文件复制到 d:vm ac ac2,然后更改几个配置即可。

修改网络配置。
1,在 rac1 上,以 root 用户身份执行
# shutdown –h now
2,在主机系统上,将 rac1 文件夹中的所有文件复制到 rac2。
D:>copy d:vm ac ac1 d:vm ac ac2
3,在 VMware Server 控制台上,按 CTRL-O 打开第二个虚拟机 d: ac ac2 hel4.vmx。
4,VMware Server 控制台:
将虚拟机名称从 rac1 重命名为 rac2。右键单击您刚才打开的新 rac1 选项卡,然后选择 Settings。
选择 Options 选项卡。
1. 虚拟机名称:输入“rac2”。
2,单击 Start this virtual machine 启动 rac2,保留 rac1 为电源关闭状态。
3,rac2 — 虚拟机:选择 Create a new identifier。

以 root 用户身份登录并执行 system-config-network,以修改网络配置。

IP 地址:双击每个以太网设备,并使用下面的表进行必要的更改。

设备 IP地址 子网掩码 默认网关地址
eth0 172.25.1.132 255.255.0.0 172.25.0.254
eth1 10.10.10.32 255.255.255.0

MAC 地址:导航到 Hardware Device 选项卡,并探测每个以太网设备的新 MAC 地址。

主机名和 DNS:使用下面的表对 DNS 选项卡中的项进行必要的更改,然后按 CTRL-S 保存。

主机名
rac2.mycorpdomain.com

最后,激活每个以太网设备。


修改 /export/home/oracle/.bashrc。用 devdb2 替换 ORACLE_SID 的值。


启动rac1


使用 SSH 建立用户等效性。在集群就绪服务 (CRS) 和 RAC 安装过程中,Oracle Universal Installer (OUI) 必须能够以 oracle 的身份将软件复制到所有 RAC 节点,而不提示输入口令。在 Oracle 10g 中,可以使用 ssh 代替 rsh 完成此操作。

要建立用户等效性,请在两个节点上以 oracle 用户身份生成用户的公钥和私钥。打开 rac1 的电源,在这两个节点上执行以下任务。


在 rac1 上执行
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ mkdir ~/.ssh
[oracle@rac1 ~]$ chmod 700 ~/.ssh
[oracle@rac1 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
3a:96:d2:f3:2e:d7:a1:d6:f6:34:5c:70:f7:01:89:f4 oracle@rac1
[oracle@rac1 ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
54:7c:bd:42:a1:29:99:fe:28:bf:6e:31:fb:f4:03:d8 oracle@rac1
[oracle@rac1 ~]$


在 rac2 上执行
[root@rac2 ~]# su - oracle
[oracle@rac2 ~]$ mkdir ~/.ssh
[oracle@rac2 ~]$ chmod 700 ~/.ssh
[oracle@rac2 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_rsa.
Your public key has been saved in /export/home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
ab:c5:52:ea:06:77:9f:0c:30:7f:f0:59:ec:6a:ad:04 oracle@rac2
[oracle@rac2 ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/export/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /export/home/oracle/.ssh/id_dsa.
Your public key has been saved in /export/home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
4a:55:0b:96:37:81:7e:2d:33:04:4b:86:2f:4e:0e:0b oracle@rac2
[oracle@rac2 ~]$


在 rac1 上执行
[oracle@rac1 ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[oracle@rac1 ~]$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[oracle@rac1 ~]$ ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
The authenticity of host 'rac2 (172.25.1.132)' can't be established.
RSA key fingerprint is 90:8e:7e:19:1b:c3:a7:0d:c1:1b:27:5f:cc:d7:23:39.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac2,172.25.1.132' (RSA) to the list of known hosts.
oracle@rac2's password:
[oracle@rac1 ~]$ ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@rac2's password:
[oracle@rac1 ~]$ scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
oracle@rac2's password:
authorized_keys 100% 1644 1.6KB/s 00:00
[oracle@rac1 ~]$


在每个节点上测试连接。验证当您再次运行以下命令时,系统是否不提示您输入口令。

ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
ssh rac1.mycorpdomain.com date
ssh rac2.mycorpdomain.com date
ssh rac1-priv.mycorpdomain.com date
ssh rac2-priv.mycorpdomain.com date

第一次运行需要输入口令,第二次就不需要了!


[oracle@rac1 ~]$ ssh rac1 date
Sat Sep 8 13:05:46 CST 2007
[oracle@rac1 ~]$ ssh rac2 date
Sat Sep 8 12:34:43 CST 2007
[oracle@rac1 ~]$ ssh rac1-priv date
Sat Sep 8 13:06:01 CST 2007
[oracle@rac1 ~]$ ssh rac2-priv date
Sat Sep 8 12:35:00 CST 2007
[oracle@rac1 ~]$ ssh rac1.mycorpdomain.com date
Sat Sep 8 13:06:16 CST 2007
[oracle@rac1 ~]$ ssh rac2.mycorpdomain.com date
Sat Sep 8 12:35:16 CST 2007
[oracle@rac1 ~]$ ssh rac1-priv.mycorpdomain.com date
Sat Sep 8 13:06:31 CST 2007
[oracle@rac1 ~]$ ssh rac2-priv.mycorpdomain.com date
Sat Sep 8 12:35:32 CST 2007
[oracle@rac1 ~]$


[oracle@rac2 ~]$ ssh rac1 date
Sat Sep 8 13:08:22 CST 2007
[oracle@rac2 ~]$ ssh rac2 date
Sat Sep 8 12:37:36 CST 2007
[oracle@rac2 ~]$ ssh rac1-priv date
Sat Sep 8 13:08:33 CST 2007
[oracle@rac2 ~]$ ssh rac2-priv date
Sat Sep 8 12:37:52 CST 2007
[oracle@rac2 ~]$ ssh rac1.mycorpdomain.com date
Sat Sep 8 13:08:47 CST 2007
[oracle@rac2 ~]$ ssh rac2.mycorpdomain.com date
Sat Sep 8 12:38:09 CST 2007
[oracle@rac2 ~]$ ssh rac1-priv.mycorpdomain.com date
Sat Sep 8 13:08:59 CST 2007
[oracle@rac2 ~]$ ssh rac2-priv.mycorpdomain.com date
Sat Sep 8 12:38:26 CST 2007
[oracle@rac2 ~]$

5. 配置 Oracle 自动存储管理 (ASM)
Oracle ASM 与 Oracle 数据库紧密集成在一起,并与 Oracle 的数据管理工具套件配合工作。它可以简化数据库存储管理,并提供原始磁盘 I/O 的性能。

配置 ASMLib。以 root 用户身份在两个节点上配置 ASMLib。

[root@rac1 ~]# /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
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]
[root@rac1 ~]#

创建 ASM 磁盘。以 root 用户身份在任何一个节点上创建 ASM 磁盘。
[root@rac1 ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk: [ OK ]
[root@rac1 ~]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk: [ OK ]
[root@rac1 ~]# /etc/init.d/oracleasm createdisk VOL3 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk: [ OK ]
[root@rac1 ~]# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]
[root@rac1 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
[root@rac1 ~]#


6. 配置 Oracle 集群文件系统 (OCFS2)
OCFS2 是 Oracle 开发的一个通用集群文件系统,与 Enterprise Linux 内核集成在一起。它允许所有节点在集群文件系统上同时共享文件,因而消除了管理原始设备的需求。这里,您将在 OCFS2 文件系统中寄宿 OCR 和表决磁盘。您可以从 OCFS2 用户指南获取有关 OCFS2 的其他信息。

在 Enterprise Linux 安装期间,您应该已经安装了 OCFS2 RPM。验证 RPM 是否已经安装在两个节点上。

[root@rac1 ~]# rpm -aq | grep ocfs
ocfs2-2.6.9-42.0.0.0.1.ELsmp-1.2.3-2
ocfs2-tools-1.2.2-2
ocfs2console-1.2.2-2
[root@rac1 ~]#

创建 OCFS2 配置文件。 在 rac1 上,以 root 用户身份执行

图形界面运行
# ocfs2console
1,OCFS2 控制台:选择 Cluster,然后选择 Configure Nodes。
2,“集群堆栈已经启动”:单击 Close。
3,节点配置:单击 Add。
4,新增节点:添加以下节点,然后单击 Apply。
名称:rac1
IP 地址: 172.25.1.131
IP 端口: 7777
名称:rac2
IP 地址: 172.25.1.132
IP 端口: 7777
5,验证生成的配置文件。
[root@rac1 ~]# more /etc/ocfs2/cluster.conf
node:
ip_port = 7777
ip_address = 172.25.1.131
number = 0
name = rac1
cluster = ocfs2

node:
ip_port = 7777
ip_address = 172.25.1.132
number = 1
name = rac2
cluster = ocfs2

cluster:
node_count = 2
name = ocfs2

[root@rac1 ~]#


6,将配置文件传播到 rac2。您可以在 rac2 上重新运行上述步骤以生成配置文件,或者在 rac1 的 OCFS2 控制台上选择 Cluster 和 Propagate Configuration 以将配置文件传播到 rac2。

配置 O2CB 驱动程序。O2CB 是一组集群服务,负责管理节点与集群文件系统之间的通信。下面是对各个服务的说明:
NM:用于跟踪 cluster.conf 中的所有节点的节点管理器
HB:当节点加入或离开集群时向上/向下发出通知的心跳服务
TCP:处理节点之间的通信
DLM:用于跟踪所有锁、这些锁的所有者以及状态的分布式锁管理器
CONFIGFS:在 /config 中挂载的用户空间驱动的配置文件系统
DLMFS:用户空间与内核空间 DLM 的接口


在两个节点上执行下面的过程,将 O2CB 配置为在引导时启动。

当系统提示您指定心跳死亡阈值时,您必须指定一个大于 7 的值,以防止节点由于较慢的 IDE 磁盘驱动器而崩溃。心跳死亡阈值是一个用于计算隔离时间的变量。

Fence time (seconds) = (heartbeat dead threshold -1) * 2
在我们的环境中,120 秒的隔离时间很合适。两个节点上的心跳死亡阈值应该完全相同。

以 root 用户身份执行

[root@rac1 ~]# /etc/init.d/o2cb unload
Stopping O2CB cluster ocfs2: OK
Unmounting ocfs2_dlmfs filesystem: OK
Unloading module "ocfs2_dlmfs": OK
Unmounting configfs filesystem: OK
Unloading module "configfs": OK
[root@rac1 ~]# /etc/init.d/o2cb configure
Configuring the O2CB driver.

This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets ('[]'). Hitting
without typing an answer will keep that current value. Ctrl-C
will abort.

Load O2CB driver on boot (y/n) [n]: y
Cluster to start on boot (Enter "none" to clear) [ocfs2]:
Specify heartbeat dead threshold (>=7) [7]: 61
Writing O2CB configuration: OK
Loading module "configfs": OK
Mounting configfs filesystem at /config: OK
Loading module "ocfs2_nodemanager": OK
Loading module "ocfs2_dlm": OK
Loading module "ocfs2_dlmfs": OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Starting O2CB cluster ocfs2: OK
[root@rac1 ~]#


rac2上执行有一些不同
[root@rac2 ~]# /etc/init.d/o2cb unload
[root@rac2 ~]# /etc/init.d/o2cb configure
Configuring the O2CB driver.

This will configure the on-boot properties of the O2CB driver.
The following questions will determine whether the driver is loaded on
boot. The current values will be shown in brackets ('[]'). Hitting
without typing an answer will keep that current value. Ctrl-C
will abort.

Load O2CB driver on boot (y/n) [n]: y
Cluster to start on boot (Enter "none" to clear) [ocfs2]:
Specify heartbeat dead threshold (>=7) [7]: 61
Writing O2CB configuration: OK
Loading module "configfs": OK
Creating directory '/config': OK
Mounting configfs filesystem at /config: OK
Loading module "ocfs2_nodemanager": OK
Loading module "ocfs2_dlm": OK
Loading module "ocfs2_dlmfs": OK
Creating directory '/dlm': OK
Mounting ocfs2_dlmfs filesystem at /dlm: OK
Starting O2CB cluster ocfs2: OK
[root@rac2 ~]#

格式化文件系统。在格式化和挂载文件系统之前,应验证 O2CB 在两个节点上均联机;O2CB 心跳当前没有活动,因为文件系统未挂载。
[root@rac1 ~]# /etc/init.d/o2cb status
Module "configfs": Loaded
Filesystem "configfs": Mounted
Module "ocfs2_nodemanager": Loaded
Module "ocfs2_dlm": Loaded
Module "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Checking O2CB heartbeat: Not active
[root@rac1 ~]#

[root@rac2 ~]# /etc/init.d/o2cb status
Module "configfs": Loaded
Filesystem "configfs": Mounted
Module "ocfs2_nodemanager": Loaded
Module "ocfs2_dlm": Loaded
Module "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Checking O2CB heartbeat: Not active
[root@rac2 ~]#

您只需在一个节点上格式化文件系统。在 rac1 上,以 root 用户身份执行

图形界面
# ocfs2console


1,OCFS2 控制台:选择 Tasks、Format。
2,格式:
可用设备:/dev/sdb1
卷标:oracle
集群大小:Auto
节点插槽数量: 4
块大小:Auto
3,OCFS2 控制台:按 CTRL-Q 退出。


挂载文件系统。要挂载文件系统,在两个节点上执行以下命令。
# mount -t ocfs2 -o datavolume,nointr /dev/sdb1 /ocfs
要在引导时挂载文件系统,在两个节点的 /etc/fstab 中添加以下行。

/etc/fstab

/dev/sdb1 /ocfs ocfs2 _netdev,datavolume,nointr 0 0


创建 Oracle 集群件目录。在 OCR 和表决磁盘将驻留的 OCFS2 文件系统中创建目录。
在 rac1 上执行

[root@rac1 ~]# mkdir /ocfs/clusterware
[root@rac1 ~]# chown -R oracle:dba /ocfs

现在,您已经完成了 OCFS2 的设置。验证您可以在两个节点的共享集群文件系统上读写文件。
在一个系统上在/ocfs目录下创建文件夹,在另外一个系统上查看是否可以看到。


到这里一切正常,备份一下。


7. 安装 Oracle 集群件
下载后,在 rac1 上以 oracle 用户身份执行

rac1-> /u01/staging/clusterware/runInstaller

1,欢迎页面:单击 Next。
2,指定 Inventory 目录和证书:
输入 inventory 目录的完整路径:/u01/app/oracle/oraInventory。
指定操作系统组名:oinstall。
3,指定 Home 详细内容:
名称:OraCrs10g_home
/u01/app/oracle/product/10.2.0/crs_1
4,特定于产品的必要条件检查:
忽略有关物理内存要求的警告。
5,指定集群配置:单击 Add。
公共节点名称:rac2.mycorpdomain.com
专用节点名称:rac2-priv.mycorpdomain.com
虚拟主机名称:rac2-vip.mycorpdomain.com
6,指定网络接口用法:
接口名称:eth0
子网: 172.25.0.0
接口类型:Public
接口名称:eth1
子网: 10.10.10.0
接口类型:Private
7,指定 Oracle 集群注册表 (OCR) 位置:选择 External Redundancy。
为了简单起见,这里将不镜像 OCR。在生产环境中,您可能会考虑复用 OCR 以实现更高的冗余。
指定 OCR 位置:/ocfs/clusterware/ocr
8,指定表决磁盘位置:选择 External Redundancy。
同样,为了简单起见,我们选择不镜像表决磁盘。
表决磁盘位置:/ocfs/clusterware/votingdisk
9,摘要:单击 Install。
10,执行配置脚本:以 root 用户身份按顺序执行以下脚本(一次执行一个)。在当前脚本完成后,再继续执行下一个脚本。
在 rac1 上执行 /u01/app/oracle/oraInventory/orainstRoot.sh。
在 rac2 上执行 /u01/app/oracle/oraInventory/orainstRoot.sh。
在 rac1 上执行 /u01/app/oracle/product/10.2.0/crs_1/root.sh。
在 rac2 上执行 /u01/app/oracle/product/10.2.0/crs_1/root.sh。
rac2 上的 root.sh 脚本会自动调用 VIPCA,但会因为“The given interface(s), "eth0" is not public.Public interfaces should be used to configure virtual IPs.”错误而失败。如果您的公共接口使用不可路由的 IP 地址 (192.168.x.x),则 Oracle 集群验证实用程序 (CVU) 将无法找到合适的公共接口。一种解决方法是手动运行 VIPCA。

[root@rac1 logs]# /u01/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
[root@rac1 logs]# /u01/app/oracle/product/10.2.0/crs_1/root.sh
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' 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 '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
assigning default hostname rac1 for node 1.
assigning default hostname rac2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac1 rac1-priv rac1
node 2: rac2 rac2-priv rac2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Now formatting voting device: /ocfs/clusterware/votingdisk
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.
rac1
rac2
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
Waiting for the Oracle CRSD and EVMD to start
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@rac1 logs]#


[root@rac2 ~]# /u01/app/oracle/oraInventory/orainstRoot.sh
Creating the Oracle inventory pointer file (/etc/oraInst.loc)
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
[root@rac2 ~]# /u01/app/oracle/product/10.2.0/crs_1/root.sh
WARNING: directory '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' 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 '/u01/app/oracle/product/10.2.0' is not owned by root
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' is not owned by root
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
assigning default hostname rac1 for node 1.
assigning default hostname rac2 for node 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac1 rac1-priv rac1
node 2: rac2 rac2-priv rac2
clscfg: Arguments check out successfully.

NO KEYS WERE WRITTEN. Supply -force parameter to override.
-force is destructive and will destroy any previous cluster
configuration.
Oracle Cluster Registry for cluster has already been initialized
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.
rac2
CSS is inactive on these nodes.
rac1
Local node checking complete.
Run root.sh on remaining nodes to start CRS daemons.
[root@rac2 ~]#

11,以 root 用户身份在第二个节点上手动调用 VIPCA。
# /u01/app/oracle/product/10.2.0/crs_1/bin/vipca
12,欢迎页面:单击 Next。
13,网络接口:选择 eth0。
14,集群节点的虚拟 IP:
节点名称:rac1
IP 别名:rac1-vip
IP 地址: 192.168.2.31
子网掩码: 255.255.255.0
节点名称:rac2
IP 别名:rac2-vip
IP 地址: 192.168.2.32
子网掩码: 255.255.255.0
15,摘要:单击 Finish。

16,配置助手进度对话框:配置完成后,单击 OK。
17,配置结果:单击 Exit。
18,返回到 rac1 的执行配置脚本屏幕,然后单击 OK。

19,配置助手:验证所有检查均成功。OUI 在最后会执行集群件安装后检查。如果 CVU 失败,请更正问题,并以 oracle 用户身份重新运行以下命令:

[oracle@rac1 ~]$ /u01/app/oracle/product/10.2.0/crs_1/bin/cluvfy stage -post crsinst -n rac1,rac2

Performing post-checks for cluster services setup

Checking node reachability...
Node reachability check passed from node "rac1".


Checking user equivalence...
User equivalence check passed for user "oracle".

Checking Cluster manager integrity...


Checking CSS daemon...
Daemon status check passed for "CSS daemon".

Cluster manager integrity check passed.

Checking cluster integrity...


Cluster integrity check passed


Checking OCR integrity...

Checking the absence of a non-clustered configuration...
All nodes free of non-clustered, local-only configurations.

Uniqueness check for OCR device passed.

Checking the version of OCR...
OCR of correct Version "2" exists.

Checking data integrity of OCR...
Data integrity check for OCR passed.

OCR integrity check passed.

Checking CRS integrity...

Checking daemon liveness...
Liveness check passed for "CRS daemon".

Checking daemon liveness...
Liveness check passed for "CSS daemon".

Checking daemon liveness...
Liveness check passed for "EVM daemon".

Checking CRS health...
CRS health check passed.

CRS integrity check passed.

Checking node application existence...


Checking existence of VIP node application (required)
Check passed.

Checking existence of ONS node application (optional)
Check passed.

Checking existence of GSD node application (optional)
Check passed.


Post-check for cluster services setup was successful.
[oracle@rac1 ~]$

20,安装结束:单击 Exit。


中间有一次两台服务器的时间不对,重新安装。


安装 Oracle 数据库 10g 第 2 版

安装成功。安装数据库的详细步骤就不写了,按照参考文档写

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/312079/viewspace-245758/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/312079/viewspace-245758/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值