Oracle 10g R2 RAC Install On OEL5 x86_64

來源:互聯網
上載者:User

1.安裝作業系統需求包
binutils-2.17.50.0.6-2 (x86_64)
compat-db-4.2.52-5.1 (x86_64)
compat-libstdc++-296-2.96-138 (i386)
compat-libstdc++-33-3.2.3-61(x86_64)
compat-libstdc++-33-3.2.3-61 (i386)
control-center-2.16.0-14 (x86_64)
gcc-4.1.1-52 (x86_64)
gcc-c++-4.1.1-52 (x86_64)
glibc-2.5-12 (x86_64)
glibc-2.5-12 (i686)
glibc-common-2.5-12 (x86_64)
glibc-devel-2.5-12 (x86_64)
glibc-devel-2.5-12 (i386)
glibc-headers-2.5-12 (x86_64)
ksh-20060214-1.4 (x86_64)
libaio-0.3.106-3.2 (x86_64)
libgcc-4.1.1-52 (i386)
libgcc-4.1.1-52 (x86_64)
libgnome-2.16.0-6 (x86_64)
libgnomeui-2.16.0-5 (x86_64)
libgomp-4.1.1-52 (x86_64)
libstdc++-4.1.1-52 (x86_64)
libstdc++-devel-4.1.1-52 (x86_64)
libXp-1.0.0-8 (i386)
libXtst-1.0.1-3.1(i386)
make-3.81-1.1 (x86_64)
sysstat-7.0.0-3 (x86_64)

註:rpm -qa|grep XXX
    rpm -Uvh XXX

2.停不必要的服務[RHEL5U1]
chkconfig acpid           off
chkconfig anacron         off
chkconfig apmd            off
chkconfig auditd          off
chkconfig autofs          off
chkconfig avahi-daemon    off
chkconfig bluetooth       off
chkconfig cpuspeed        off
chkconfig cups            off
chkconfig firstboot       off
chkconfig gpm             off
chkconfig haldaemon       off
chkconfig hidd            off
chkconfig ip6tables       off
chkconfig iptables        off
chkconfig irqbalance      off
chkconfig isdn            off
chkconfig mcstrans        off
chkconfig mdmonitor       off
chkconfig microcode_ctl   off
chkconfig netfs           off
chkconfig pcscd           off
chkconfig readahead_early off
chkconfig restorecond     off
chkconfig rhnsd           off
chkconfig rpcgssd         off
chkconfig rpcidmapd       off
chkconfig sendmail        off
chkconfig setroubleshoot  off
chkconfig smartd          off
chkconfig xfs             off
chkconfig yum-updatesd    off

3.修改系統配置參數/etc/sysctl.conf
echo "kernel.shmall = 2097152">>/etc/sysctl.conf
echo "kernel.shmmax = 4294967295">>/etc/sysctl.conf
echo "kernel.shmmni = 4096">>/etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128">>/etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500">>/etc/sysctl.conf
echo "net.core.rmem_default = 262144">>/etc/sysctl.conf
echo "net.core.rmem_max = 2097152">>/etc/sysctl.conf
echo "net.core.wmem_default = 262144">>/etc/sysctl.conf
echo "net.core.wmem_max = 1048576">>/etc/sysctl.conf
echo "fs.file-max = 262144">>/etc/sysctl.conf

讓參數生效
sysctl -p

註:
shmall 是全部允許使用的共用記憶體大小,shmmax 是單個段允許使用的大小。這兩個可以設定為記憶體的 90%。
例如 16G 記憶體,16*1024*1024*1024*90% = 15461882265,shmall 的大小為 15461882265/4k(getconf PAGESIZE可得到) = 3774873。

5.建立Oracle使用者和組
groupadd -g 600 oinstall
groupadd -g 601 dba
groupadd -g 602 oper
useradd -u 600 -g oinstall -G dba,oper oracle -d /home/oracle
passwd oracle

6.建立ORACLE安裝目錄變更屬主
mkdir -p /oracle/product/10.2.0/crs
mkdir -p /oracle/product/10.2.0/db
chown -R oracle:oinstall /oracle

