【實驗】使用 VMware 在 Linux 5.1 上安裝、升級及維護 Oracle 10gR2 RAC (二)

secooler發表於2009-02-25
----主節點的設定
1.在配置linux系統之前,首先到主節點RAC1目錄下,開啟.vmx 檔案,新增下列內容:
disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
scsi1:1.deviceType = "disk"
scsi1:2.deviceType = "disk"
scsi1:3.deviceType = "disk"
scsi1:4.deviceType = "disk"

2.修改/etc/hosts檔案,這裡一定要注意:系統主機名不能出現在環路地址中
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
##Public Network - (eth0)
192.168.1.100  rac1
192.168.1.101  rac2
##Private Interconnect - (eth1)
192.168.2.100  rac1-priv
192.168.2.101  rac2-priv
##Public Virtual IP (VIP) addresses - (eth0)
192.168.1.200  rac1-vip
192.168.1.201  rac2-vip

3.建立組oinstall,dba,使用者oracle
# groupadd -g 500 oinstall
# groupadd -g 501 dba
# useradd -m -u 500 -g oinstall -G dba  -d /home/oracle  -s /bin/bash -c "Oracle Software Owner" oracle
# passwd oracle

4.開通FTP功能(因為系統預設並沒有開啟FTP功能,這裡需要設定一下,在這個地方,就要用到我們前面新增的第三塊網路卡的動態獲取IP功能。如實驗環境閘道器發生了變化可以透過命令route add/delete default gw x.x.x.x進行調整)
驗證
# ifconfig eth2    
# netstat -rn      
# ping 144.194.192.1
手工開啟服務
# service vsftpd start
調整配置檔案(在root前新增"#"註釋掉),使windows使用者可以ftp登陸到root使用者
# vi /etc/vsftpd/ftpusers
# vi /etc/vsftpd/user_list
Windows上上傳檔案過程:
Y:\software\Oracle_Linux32Bits>ftp 192.168.1.100
Connected to 192.168.1.100.
220 (vsFTPd 2.0.5)
User (192.168.1.100:(none)): root
331 Please specify the password.
Password:
230 Login successful.
ftp>
ftp>
ftp> cd /hsw_media
250 Directory successfully changed.
ftp> bin
200 Switching to Binary mode.
ftp> prompt
Interactive mode Off .
ftp> mput *
ftp> bye

5.修改oracle使用者的初始化引數檔案
# vi /home/oracle/.bash_profile
##################################################
# User specific environment and startup programs
##################################################
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export CRS_HOME=/oracle/app/crs
export ORA_CRS_HOME=/oracle/app/crs
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin

##################################################
# Each RAC node must have a unique ORACLE_SID. (i.e. orcl1, orcl2,...)
##################################################
export ORACLE_SID=RACDB1

export PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin:$ORA_CRS_HOME/bin:/sbin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp

##################################################
# set NLS_LANG to resolve messy code in SQLPLUS
##################################################
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1

##################################################
# Shell setting.
##################################################
umask 022
set -o vi
# stty erase ^H
export PS1="\${ORACLE_SID}@`hostname` \${PWD}$ "
export SQLPATH=/home/oracle/sql

# auto add env parameter $PROMPT_COMMAND when use non-Linux tty login by ssh.
if [ "$SSH_CONNECTION" != '' ]; then
   export HOSTIP=`echo $SSH_CONNECTION |awk '{print $3}' |awk -F: '{if ($1 == "") print $4; else print $1}'`
   export PROMPT_COMMAND='echo -ne "\033]0;${USER}@'$HOSTIP':[${HOSTNAME%%.*}]:${PWD/#$HOME/~}  \007"'
fi

##################################################
# Oracle Alias
##################################################
alias ls="ls -FA"
alias vi=vim
alias base='cd $ORACLE_BASE'
alias home='cd $ORACLE_HOME'
alias alert='tail -200f $ORACLE_BASE/admin/RACDB/bdump/alert_$ORACLE_SID.log'
alias tnsnames='vi $ORACLE_HOME/network/admin/tnsnames.ora'
alias listener='vi $ORACLE_HOME/network/admin/listener.ora'

6.建立/u01/app目錄,要注意該目錄所有者或oracle使用者的許可權
# mkdir -p /oracle/app/crs
# chown -R oracle:oinstall /oracle/app/crs
# chmod -R 775 /oracle/app/crs
# mkdir -p /oracle/app/oracle
# chown -R oracle:oinstall /oracle/app/oracle
# chmod -R 775 /oracle/app/oracle

7.配置核心引數
# cat >> /etc/sysctl.conf << EOF
kernel.shmmax = 4294967295
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
EOF

#  sysctl -p    ## 使用該命令使上述設定生效

8.提高Oracle使用者的shell限制
# cat >> /etc/security/limits.conf <
oracle soft nproc  2047
oracle hard nproc  16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

9.修改安全限制
# cat >> /etc/pam.d/login << EOF
session required /lib/security/pam_limits.so
EOF

