Linux環境Oracle10gR2 RAC教程(超級詳細,適合新手,跟着做,絕對成功)

一、 驗證操作系統配置是否符合安裝要求
在兩臺機器上以ROOT身份做
內核要求
安裝oracle 10g要求Linux系統內核爲2.4.9-e.25(或更高版本)

[root@node1 ~]# uname -r
2.6.9-22.Elsmp	

所需程序包要求
其他所需程序包的版本:

gcc-2.96-124 (或更高版本)
make-3.79 (或更高版本)
binutils-2.11 (或更高版本)
openmotif-2.1.30-11 (或更高版本)
glibc-2.2.4-31(或更高版本)
[root@node1 ~]# rpm -q gcc make binutils openmotif glibc
gcc-3.4.4-2
make-3.80-5
binutils-2.15.92.0.2-15
openmotif-2.2.3-9.RHEL4.1
openmotif-2.2.3-9.RHEL4.1
glibc-2.3.4-2.13
glibc-2.3.4-2.13

SWAP分區要求
Oracle在超過8G推薦Swap分區爲物理內存的0.8-2倍(視物理內存的大小而定)

[root@node1 ~]# free  -t
             total       used       free     shared    buffers     cached
Mem:      32913828    1678788   31235040          0      70612    1345352
-/+ buffers/cache:     262824   32651004
Swap:     27647856          0   27647856
Total:    60561684    1678788   58882896

經過驗證該操作系統符合安裝要求,可以安裝oracle 10gR2

二、配置網絡
在兩臺機器上以ROOT身份做
配置網關
在/etc/sysconfig/network里加GATEWAY=10.0.38.254

[root@node1 ~] cat > /etc/sysconfig/network <<EOF
NETWORKING=yes
HOSTNAME=node1 (另一個節點爲node2)
GATEWAY=10.10.21.121
EOF

配置RAC相關IP地址映射,在兩臺機器上以ROOT身份做

[root@node1 ~] cat > /etc/hosts <<EOF
127.0.0.1  localhost
11.11.11.1  node1-priv
10.10.21.141  node1
10.10.21.41  node1-vip

11.11.11.2   node2-priv
10.10.21.142  node2
10.10.21.42 node2-vip
EOF

三、配置 ROOT用戶內核環境變量
在兩臺機器上以ROOT身份做,在/root/.bash_profile里加在EXPORT LD_ASSUME_KERNEL=2.4.19

[root@node1 ~] cat >> /root/.bash_profile <<EOF
export LD_ASSUME_KERNEL=2.4.19
EOF
 [root@node1 ~]source /root/.bash_profile

四、配置時鐘同步(NTP服務器)

[root@node1 ~] cat > /etc/ntp.conf <<EOF
restrict default ignore 
restrict 10.10.21.0 mask 255.255.255.0 notrap nomodify
server 127.127.1.1            
fudge  127.127.1.1 stratum 10 refid NIST   
driftfile /etc/ntp.drift        
logfile   /var/log/ntp.log     
Broadcastdelay  0.008 
EOF

該節點作爲ntp服務器的server端

[root@node1~]service ntpd restart
[root@node1~]chkconfig --level 35 ntpd on

在節點二上以ROOT身份改寫配置文件/etc/ntp.conf爲

[root@node2~]cat > /etc/ntp.conf <<EOF
restrict default ignore
restrict 127.0.0.1 
restrict 10.10.21.0 mask 255.255.255.0 nomodify
server   10.10.21.141
restrict 10.10.21.141
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
keys /etc/ntp/keys 
EOF

該節點作爲ntp服務器的client端

[root@node2~]service ntpd restart
[root@node2~]chkconfig --level 35 ntpd on

用戶可用以下兩個常用命令查看ntpd服務狀態:

1 ntpq -p
2 ntpstat

五、配置並加載 HANGCHECK-TIMER 模塊
在兩臺機器上以ROOT身份做

[root@node1 ~]echo "options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180" >> /etc/modprobe.conf
[root@node1 ~]/sbin/modprobe hangcheck-timer

檢查設置

[root@node1 ~]grep Hangcheck /var/log/messages | tail -2
Nov 16 13:58:08 node2 kernel: Hangcheck: starting hangcheck timer 0.9.0 (tick is 30 seconds, margin is 180 seconds).
Nov 16 13:58:08 node2 kernel: Hangcheck: Using monotonic_clock().

六、配置內核

[root@node1 ~] cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 4294967296(該值至少應是物理內存的1/2,建議設爲物理內存大小)
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 = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF

運行以下命令激活更改

[root@node1 ~] # /sbin/sysctl  -p

用以下命令驗證相應的參數值

#/sbin/sysctl -a | grep sem(針對修改的每個參數值分別驗證)

七、創建 相關組和用戶帳戶和相關路徑
在兩臺機器上以ROOT身份做

