溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

10G ORACLE RAC 搭建實(shí)戰(zhàn)之環(huán)境配置

發(fā)布時(shí)間:2020-09-19 17:35:39 來源:網(wǎng)絡(luò) 閱讀:2419 作者:yanlf_cto 欄目:關(guān)系型數(shù)據(jù)庫(kù)

用戶創(chuàng)建

各個(gè)節(jié)點(diǎn)用戶名和用戶組必須一樣,并創(chuàng)建oracle安裝目錄以及clustercrs目錄

[root@rac1]#groupadd -g 500 dba 

[root@rac1]#groupadd -g 501 oinstall 

[root@rac1]#useradd -u 500 -g oinstall -G dba oracle

[root@rac1]#passwd oracle

Changing passwordfor user oracle. 

New UNIX password:

BAD PASSWORD: itis based on a dictionary word 

Retype new UNIXpassword:

passwd: allauthentication tokens updated successfully.

[root@rac1]# chmod-R 755 /home/oracle    

(注意:該步驟涉及ssh等價(jià)性配置)

 

[root@rac1]# mkdir-p /oraapp/oracle/10g/db_1

[root@rac1]# mkdir-p /oraapp/oracle/10g/db_1

[root@rac1]# mkdir-p /oraapp/oracle/10g/crs

[root@rac1]# chown-R oracle:oinstall /oraapp

[root@rac1]# chmod-R 755 /oraapp

 

.  IP分配及hosts文件配置

hostname

saprac1

saprac2

公共ipeth3

133.160.130.18

133.160.130.19

虛擬ipeth0

192.168.1.18

192.168.1.19

私有ipeth5

10.10.10.18

10.10.10.19

ORACLE_SID

xgxrac1

xgxrac2

 

Hosts文件配置(兩個(gè)節(jié)點(diǎn)一樣)

[oracle@rac1 ~]$cat /etc/hosts

# Do not removethe following line, or various programs

# that requirenetwork functionality will fail.

127.0.0.1       localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

 

133.160.130.18   rac1

133.160.130.19   rac2

192.168.1.18     rac1_vip

192.168.1.19     rac2_vip

10.10.10.18      rac1_priv

10.10.10.19      rac2_priv

 

三、系統(tǒng)參數(shù)調(diào)整

修改下列文件:

1.添加以下內(nèi)容到/etc/security/limits.conf

# vi/etc/security/limits.conf
#oracle limits

oracle softnproc 2047

oracle hardnproc 16384

oracle softnofile 1024

oracle hardnofile 65536

 

2添加以下內(nèi)容到/etc/pam.d/login
# vi /etc/pam.d/login

session  required pam_limits.so

 

3.添加以下內(nèi)容到/etc/profile
# vi /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

 

4.修改系統(tǒng)內(nèi)核參數(shù)