10.配置Hangcheck 計時器
# cat >> /etc/rc.local << EOF
modprobe hangcheck-timer hangcheck-tick=30 hangcheck_margin=180
EOF

11.磁碟分割槽
# fdisk -l           ##列出磁碟分割槽情況
# fdisk /dev/sdb     ##操作順序:n --- p --- 1 -- 回車 -- 回車 --  w
# fdisk /dev/sdc     ##操作順序:n --- p --- 1 -- 回車 -- 回車 --  w
# fdisk /dev/sdd     ##操作順序:n --- p --- 1 -- 回車 -- 回車 --  w
# fdisk /dev/sde     ##操作順序:n --- p --- 1 -- 回車 -- 回車 --  w
                     ##經過上面的步驟,裸裝置就建立好了。之所以稱之為裸裝置,就是因為自身不帶任何檔案系統。
                    
11.打補丁
透過FTP功能上傳補丁到目錄/hsw_media
# cd /hsw_media
## 因為這些安裝包存在依賴關係,所以需要嚴格按照下面的順序進行打補丁
# rpm -Uvh compat-binutils215-2.15.92.0.2-24.i386.rpm       
# rpm -Uvh compat-libcwait-2.1-1.i386.rpm                   
# rpm -Uvh compat-libstdc++-egcs-1.1.2-1.i386.rpm           
# rpm -Uvh openmotif21-debuginfo-2.1.30-11.EL5.i386.rpm     
# rpm -Uvh xorg-x11-libs-compat-6.8.2-1.EL.33.0.1.i386.rpm  
# rpm -Uvh oracleasm-support-2.1.2-1.el5.i386.rpm           
# rpm -Uvh oracleasm-2.6.18-53.el5-2.0.4-1.el5.i686.rpm     
# rpm -Uvh oracleasm-2.6.18-53.el5xen-2.0.4-1.el5.i686.rpm  
# rpm -Uvh kernel-debug-2.6.18-53.el5.i686.rpm            
# rpm -Uvh oracleasm-2.6.18-53.el5debug-2.0.4-1.el5.i686.rpm
# rpm -Uvh kernel-PAE-2.6.18-53.el5.i686.rpm             
# rpm -Uvh oracleasm-2.6.18-53.el5PAE-2.0.4-1.el5.i686.rpm
# rpm -Uvh libXp-1.0.0-8.1.el5.i386.rpm                  
# rpm -Uvh openmotif21-2.1.30-11.EL5.i386.rpm            
# rpm -Uvh compat-oracle-el5-1.0-5.i386.rpm              
# rpm -Uvh oracleasmlib-2.0.3-1.el5.i386.rpm               

12.配置裸裝置:
# cat >> /etc/udev/rules.d/60-raw.rules << EOF
ACTION=="add", KERNEL=="/dev/sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="33",RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add", KERNEL=="/dev/sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="49",RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", KERNEL=="/dev/sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="65",RUN+="/bin/raw /dev/raw/raw4 %M %m"
KERNEL=="raw[1-4]",OWNER="oracle", GROUP="oinstall", MODE="640"
EOF

重啟服務:
# start_udev

13.關閉不需要的系統啟動耗時服務
# chkconfig cups off
# chkconfig sendmail off
# chkconfig isdn off
# chkconfig smartd off
# chkconfig iptables off
# chkconfig pcmcia off

----副節點的設定
1.關閉主節點
# shutdown -hy 0
2.將RAC1目錄中的所有檔案copy到RAC2目錄中
3.修改RAC2下的vmx檔案,將其中出現的"RAC1"全部替換為"RAC2"
4.將RAC1.VMDK這個檔案改為RAC2.VMDK(split出來的其他檔案的名字不能修改檔名字)
5.在虛擬機器中按照RAC2的路徑對vmx檔案做open操作(File --&gt Open --&gt Browse)
6.點選綠色啟動按鈕啟動副節點RAC2,在彈出來的對話方塊中選擇"CREATE"
7.啟動進入系統後,修改主機名
# hostname rac2
# vi /etc/sysconfig/network  ##  其中需要修改的內容為:HOSTNAME=rac2
8.然後將網路卡的MAC地址修改為正確形式,透過ifconfig命令獲得正確的網路卡MAC地址,同時更新檔案中涉及到的IP及主機名資訊
# cd /etc/sysconfig/network-scripts
# mv ifcfg-eth0.bak ifcfg-eth0 -f
# mv ifcfg-eth1.bak ifcfg-eth1 -f
# mv ifcfg-eth2.bak ifcfg-eth2 -f
# ifconfig eth0
# ifconfig eth1
# ifconfig eth2
# vi ifcfg-eth0
# vi ifcfg-eth1
# vi ifcfg-eth2
9.切換到oracle使用者下修改ORACLE_SID環境變數
# su - oracle
$ vi .bash_profile    ## 將ORACLE_SID修改為RACDB2
10. 至此,副節點的設定完畢,重啟系統,讓主機名、IP地址生效。
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-557696/,如需轉載,請註明出處,否則將追究法律責任。

相關文章