[root@node1 ~] # /usr/sbin/groupadd oinstall
[root@node1 ~] # /usr/sbin/groupadd dba
[root@node1 ~] # /usr/sbin/useradd -m -g oinstall -G dba oracle
[root@node1 ~] # id oracle
uid=500(oracle) gid=501(oinstall) groups=501(oinstall),502(dba)
[root@node1 ~] # 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@node1 ~] # mkdir    -p  /u01/app/oracle 
[root@node1 ~] #mkdir    -p  /u01/app/crs
[root@node1 ~] # mkdir    -p  /mnt/oradata/
[root@node1 ~] # chown   -R  oracle:oinstall /u01/app/oracle /mnt/oradata/ /u01/app/crs
[root@node1 ~] # chmod   -R  775   /u01/app/oracle /mnt/oradata/ /u01/app/crs

八、爲 ORACLE 用戶設置 SHELL 限制
在兩臺機器上以ROOT身份做 ,配置oracle用戶可以使用的進程數和打開的文件數。

[root@node1 ~] # cat >> /etc/security/limits.conf <<EOF
oracle               soft    nproc    2047
oracle               hard    nproc   16384
oracle               soft    nofile    1024
oracle               hard    nofile   65536
EOF
[root@node1 ~] # cat >> /etc/pam.d/login <<EOF
session    required     /lib/security/pam_limits.so
EOF
[root@node1 ~] # cat >> /etc/profile <<EOF
if [ \$USER = "oracle" ]; then  
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi	
EOF
[root@node1 ~] # cat >> /etc/csh.login <<EOF
if ( \$USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
umask 022
endif
EOF

九、配置用戶等效性
在兩臺機器上以ORACLE身份做
生成 SSH 的公共密鑰和專用密鑰

[oracle@node2 ~]$mkdir ~/.ssh
[oracle@node2 ~]$chmod 755 ~/.ssh
[oracle@node2 ~]$/usr/bin/ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
4b:df:76:77:72:ba:31:cd:c4:e2:0c:e6:ef:30:fc:37 [email protected]

這裏一路按回車選擇默認就行

[oracle@node2 ~]$ /usr/bin/ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:	
af:37:ca:69:3c:a0:08:97:cb:9c:0b:b0:20:70:e3:4a [email protected]

這裏一路按回車選擇默認就行

將公共密鑰文件拷貝到其他節點
現在,必須將每個主機上的公共密鑰文件 id_rsa.pub 和 id_dsa.pub 的內容複製到其他每個主機的 ~/.ssh/authorized_keys 文件中。使用ssh將每個文件的內容複製到 ~/.ssh/authorized_keys文件。請注意,當您使用ssh第一次訪問遠程主機時,其 RSA 密鑰將是未知的,從而將提示您確認是否希望連接該主機。SSH 將記錄該遠程主機的 RSA 密鑰,並在以後連接該主機時不再做出相關提示。
只需在第一個主機上,以 oracle 用戶身份登錄(複製本地帳戶的密鑰,以便連接本地主機的 ssh 能夠起作用):
(如果您要剪切和粘貼這些命令,則分別運行它們。 SSH 每次會提示輸入 oracle 的口令,如果同時粘貼這些命令,則第一個命令在提示輸入口令之前刷新輸入緩衝區,從而導致其他命令將會丟失。)

[root@node1 ~]cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@node1 ~] cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[root@node1 ~] ssh oracle@node2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys (另一個節點爲node1)
The authenticity of host 'dbrac02 (10.49.9.100)' can't be established.
RSA key fingerprint is d1:23:a7:df:c5:fc:4e:10:d2:83:60:49:25:e8:eb:11.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'dbrac02,10.49.9.100' (RSA) to the list of known hosts.
oracle@dbrac02's password: 
[root@node1 ~] ssh oracle@node2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys(另一個節點爲node1)
oracle@dbrac02's password:
 [root@node1 ~] chmod 644 ~/.ssh/authorized_keys

如果是多臺主機做rac集羣的話要對第二,第三,第四個主機做同樣的處理。請注意,這次有的SSH不會提示您輸入oracle的口令。這是因爲第一個主機(dbrac01)現在知道了第二個主機的公共密鑰,而SSH現在使用的是一種不同的認證協議。
最後,在每個節點上ssh一下所有結點(包括自己)

驗證等效性配置

[root@node1 ~] ssh node2 date
The authenticity of host 'dbrac02 (10.49.9.100)' can't be established.
RSA key fingerprint is 8f:a3:19:76:ca:4f:71:85:42:c2:7a:da:eb:53:76:85.
Are you sure you want to continue connecting (yes/no)? yes
Sun Nov 17 19:07:19 CDT 2019

該消息只有在遠程節點上第一次執行操作時纔會出現,因此通過測試連通性,您不僅確保了遠程操作的正常運行,還完成了初始的安全密鑰交換。

十、設置ORACLE用戶的環境變量

[oracle@node1 ~]$cat > /home/oracle/.bash_profile <<EOF
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
          . ~/.bashrc
fi
# User specific environment and startup programs
export  ORACLE_BASE=/u01/app/oracle
export  ORACLE_HOME=\$ORACLE_BASE/product/102
export  ORA_CRS_HOME=/u01/app/crs
export  CRS_HOME=/u01/app/crs
export  ORACLE_SID=dbroker1  (另一個節點爲dbroker2)
export  TNS_ADMIN=\$ORACLE_HOME/network/admin
export  PATH=\$ORACLE_HOME/bin:\$ORA_CRS_HOME/bin:/sbin:\$ORA_ASM_HOME: \$PATH:\$HOME/bin:.
export  DISPLAY=10.0.20.19:0.0
export  NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss' 
export  NLS_LANG=american_america.zhs16gbk 
export  LD_ASSUME_KERNEL=2.4.19
unset   USERNAME
EOF
[oracle@node1 ~]source .bash_profile