# vi  /etc/sysctl.conf

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax =53687091200   (內(nèi)存分配為>PGA+SGA

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65500

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max= 1048576

修改好內(nèi)核參數(shù)后,執(zhí)行如下命令使新的設(shè)置生效
# /sbin/sysctl -p

 

系統(tǒng)版本信息修改(安裝完后改回

編輯/etc/redhat-release文件替換現(xiàn)在的版本信息(Red Hat Enterprise Linux Server release 3(Tikanga)


修改環(huán)境變量

在各個(gè)節(jié)點(diǎn)上依次修改,注意SID, ORACLE_BASE,ORACLE_HOME

[oracle@rac1 ~]$vi ~/.bash_profile

export PATH

unset USERNAME

alias ll="ls-la"

exportORACLE_BASE=/oraapp/oracle/10g

export ORACLE_HOME=$ORACLE_BASE/db_1

exportORA_CRS_HOME=$ORACLE_BASE/crs

exportORACLE_SID=sapora1

exportPATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin

exportPATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

exportSPFILE_PATH=$ORACLE_HOME/dbs

exportTNS_ADMIN=$ORACLE_HOME/network/admin

exportORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data

exportLD_LIBRARY_PATH=$ORACLE_HOME/lib

exportLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

exportLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

exportCLASSPATH=$ORACLE_HOME/JRE

exportCLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib

exportCLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

exportCLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

exportCLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

exportTHREADS_FLAG=native

export TEMP=/tmp

export TMPDIR=/tmp

exportLIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib

exportORACLE_TERM=xterm

exportLC_CTYPE=en_US.AL16UTF16

exportNLS_LANG=AMERICAN_AMERICA.US7ASCII

~                                                                              

~                                                                             

~                                                                             

~                                                                             

".bash_profile"39L, 1244C written     

  

使更改立即生效                 

[oracle@rac1 ~]$source ~/.bash_profile

 

開發(fā)包檢查

yum -y install compat-libstdc++ libaio libXp compat-dbopenmotif22 binutils control-center gcc gcc-c++ glibc glibc-common gnome-libslibstdc++ libstdc++-devel make pdksh sysstat xscreensaver setarch glibc-develsetarch-2* make-3* glibc-2* libaio-0* compat-libstdc++-33-3* compat-gcc-34-3*compat-gcc-34-c++-3* gcc-4* libXp-1* openmotif-2* compat-db-4* openmotif-2*

 

六. RAW綁定

所謂裸設(shè)備(裸分區(qū)、原始分區(qū)),就是沒有被格式化、不被操作系統(tǒng)通過文件系統(tǒng)來讀取的字符設(shè)備。裸設(shè)備避免了再經(jīng)過Unix操作系統(tǒng)這一層,數(shù)據(jù)直接從DiskOracle進(jìn)行傳輸,所以使用裸設(shè)備對(duì)于讀寫頻繁的數(shù)據(jù)庫(kù)應(yīng)用來說,可以極大地提高數(shù)據(jù)庫(kù)系統(tǒng)的性能。裸設(shè)備應(yīng)該由root來創(chuàng)建裸設(shè)備,然后再分配給Oracle用戶以供使用。同時(shí)還要把它歸入Oracle用戶所在的那個(gè)組里邊(通常都是DBA)。

裸設(shè)備和非裸設(shè)備的表面差異是一個(gè)就是新出廠的磁盤,沒有任何操作;一個(gè)就是fdisk格式化了的新磁盤

在aix上LV就是裸設(shè)備,但是在linux上需要單獨(dú)創(chuàng)建;為防止重啟后配置丟失,將綁定設(shè)置寫到 /etc/sysconfig/rawdevices文件中

1.編輯/etc/sysconfig/rawdevices 添加裸設(shè)備對(duì)應(yīng)lv

[root@rac1 ~]# vi/etc/sysconfig/rawdevices 

# raw devicebindings

# format:  <rawdev> <major> <minor>

#          <rawdev> <blockdev>

# example:/dev/raw/raw1 /dev/sda1

#          /dev/raw/raw2 8 5

 

/dev/raw/raw1   /dev/mapper/oravg01-lvol0

/dev/raw/raw2   /dev/mapper/oravg01-lvol1

/dev/raw/raw3   /dev/mapper/oravg01-lvol2

/dev/raw/raw4   /dev/mapper/oravg01-lvol3

/dev/raw/raw5   /dev/mapper/oravg01-lvol4

/dev/raw/raw6   /dev/mapper/oravg01-lvol5

/dev/raw/raw7   /dev/mapper/oravg01-lvol6

/dev/raw/raw8   /dev/mapper/oravg01-lvol7

/dev/raw/raw9   /dev/mapper/oravg01-lvol8

/dev/raw/raw10  /dev/mapper/oravg01-lvol9

/dev/raw/raw11  /dev/mapper/oravg01-lvol10

/dev/raw/raw12  /dev/mapper/oravg01-lvol11

/dev/raw/raw13  /dev/mapper/oravg01-lvol12

/dev/raw/raw14  /dev/mapper/oravg01-lvol13

/dev/raw/raw15  /dev/mapper/oravg01-lvol14

/dev/raw/raw16  /dev/mapper/oravg01-lvol15

/dev/raw/raw17  /dev/mapper/oravg01-lvol16

/dev/raw/raw18  /dev/mapper/oravg01-lvol17

/dev/raw/raw19  /dev/mapper/oravg01-lvol18

/dev/raw/raw20  /dev/mapper/oravg01-lvol19

/dev/raw/raw21  /dev/mapper/oravg01-lvol20

/dev/raw/raw22  /dev/mapper/oravg01-lvol21

/dev/raw/raw23  /dev/mapper/oravg01-lvol22

/dev/raw/raw24  /dev/mapper/oravg01-lvol23

/dev/raw/raw25  /dev/mapper/oravg01-lvol24

/dev/raw/raw26  /dev/mapper/oravg01-lvol25

/dev/raw/raw27  /dev/mapper/oravg01-lvol26

/dev/raw/raw28  /dev/mapper/oravg01-lvol27

/dev/raw/raw29  /dev/mapper/oravg01-lvol28

/dev/raw/raw30  /dev/mapper/oravg01-lvol29

/dev/raw/raw31  /dev/mapper/oravg01-lvol30

/dev/raw/raw32  /dev/mapper/oravg01-lvol31

/dev/raw/raw33  /dev/mapper/oravg01-lvol32

/dev/raw/raw34  /dev/mapper/oravg01-lvol33

/dev/raw/raw35  /dev/mapper/oravg01-lvol34

/dev/raw/raw36  /dev/mapper/oravg01-lvol35

2.執(zhí)行 /etc/init.d/rawdevices restart 使配置文件中的裸設(shè)備生效.

(3)執(zhí)行 /sbin/chkconfig rawdevices on 保證機(jī)器啟動(dòng)的時(shí)候裸設(shè)備能夠加載。(查看是否啟動(dòng) chkconfig –-list|grep raw)

(4)將裸設(shè)備授權(quán)給oracle 用戶,更改裸設(shè)備的屬主

第一種方法:修改/etc/udev/permissions.d/50-udev.permissions文件
將/etc/udev/permissions.d/50-udev.permissions的113行
從raw/*:root:disk:0660
修改為raw/*:oracle:oinstall:0660

這個(gè)的意思是修改裸設(shè)備的默認(rèn)屬主為oracle:oinstall,默認(rèn)的mode是0660
這樣在每次重啟創(chuàng)建裸設(shè)備的時(shí)候,默認(rèn)的屬主就為oracle:oinstall。

#刷新裸設(shè)備(這樣系統(tǒng)在下次啟動(dòng)時(shí),會(huì)重新建立需要的raw設(shè)備名)

[root@myhost raw]# start_udev啟動(dòng) udev: [ 確定][root@myhost raw]#init 6

第二種方法:先執(zhí)行  chown oracle:oinstall/dev/raw/raw*

編輯啟動(dòng)配置文件 /etc/rc.local 添加 chown oracle:oinstall/dev/raw/raw*

[root@rac2 etc]# vi /etc/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

 

touch /var/lock/subsys/local

#change raw owner

chown oracle:oinstall /dev/raw/raw*

重啟系統(tǒng),查看裸設(shè)備是否存在。

(5)切換到另外一個(gè)節(jié)點(diǎn)上,由于所有卷組都處于未激活狀態(tài),激活卷組: vgchange –ay oravgX,之后重復(fù)上述操作。

 

.  NTP服務(wù)配置

  1. 1.       服務(wù)端(133.160.130.18

由于不能聯(lián)網(wǎng),不對(duì)上層時(shí)間服務(wù)進(jìn)行修改,只修改連接限制;編輯/etc/ntp.conf

修改 restrict default kod nomodify notrap nopeernoquery

    restrictdefault  nomodify  

     重啟ntp服務(wù):service ntpd restart

設(shè)置開機(jī)啟動(dòng):chkconfig ntpd on

  1. 2.    客戶端(133.160.130.19

添加任務(wù),每5分鐘執(zhí)行一次

echo '*/5 * * * * root  ntpdate133.160.130.18'>> /etc/crontab

 

.   hangcheck-timer模塊配置

1.查看模塊位置

[root@rac1 ~]#find /lib/modules/ -name "hangcheck"

[root@rac1 ~]#find /lib/modules/ -name "hangcheck-timer.ko"

/lib/modules/2.6.18-398.el5/kernel/drivers/char/hangcheck-timer.ko

 

2.配置系統(tǒng)啟動(dòng)時(shí)自動(dòng)加載模塊,添加以下內(nèi)容

[root@rac1 ~]#modprobe hangcheck-timer

[root@rac1 ~]# vi/etc/rc.d/rc.local

modprobehangcheck-timer

 

3.配置 hangcheck-timer參數(shù),添加以下內(nèi)容

[root@rac1~]#  vi /etc/modprobe.conf

optionshangcheck-timer hangcheck_tick=30 hangcheck_margin=180

 

4.確認(rèn)模塊加載成功

[root@rac1 ~]#grep Hangcheck /var/log/messages |tail -2

Mar 27 10:45:55localhost kernel: Hangcheck: starting hangcheck timer 0.9.0 (tick is 180seconds, margin is 60 seconds).

Mar 27 10:45:55localhost kernel: Hangcheck: Using monotonic_clock().

 

九.配置ssh等價(jià)

注意:                 

1.這一步是以oracle用戶來操作的,需在配置hosts文件后再進(jìn)行 

2.必須保證每個(gè)節(jié)點(diǎn)上Oracle用戶的UID和DBA組的GID相同。

3.因?yàn)榘惭brac是在其中一個(gè)節(jié)點(diǎn)安裝,然后oracle會(huì)自動(dòng)復(fù)制到其它節(jié)點(diǎn)。最后的測(cè)試一定要不輸入密碼就能顯示日期,不然安裝一定失敗!

1.  在配置用戶等價(jià)的每個(gè)節(jié)點(diǎn)上執(zhí)行

[oracle@rac01 ~]$ cd $HOME

[oracle@rac01 ~]$ mkdir .ssh

[oracle@rac01 ~]$ chmod 700 .ssh

[oracle@rac01 ~]$ cd .ssh

[oracle@rac01 .ssh]$ pwd

/home/oracle/.ssh

[oracle@rac01 .ssh]$ ssh-keygen -t rsa  (連敲三次回車,不要輸入)

[oracle@rac01 .ssh]$ ssh-keygen -t dsa  (連敲三次回車,不要輸入)

[oracle@rac01 .ssh]$ cat *.pub >  authorized_keys

[oracle@rac01 .ssh]$ chmod 644  authorized_keys

 

2.將第一個(gè)節(jié)點(diǎn)上的authorized_keys拷貝到第二個(gè)節(jié)點(diǎn)

[oracle@rac01 .ssh]$ scp authorized_keys  oracle@192.168.0.2:/home/oracle/.ssh/keys_ser01

 

 

 

3.將第二個(gè)節(jié)點(diǎn)與第一個(gè)節(jié)點(diǎn)合并后的authorized_keys在拷回第一個(gè)節(jié)點(diǎn)

[oracle@rac02 .ssh]$ cat  keys_ser01  >>authorized_keys

[oracle@rac02.ssh]$ scp authorized_keys   oracle@192.168.0.1:/home/oracle/.ssh/

 

4.測(cè)試ssh登陸另一個(gè)節(jié)點(diǎn),無(wú)需輸入密碼

ssh rac1 date

ssh rac1-privdate 

ssh rac2 date

ssh rac2-privdate 

這一步一定要測(cè)試成功才能進(jìn)行后面的安裝!


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI