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

tonykorn97發表於2007-09-10

看了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 ~]$ 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 ~]$


在 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 ~]$ 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 ~]$


在 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.
password:
[oracle@rac1 ~]$ ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
password:
[oracle@rac1 ~]$ scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章