十一、創建物理卷和綁定設備(要做邏輯分區跳過這一步)
在一個節點上以ROOT身份做

OCR及VOTING DISK安裝路徑
先解釋一下ocr(sdb1)和vote(sdb2)文件的用途,
OCR(Oracle Cluster Registry):它記錄了機羣配置和機羣數據庫的基本配置,默認大概需要100M的空間,這裏我們給了它200M的空間,並且考慮到冗餘性,ocr有2個;
Vote:它是CSS(Cluster Synchronization Services)需要的文件,用來判斷機羣內各個節點的狀態,默認大概也需要100M的空間,這裏我們也給了它200M的空間,並且考慮到冗餘性,vote有3個。
我們做如下規劃:
sdd1 sdd2 200M OCR
sdd3 sdd5 sdd6 200M voting disk
sdd7 sdd8 500G
sdd4爲擴展分區號,在這裏不使用

分區
使用fdisk命令按以上規劃進行分區(如果是大分區,用parted /dev/sdb命令),然後在node1和node2上執行#partprobe命令同步分區信息

在兩個節點上以ROOT身份做

綁定裸設備

raw /dev/raw/raw1 /dev/sdd1 
raw /dev/raw/raw2 /dev/sdd2   
raw /dev/raw/raw3 /dev/sdd3   
raw /dev/raw/raw4 /dev/sdd5  
raw /dev/raw/raw5 /dev/sdd6  
raw /dev/raw/raw6 /dev/sdd7   
raw /dev/raw/raw7 /dev/sdd8  

然後在/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

權限

chown root:oinstall /dev/raw/raw1
chmod 640 /dev/raw/raw1
chown root:oinstall /dev/raw/raw2
chmod 640 /dev/raw/raw2
chown oracle:dba /dev/raw/raw3
chmod 660 /dev/raw/raw3
chown oracle:dba /dev/raw/raw4
chmod 660 /dev/raw/raw4
chown oracle:dba /dev/raw/raw5
chmod 660 /dev/raw/raw5
chown oracle:dba /dev/raw/raw6
chmod 660 /dev/raw/raw6
chown oracle:dba /dev/raw/raw7
chmod 660 /dev/raw/raw7
在/etc/rc.local里加如下內容
chown root:oinstall /dev/raw/raw1(如果安裝軟件時出問題,則把root改爲oracle)
chmod 640 /dev/raw/raw1
chown root:oinstall /dev/raw/raw2
chmod 640 /dev/raw/raw2
chown oracle:dba /dev/raw/raw3
chmod 660 /dev/raw/raw3
chown oracle:dba /dev/raw/raw4
chmod 660 /dev/raw/raw4
chown oracle:dba /dev/raw/raw5
chmod 660 /dev/raw/raw5
chown oracle:dba /dev/raw/raw6
chmod 660 /dev/raw/raw6
chown oracle:dba /dev/raw/raw7
chmod 660 /dev/raw/raw7

十二、創建邏輯卷和綁定設備(要做物理分區跳過這一步)
創建物理卷

[root@node1 ~]pvcreate -f /dev/sdc (如果sdb上已經劃分了邏輯卷:把/dev目錄下和捲住同名的文件刪除如:rm –rf /dev/vg00[在兩個節點上做]並用pvcreate -ff /dev/sdb命令重置)
[root@node1 ~]vgscan

創建卷組

[root@node1 ~]vgcreate -s 4m vg01 /dev/sdc

創建邏輯卷

[root@node1 ~]
lvcreate -L 1000 -n ocr01 vg01
lvcreate -L 1000 -n ocr02 vg01
lvcreate -L 1000 -n voting01 vg01
lvcreate -L 1000 -n voting02 vg01
lvcreate -L 1000 -n voting03 vg01
lvcreate -L 500000 -n dbfs vg01

激活卷組

[root@node1 ~]vgchange -a y

在另一個節點上以ROOT身份做

[root@node2 ~]vgscan
[root@node2 ~]vgchange -a y

查看卷組詳細信息命令

Vgdisplay -v vg00

映射裸設備,在兩個列點上以ROOT身份做

[root@node1 ~]	
raw /dev/raw/raw1  /dev/vg01/ocr01
raw /dev/raw/raw2  /dev/vg01/ocr02
raw /dev/raw/raw3  /dev/vg01/voting01
raw /dev/raw/raw4  /dev/vg01/voting02
raw /dev/raw/raw5  /dev/vg01/voting03
raw /dev/raw/raw6  /dev/vg01/dbfs

寫入到文件

[root@node1 ~]raw -qa|awk '{print $1,$5,$7}'|tr ':' ' '|tr ',' ' ' >/etc/sysconfig/rawdevices

設定裸設備所有者和權限

[root@node1 ~]
chown oracle:dba /dev/raw/raw*
chmod 660     /dev/raw/raw*
chown root:oinstall /dev/raw/raw1 
chmod 640 /dev/raw/raw1
chown root:oinstall /dev/raw/raw2
chmod 640 /dev/raw/raw2

寫入rc.local文件以便啓動時自動執行

[root@node1 ~] cat >> /etc/rc.local <<EOF
/bin/chown oracle:dba /dev/raw/raw*
/bin/chmod 660     /dev/raw/raw*
/bin/chown root:oinstall /dev/raw/raw1
/bin/chmod 640 /dev/raw/raw1
/bin/chown root:oinstall /dev/raw/raw2
chmod 640 /dev/raw/raw2
EOF	

查看裸設備的詳細信息

raw –qa
ls -l /dev/vg00

十三、給AS4U2操作系統打補丁

[root@node1 patchforas4u2]# rpm -qa | grep binutils
[root@node1 patchforas4u2]# rpm -Uvh binutils-2.15.92.0.2-15.0.0.0.2.x86_64.rpm
[root@node1 patchforas4u2]# rpm -qa | grep binutils
binutils-2.15.92.0.2-15.0.0.0.2

運行 CVU 的第二個先決條件是針對 Red Hat Linux 用戶的。如果運行的是 Red Hat Linux,則必須下載 Red Hat 操作系統程序包 cvuqdisk 並將其安裝到集羣中的兩個 Oracle RAC 節點上。這意味着您將需要在 linux1 和 linux2 上安裝 cvuqdisk RPM。如果沒有 cvuqdisk,CVU 將無法發現共享磁盤,您在運行 CVU 時會收到錯誤消息“Package cvuqdisk not installed(程序包 cvuqdisk 未安裝)”。cvuqdisk RPM 可在Oracle 集羣件安裝介質的rpm 目錄中找到。將 Oracle 集羣件介質解壓縮到 linux1 上的 /u01/app/oracle/orainstall/clusterware 目錄。注意,在安裝 cvuqdisk RPM 之前,我們需要設置名爲 CVUQDISK_GRP 的環境變量,使其指向將要擁有 cvuqdisk 實用程序的組。默認的組是 oinstall,這不是本文中我們用於 oracle UNIX 用戶帳戶的組。因爲我們使用的是 dba 組,所以需要在嘗試安裝 cvuqdisk RPM 之前設置 CVUQDISK_GRP=dba。

[root@node1 ]#cd /inst_rac/crs_10.1/clusterware/rpm
[root@node1 rpm]# export CVUQDISK_GRP=dba
[root@node1 rpm]# rpm -iv cvuqdisk-1.0.1-1.rpm
[root@node1 rpm]# ls -l /usr/sbin/cvuqdisk
-rwsr-x---  1 root dba 4168 Jun  3  2005 /usr/sbin/cvuqdisk

十四、使用CVU驗證安裝環境是否符合安裝CRS軟件要求
在上傳CRS安裝軟件的機器上以ROOT身份做

[root@node2 ~]chmod -R 777 /tmp/

在上傳CRS安裝軟件的機器上以ORACLE身份做

[oracle@node2 ~]cd /root/inst_rac/crs_10.1/clusterware/cluvfy

利用 CVU 檢查 CRS 的安裝前任務

[oracle]@node1 cluvfy]# ./runcluvfy.sh stage -pre crsinst -n node1,node2  -verbose
Performing pre-checks for cluster services setup 

Checking node reachability...

Check: Node reachability from node "node1"
  Destination Node                      Reachable?              
  ------------------------------------  ------------------------
  node1                                 yes                     
  node2                                 yes                     
Result: Node reachability check passed from node "node1".


Checking user equivalence...

Check: User equivalence for user "oracle"
  Node Name                             Comment                 
  ------------------------------------  ------------------------
  node2                                 passed                  
  node1                                 passed                  
Result: User equivalence check passed for user "oracle".

Checking administrative privileges...

Check: Existence of user "oracle"
  Node Name     User Exists               Comment                 
  ------------  ------------------------  ------------------------
  node2         yes                       passed                  
  node1         yes                       passed                  
Result: User existence check passed for "oracle".

Check: Existence of group "oinstall"
  Node Name     Status                    Group ID                
  ------------  ------------------------  ------------------------
  node2         exists                    501                     
  node1         exists                    501                     
Result: Group existence check passed for "oinstall".

Check: Membership of user "oracle" in group "oinstall" [as Primary]
  Node Name         User Exists   Group Exists  User in Group  Primary       Comment     
  ----------------  ------------  ------------  ------------  ------------  ------------
  node2             yes           yes           yes           yes           passed      
  node1             yes           yes           yes           yes           passed      
Result: Membership check for user "oracle" in group "oinstall" [as Primary] passed.

Administrative privileges check passed.

Checking node connectivity...


Interface information for node "node2"
  Interface Name                  IP Address                      Subnet          
  ------------------------------  ------------------------------  ----------------
  eth0                            10.10.21.142                    10.10.0.0       
  eth1                            11.11.11.2                      11.11.11.0      


Interface information for node "node1"
  Interface Name                  IP Address                      Subnet          
  ------------------------------  ------------------------------  ----------------
  eth0                            10.10.21.141                    10.10.0.0       
  eth1                            11.11.11.1                      11.11.11.0      


Check: Node connectivity of subnet "10.10.0.0"
  Source                          Destination                     Connected?      
  ------------------------------  ------------------------------  ----------------
  node2:eth0                      node1:eth0                      yes             
Result: Node connectivity check passed for subnet "10.10.0.0" with node(s) node2,node1.

Check: Node connectivity of subnet "11.11.11.0"
  Source                          Destination                     Connected?      
  ------------------------------  ------------------------------  ----------------
  node2:eth1                      node1:eth1                      yes             
Result: Node connectivity check passed for subnet "11.11.11.0" with node(s) node2,node1.

Suitable interfaces for VIP on subnet "11.11.11.0":
node2 eth1:11.11.11.2
node1 eth1:11.11.11.1

Suitable interfaces for the private interconnect on subnet "10.10.0.0":
node2 eth0:10.10.21.142
node1 eth0:10.10.21.141

Result: Node connectivity check passed.


Checking system requirements for 'crs'...

Check: Total memory 
  Node Name     Available                 Required                  Comment   
  ------------  ------------------------  ------------------------  ----------
  node2         31.39GB (32913700KB)      512MB (524288KB)          passed    
  node1         31.39GB (32913700KB)      512MB (524288KB)          passed    
Result: Total memory check passed.

Check: Free disk space in "/tmp" dir
  Node Name     Available                 Required                  Comment   
  ------------  ------------------------  ------------------------  ----------
  node2         32.18GB (33744928KB)      400MB (409600KB)          passed    
  node1         25.74GB (26991968KB)      400MB (409600KB)          passed    
Result: Free disk space check passed.

Check: Swap space 
  Node Name     Available                 Required                  Comment   
  ------------  ------------------------  ------------------------  ----------
  node2         26.37GB (27647856KB)      1GB (1048576KB)           passed    
  node1         26.37GB (27647856KB)      1GB (1048576KB)           passed    
Result: Swap space check passed.

Check: System architecture 
  Node Name     Available                 Required                  Comment   
  ------------  ------------------------  ------------------------  ----------
  node2         x86_64                    x86_64                    passed    
  node1         x86_64                    x86_64                    passed    
Result: System architecture check passed.

Check: Kernel version 
  Node Name     Available                 Required                  Comment   
  ------------  ------------------------  ------------------------  ----------
  node2         2.6.9-22.ELsmp            2.6.9-11.EL               passed    
  node1         2.6.9-22.ELsmp            2.6.9-11.EL               passed    
Result: Kernel version check passed.

Check: Package existence for "binutils-2.15.92.0.2-13" 
  Node Name                       Status                          Comment         
  ------------------------------  ------------------------------  ----------------
  node2                           binutils-2.15.92.0.2-15.0.0.0.2  passed          
  node1                           binutils-2.15.92.0.2-15.0.0.0.2  passed          
Result: Package existence check passed for "binutils-2.15.92.0.2-13".

Check: Group existence for "dba" 
  Node Name     Status                    Comment                 
  ------------  ------------------------  ------------------------
  node2         exists                    passed                  
  node1         exists                    passed                  
Result: Group existence check passed for "dba".

Check: Group existence for "oinstall" 
  Node Name     Status                    Comment                 
  ------------  ------------------------  ------------------------
  node2         exists                    passed                  
  node1         exists                    passed                  
Result: Group existence check passed for "oinstall".

Check: User existence for "nobody" 
  Node Name     Status                    Comment                 
  ------------  ------------------------  ------------------------
  node2         exists                    passed                  
  node1         exists                    passed                  
Result: User existence check passed for "nobody".

System requirement passed for 'crs'

Pre-check for cluster services setup was successful.

利用 CVU 檢查硬件和操作系統設置

[oracle]@node1 cluvfy]#./runcluvfy.sh stage -post hwos -n node1,node2  -verbose
Performing post-checks for hardware and operating system setup 

Checking node reachability...

Check: Node reachability from node "node1"
  Destination Node                      Reachable?              
  ------------------------------------  ------------------------
  node1                                 yes                     
  node2                                 yes                     
Result: Node reachability check passed from node "node1".


Checking user equivalence...

Check: User equivalence for user "oracle"
  Node Name                             Comment                 
  ------------------------------------  ------------------------
  node2                                 passed                  
  node1                                 passed                  
Result: User equivalence check passed for user "oracle".

Checking node connectivity...


Interface information for node "node2"
  Interface Name                  IP Address                      Subnet          
  ------------------------------  ------------------------------  ----------------
  eth0                            10.10.21.142                    10.10.0.0       
  eth1                            11.11.11.2                      11.11.11.0      


Interface information for node "node1"
  Interface Name                  IP Address                      Subnet          
  ------------------------------  ------------------------------  ----------------
  eth0                            10.10.21.141                    10.10.0.0       
  eth1                            11.11.11.1                      11.11.11.0      


Check: Node connectivity of subnet "10.10.0.0"
  Source                          Destination                     Connected?      
  ------------------------------  ------------------------------  ----------------
  node2:eth0                      node1:eth0                      yes             
Result: Node connectivity check passed for subnet "10.10.0.0" with node(s) node2,node1.