7.修改ORACLE使用者預設限制
echo "oracle           soft    nproc   2047">>/etc/security/limits.conf
echo "oracle           hard    nproc   16384">>/etc/security/limits.conf
echo "oracle           soft    nofile  4096">>/etc/security/limits.conf
echo "oracle           hard    nofile  65536">>/etc/security/limits.conf

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

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

8.配置ORACLE環境變數
1)ORACLE使用者.bash_profile
su - oracle
echo "export ORACLE_BASE=/oracle">>~/.bash_profile
echo "export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db">>~/.bash_profile
echo "export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs">>~/.bash_profile
echo "export ORACLE_SID=racdb1 # The Second Node is Named racdb2">>~/.bash_profile
echo "export PATH=$PATH:$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/dcm/bin:$ORACLE_HOME/webcache/bin:$ORACLE_HOME/opmn/bin">>~/.bash_profile
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:/usr/lib:/usr/local/lib">>~/.bash_profile
echo "export TMPDIR=/tmp">>~/.bash_profile
echo "export TMP=/tmp">>~/.bash_profile

2)ROOT使用者.bash_profile">>~/.bash_profile
su -
echo "export ORACLE_BASE=/oracle">>~/.bash_profile
echo "export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db">>~/.bash_profile
echo "export ORA_CRS_HOME=$ORACLE_BASE/product/10.2.0/crs">>~/.bash_profile
echo "export PATH=$PATH:$ORA_CRS_HOME/bin">>~/.bash_profile

9.配置/etc/hosts網路檔案
cp /etc/hosts /etc/hosts.back
echo "192.168.56.101      rac1">>/etc/hosts
echo "192.168.56.111      rac1-vip">>/etc/hosts
echo "10.10.10.101        rac1-priv">>/etc/hosts
echo "192.168.56.102      rac2">>/etc/hosts
echo "192.168.56.112      rac2-vip">>/etc/hosts
echo "10.10.10.102        rac2-priv">>/etc/hosts

10.節點間建立SSH 使用者等效項
1)在各節點建立RAS與DSA密鑰
su - oracle
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
註:三次斷行符號。
ssh-keygen -t dsa
註:三次斷行符號。

2)在欲進行RAC安裝OUI的節點上,添加密鑰到授權識別碼檔案authorized_keys中
$ssh rac1 cat ~/.ssh/id_rsa.pub>>~/.ssh/authorized_keys
$ssh rac1 cat ~/.ssh/id_dsa.pub>>~/.ssh/authorized_keys
$ssh rac2 cat ~/.ssh/id_rsa.pub>>~/.ssh/authorized_keys
$ssh rac2 cat ~/.ssh/id_dsa.pub>>~/.ssh/authorized_keys
$chmod 600 ~/.ssh/authorized_keys

3)拷貝副本到其它節點對應目錄下並授權
節點一:
$scp ~/.ssh/authorized_keys rac2:/home/oracle/.ssh/
節點二:
$chmod 600 ~/.ssh/authorized_keys

4)在OUI節點上測試SSH等效性
$ssh rac1 hostname
$ssh rac2 hostname
註:如果無需輸入密碼就出現主機名稱,說明SSH配置成功。


11.配置hangcheck timer核心模組
echo "options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180">>/etc/modprobe.conf
echo "modprobe hangcheck_timer">>/etc/rc.d/rc.local

12.配置兩節點LINUX作業系統時間同步<視情況定是否需要>
1)在節點一進行如下操作
cp /etc/ntp.conf /etc/ntp.conf.back
echo "restrict 10.1.120.0 mask 255.255.255.0 nomodify notrap">>/etc/ntp.conf
service ntpd start

2)在節點二進行如下操作
#crontab -e
1-59 * * * * ntpdate 10.1.120.201


13.在其中一個節點配置叢集註冊表OCR、表決磁碟voting共用LV
1)建立一個分區
fdisk /dev/sdd
n
p
t
8e
w

2)建立一個pv
pvcreate  /dev/sdd1
pvscan

3)建立一個vg
vgcreate crsvg /dev/sdd1
vgscan
註:vgcreate datavg /dev/sdc1 /dev/sdd1 /dev/sde1