Check: Node connectivity of subnet "11.11.11.0"
  Source                          Destination                     Connected?      
  ------------------------------  ------------------------------  ----------------
  node2:eth1                      node1:eth1                      yes             
Result: Node connectivity check passed for subnet "11.11.11.0" with node(s) node2,node1.

Suitable interfaces for VIP on subnet "11.11.11.0":
node2 eth1:11.11.11.2
node1 eth1:11.11.11.1

Suitable interfaces for the private interconnect on subnet "10.10.0.0":
node2 eth0:10.10.21.142
node1 eth0:10.10.21.141

Result: Node connectivity check passed.


Checking shared storage accessibility...


Shared storage check failed on nodes "node2,node1".

Post-check for hardware and operating system setup was unsuccessful on all the nodes.

注意: 該警告也可忽略,沒什麼問題。雖然我們知道這些磁盤可見並在集羣中的兩個 Oracle RAC 節點中共享,但本身將失敗。導致該錯誤的若干原因已得到證明。第一個原因來自 Metalink,指出 cluvfy 當前沒有使用 SCSI 設備之外的其他設備。這將包括設備(如 EMC PowerPath)和卷組(如 Openfiler 中的卷組)。截至本文撰寫之日,除了使用手動方法檢測共享設備外沒有其他解決方法。該錯誤的另一個原因由 Oracle Corporation 的 Bane Radulovic 提出。他的研究表明,CVU 在 Linux 上調用 smartclt 時,smartclt 不會從 iSCSI 設備返回序列號。例如,針對 /dev/sde 進行的檢查顯示:
# /usr/sbin/smartctl -i /dev/sde
smartctl version 5.33 [i686-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
Device: Openfile Virtual disk Version: 0
Serial number:
Device type: disk
Local Time is: Wed Oct 25 23:41:20 2006 EDT
Device supports SMART and is Disabled
Temperature Warning Disabled or Not Supported

驗證成功可以安裝crs了

cd /stage/oracle/10.2.0/crs/clusterware/cluvfy
./runcluvfy.sh stage -pre crsinst -n longshi_rac01,longshi_rac02 –verbose

cd /stage/oracle/10.2.0/crs/clusterware/cluvfy
./runcluvfy.sh stage -post hwos -n longshi_rac01,longshi_rac02 –verbose

十五、使用OUI安裝CRS
安裝CRS,在上傳CRS安裝軟件的機器上以ORACLE身份做
進入clusterware目錄

[oracle@node1 ~]./runInstaller

在這裏插入圖片描述
指定安裝目錄和對其有寫權限的操作系統組,這裏使用默認值即可(在環境變量裏已指定)
在這裏插入圖片描述
選擇crs的安裝路徑,這裏使用默認值即可
在這裏插入圖片描述
系統在安裝前檢查用戶所配置的軟硬件環境是否符合要求,這裏Passed表示完全合乎oracle的安裝要求。

在這裏插入圖片描述
下圖中只顯示了一臺服務器節點,驗證該節點信息是和/etc/hosts中的內容一致,同時把節點node2添加到集羣配置中
在這裏插入圖片描述
單擊“編輯”按鈕,將eth0網卡的網段設爲“公共”,然後點擊“確定”(默認eth0是“公共”)
以下這步要確定好是哪張網卡提供公共對外服務,哪張網卡提供心跳檢測私有服務,千萬不能弄錯.
在這裏插入圖片描述
指定OCR的位置(前面已經設置好的)。然後單擊“下一步”
提示:這裏可以選擇正常冗餘或外部冗餘,效果一樣,正常冗餘提供了一個OCR的鏡像位置,而外部冗餘沒有提供OCR鏡像,只需要OCR位置就可以,由於前期我們在規劃的時候就規劃了OCR鏡像,因此我們這裏選擇正常冗餘,下面表決磁盤的配置也是一樣.
在這裏插入圖片描述
指定表決盤的位置
在這裏插入圖片描述
開始安裝
在這裏插入圖片描述
安裝進行中
在這裏插入圖片描述
在兩個節點上依次執行以下兩個腳本

1.	在 node1 上執行 /u01/app/oracle/oraInventory/orainstRoot.sh。 
2.	在 node2 上執行 /u01/app/oracle/oraInventory/orainstRoot.sh。
3.	在 node1 上執行 /u01/app/crs/root.sh。 
4.	在 node2 上執行 /u01/app/crs/root.sh。

在這裏插入圖片描述
在第二個節點執行root.sh腳本時發生以下錯誤

[root@node2 network-scripts]# /u01/app/crs/root.sh
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
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node <nodenumber>: <nodename> <private interconnect name> <hostname>
node 1: node1 node1-priv node1
node 2: node2 node2-priv node2
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.
        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

以上錯誤是因爲使用了不可路由的IP地址如(192.168.X.X)造成的
解決辦法如下
以 root 用戶身份在第二個節點上手動調用 VIPCA

[root@node2network-scripts]# /u01/app/crs/bin/vipca

選擇下一步
在這裏插入圖片描述
網絡接口:選擇 eth0
在這裏插入圖片描述
配置集羣節點的虛擬 IP:

節點名稱:rac1 
IP 別名:  rac1-vip 
IP 地址:  10.0.39.4 
子網掩碼: 255.255.255.0 
節點名稱: rac2 
IP 別名:  rac2-vip 
IP 地址:  10.0.39.5
子網掩碼: 255.255.255.0 

在這裏插入圖片描述
覈對配置詳情
在這裏插入圖片描述
開始配置
在這裏插入圖片描述
配置成功
在這裏插入圖片描述
返回到crs執行配置腳本屏幕,然後單擊 OK。
在這裏插入圖片描述
所有安裝都成功了
在這裏插入圖片描述
安裝結束了
在這裏插入圖片描述
(4)完成 Oracle Clusterware 配置
在節點1上以 oracle 用戶執行下面操作:

/u01/app/crs/bin/crs_stat -t

在每個節點上以 oracle 用戶執行下面命令:
#檢查集羣節點

/u01/app/crs/bin/olsnodes -n

#檢查 Oracle 集羣件自動啓動腳本

ls -l /etc/init.d/init.*

卸載CRS

如果我們安裝CRS出現了問題,就必須要卸載CRS了。而CRS是一個很令人頭疼的服務,卸載CRS也是一個非常繁瑣的工作。在目前的release1中,如果機羣中的一個節點重啓(無論什麼原因,即使crs服務是正常的),機羣中的所有節點都會隨之重啓。因爲CSS服務會定期檢查機羣中所有節點的服務可用性,當有一個節點出現問題,系統爲了保證數據一致性,就會令其他節點重啓,重新檢查服務,直到所有節點服務都正常。但是就我們現在遇到的情況而言,這種重啓後自動回覆正常的情況極少(目前還沒有自動恢復過),經常會導致loopreboot。因此,在metalink上有很多關於這方面的介紹。這裏,作者將實戰經驗與網上經驗相結合,總結如下(目前的方法就是卸載所有oracle服務和CRS,然後重裝)。
1.	阻止循環重啓的方法
方法一:將CRS服務禁止
在機器重啓之間的那幾秒中檢測時間內,執行
# /etc/init.d/init.crs disable
禁止crs服務,在下一此重啓後,系統將停止循環,但是要把握操作時機。
方法二:拔掉與共享設備的連線
ocr和voting disk文件是存放在共享設備中的,而CSS進程每次都要從這些文件中讀取機羣的配置信息,因此,在機器重啓時斷掉與共享設備的連接,機器也將停止循環重啓。該方法操作簡單,但是由於讀取數據不完整,對於接下來的修復可能會帶來一些不便。
方法三:改寫啓動腳本
將/etc/inittab中的最後三行註釋掉,如:
#h1:35:respawn:/etc/init.d/init.evmd run >/dev/null 2>&1 </dev/null
#h2:35:respawn:/etc/init.d/init.cssd fatal >/dev/null 2>&1 </dev/null
#h3:35:respawn:/etc/init.d/init.crsd run >/dev/null 2>&1 </dev/null
令機器在下一次重啓時,不在啓動服務。該方法的操作時機要把握好,否則沒等文件修改完畢,機器就又要重啓。
2.	在機羣中的所有節點上執行$ORA_CRS_HOME/install/rootdelete.sh;
3.	在機羣中的任意一個節點上執行$ORA_CRS_HOME/install/rootdeinstall.sh;
4.	用圖形界面OUI卸載crs;
a)	執行./runInstall
b)	在界面中選擇Installed;
c)	選擇home1,一般要先安裝CRS,所以CRS的home一般都是home1。
5.	在機羣所有節點上執行

在這裏插入圖片描述

6.	清掉共享磁盤上的內容。
如果ocr和voting disk所在分區不大,可以直接用下面命令清除:
# dd if=/dev/zero of=/dev/sdd1
# dd if=/dev/zero of=/dev/sdd1   (是不是sdd2?)
7.	如果可以,重啓機羣內所有節點。
8.	清理乾淨後,重新安裝CRS。
(卸載所有oracle服務。我也並不想這樣做,但是即使我們stop loopreboot,但是也無法讓機羣中所有節點整齊的再將CRS服務啓動起來。基本上每次都顯示CSS服務初始化錯誤,即voting disk有可能受損。)

十六、升級CRS

以ROOT身份在兩個節點上做

[root@node1]$CRS_HOME/bin/crsctl stop crs

在上傳CRS安裝軟件的機器上以ORACLE身份做

[oracle@node1]$ cd /rac_inst/10203update
[oracle@node1]$./runInstaller

在這裏插入圖片描述
選擇好安裝crs的路徑然後一路下一步
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
以ROOT身份在兩個節點上做

[root@node1]$CRS_HOME/bin/crsctl stop crs
Stopping resources.
Error while stopping resources. Possible cause: CRSD is down.
Stopping CSSD.
Unable to communicate with the CSS daemon.