4)建立db所需的lv
lvcreate -L 300M -n lvocr1 crsvg
lvcreate -L 300M -n lvocr2 crsvg
lvcreate -L 120M -n lvvoting1 crsvg
lvcreate -L 120M -n lvvoting2 crsvg
lvcreate -L 120M -n lvvoting3 crsvg
lvcreate -L 20M -n  lvasmpwd crsvg
lvscan

5)重啟所有節點,載入共用磁碟資訊
#reboot
6)配置lv關聯至raw
cp /etc/sysconfig/rawdevices /etc/sysconfig/rawdevices.back
echo "/dev/raw/raw1  /dev/crsvg/lvocr1">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw2  /dev/crsvg/lvocr2">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw3  /dev/crsvg/lvvoting1">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw4  /dev/crsvg/lvvoting2">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw5  /dev/crsvg/lvvoting3">>/etc/sysconfig/rawdevices
echo "/dev/raw/raw6  /dev/crsvg/lvasmpwd">>/etc/sysconfig/rawdevices
/sbin/service rawdevices restart

7)配置raw屬主
cp /etc/rc.local /etc/rc.local.back
echo "chown oracle:dba /dev/raw/raw[0-9]">>/etc/rc.local
echo "chmod 660 /dev/raw/raw[0-9]">>/etc/rc.local

dd if=/dev/zero of=/dev/raw/raw1 bs=8192k count=3000
dd if=/dev/zero of=/dev/raw/raw2 bs=8192k count=3000
dd if=/dev/zero of=/dev/raw/raw3 bs=8192k count=1200
dd if=/dev/zero of=/dev/raw/raw4 bs=8192k count=1200
dd if=/dev/zero of=/dev/raw/raw5 bs=8192k count=1200
dd if=/dev/zero of=/dev/raw/raw6 bs=8192k count=200

8)查看相前raw的資訊
raw -qa

9)重啟所有節點,載入raw映射資訊
#reboot

14.主節點安裝開始
$export LANG=en_US
$export DISPLAY=192.168.108.1:0.0 --本機IP地址,將圖形介面引到本機
$ ./runInstaller -ignoreSysPrereqs

15.BUG
1)在最後的節點運行root.sh指令碼時報如下錯誤——
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
/home/oracle/crs/oracle/product/10/crs/jdk/jre//bin/java: error while loading
shared libraries: libpthread.so.0: cannot open shared object file:
No such file or directory

解決辦法:
在安裝最後,運行root.sh指令碼之前,修改下列檔案
<CRS_HOME>/bin/vipca
<CRS_HOME>/bin/srvctl
<RDBMS_HOME>/bin/srvctl
<ASM_HOME>/bin/srvctl
中的內容
***VIPCA*********************************************************************
if [ "$arch" = "i686" -o "$arch" = "ia64" -o "$arch" = "x86_64" ]
then
  LD_ASSUME_KERNEL=2.4.19
  export LD_ASSUME_KERNEL
fi
#增加如下內容
unset LD_ASSUME_KERNEL         <<<== Line to be added
*****************************************************************************
***SRVCTL********************************************************************
LD_ASSUME_KERNEL=2.4.19
export LD_ASSUME_KERNEL
#增加如下內容
unset LD_ASSUME_KERNEL          <<<== Line to be added
*****************************************************************************
修改完成後,在二節點上手動運行./vipca,配置完成後關閉圖形介面。

2)在最後節點運行vipca時,報如下錯誤——
Error 0(Native: listNetInterfaces:[3])
[Error 0(Native: listNetInterfaces:[3])]

解決辦法:
<CRS_HOME>/bin # ./oifcfg setif -global eth0/192.168.56.0:public
<CRS_HOME>/bin # ./oifcfg setif -global eth1/172.10.10.0:cluster_interconnect

<CRS_HOME>/bin # ./oifcfg getif
 eth0 192.168.56.0 global public
 eth1 172.10.10.0 global cluster_interconnect

<CRS_HOME>/bin # ./oifcfg iflist
eth0 192.168.56.0
eth1 172.10.10.0

15.禁止/啟用 CRS跟隨作業系統自動啟動
/etc/init.d/init.crs disable
/etc/init.d/init.crs enable

註:啟動CRS crsctl start crs
    亦可以——
        /etc/init.d/init.cssd start
        /etc/init.d/init.crs start

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.