[root@node1]$CRS_HOME/install/root102.sh
CREATING PRE-PATCH DIRECTORY FOR SAVING PRE-PATCH CLUSTERWARE FILES
COMPLETED PATCHING CLUSTERWARE FILES TO /U01/APP/CRS
RELINKING SOME SHARED LIBRARIES.
RELINKING OF PATCHED FILES IS COMPLETE.
PREPARING TO RECOPY PATCHED INIT AND RC SCRIPTS.
RECOPYING INIT AND RC SCRIPTS.
STARTUP WILL BE QUEUED TO INIT WITHIN 30 SECONDS.
STARTING UP THE CRS DAEMONS.
WAITING FOR THE PATCHED CRS DAEMONS TO START.
  THIS MAY TAKE A WHILE ON SOME SYSTEMS.
.
10203 PATCH SUCCESSFULLY APPLIED.
CLSCFG: EXISTING CONFIGURATION VERSION 3 DETECTED.
CLSCFG: VERSION 3 IS 10G RELEASE 2.
SUCCESSFULLY ACCUMULATED NECESSARY OCR KEYS.
USING PORTS: CSS=49895 CRS=49896 EVMC=49898 AND EVMR=49897.
NODE <NODENUMBER>: <NODENAME> <PRIVATE INTERCONNECT NAME> <HOSTNAME>
NODE 1: NODE1 NODE1-PRIV NODE1
CREATING OCR KEYS FOR USER 'ROOT', PRIVGRP 'ROOT'..
OPERATION SUCCESSFUL.
CLSCFG -UPGRADE COMPLETED SUCCESSFULLY

十七、安裝ORACLE數據庫
在上傳CRS安裝軟件的機器上以ORACLE身份做

[oracle@node1network-scripts]$./runInstaller

在這裏插入圖片描述
這裏選擇自定義安裝
在這裏插入圖片描述
選擇oracle的安裝路徑,這裏使用默認值即可(在環境變量裏已指定)。
在這裏插入圖片描述
選擇集羣安裝、選擇所有節點
在這裏插入圖片描述
根據oracle數據庫的實際應用選擇所要安裝的組件,這裏除了企業級安裝組件意外其他都安裝。
在這裏插入圖片描述
系統在安裝前檢查用戶所配置的軟硬件環境是否符合要求,這裏Passed表示完全合乎oracle的安裝要求。
在這裏插入圖片描述
聲明數據庫管理員的特權組,這裏使用默認值dba。
在這裏插入圖片描述
選擇只安裝數據庫軟件
在這裏插入圖片描述
顯示安裝詳情
在這裏插入圖片描述
開始安裝
在這裏插入圖片描述
以root身份在兩個節點上依次運行root.sh這個腳本
在這裏插入圖片描述
安裝成功
在這裏插入圖片描述
十八、升級數據庫
在上傳ORACLE數據庫安裝軟件的機器上以ORACLE身份做

[oracle@node1]$ cd /rac_inst/10203update
[oracle@node1]$./runInstaller

在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述
最後運行一個腳本

十九、配置監聽

[oracle@node2 network-scripts]$netca

選擇集羣配置
在這裏插入圖片描述
選擇監聽程序配置
在這裏插入圖片描述
選擇添加
在這裏插入圖片描述
使用默認的監聽程序名——LISTENER
在這裏插入圖片描述
選擇TCP協議
在這裏插入圖片描述
使用默認的監聽端口——1521
在這裏插入圖片描述
選擇否,單擊“下一步”
在這裏插入圖片描述
選擇下一步
在這裏插入圖片描述
選擇命名方法配置
在這裏插入圖片描述
選擇本地命名
在這裏插入圖片描述
單擊下一步
在這裏插入圖片描述
單擊完成
在這裏插入圖片描述

二十、創建數據庫和實例

以 oracle 用戶身份登錄,用圖形界面運行dbca

$/u01/app/oracle/product/102/bin/dbca

在這裏插入圖片描述
在以上界面選擇"Oracle Real Application Clusters database",Next
在這裏插入圖片描述
選擇Create a Database, Next
在這裏插入圖片描述
Select All, Next
在這裏插入圖片描述
選擇General Purpose, Next
在這裏插入圖片描述
輸入dbroker, Next
在這裏插入圖片描述
Next
在這裏插入圖片描述
輸入密碼,Next
在這裏插入圖片描述
選擇ASM, Next
在這裏插入圖片描述
設置 SYS 口令並確認;選擇創建初始化參數文件 (IFILE), Next
在這裏插入圖片描述
OK,等待一會
在這裏插入圖片描述
選擇磁盤組,把數據盤加上(不加表決盤),Mount,然後點Next
在這裏插入圖片描述
使用Oracle管理的文件,Next
在這裏插入圖片描述
Next
在這裏插入圖片描述
Next
在這裏插入圖片描述
Next
在這裏插入圖片描述
在Character Sets中使用ZHS16GBK和UTF8字體,Next
在這裏插入圖片描述
Next
在這裏插入圖片描述
創建腳本(也可以不創建),Finish
在這裏插入圖片描述
OK
在這裏插入圖片描述
完畢,Exit

最後查看一下狀態:

$/u01/app/crs/bin/crs_stat –t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.dbroker.db application    ONLINE    ONLINE    node1
ora....r1.inst application    ONLINE    ONLINE    node2
ora....r2.inst application    ONLINE    ONLINE    node1
ora....SM2.asm application    ONLINE    ONLINE    node1
ora....E8.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....SM1.asm application    ONLINE    ONLINE    node2
ora....E9.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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章