這篇文章將為大家詳細(xì)講解有關(guān)Oracle RAC如何搭建,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
我們提供的服務(wù)有:成都網(wǎng)站制作、成都網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、商洛ssl等。為上千余家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的商洛網(wǎng)站制作公司
RAC搭建
一、準(zhǔn)備工作. 1
1.規(guī)劃. 1
2.網(wǎng)絡(luò)配適器準(zhǔn)備(rac1& rac2). 2
3.關(guān)閉防火墻和SElinux(rac1& rac2) 2
4.修改主機(jī)名(rac1& rac2). 3
5.修改host文件--網(wǎng)絡(luò)配置(rac1& rac2). 3
6.軟件包準(zhǔn)備. 3
二、修改參數(shù). 4
1.修改系統(tǒng)參數(shù)(rac1&rac2) 4
2.修改limits文件(rac1&rac2) 4
三、添加組、用戶、目錄. 4
1.添加組(rac1&rac2) 4
2.添加用戶(rac1&rac2) 5
3.創(chuàng)建目錄(rac1&rac2) 5
四、配置環(huán)境變量(RAC1&RAC2). 6
五、共享磁盤準(zhǔn)備. 7
1.Openfile使用. 7
2.對磁盤進(jìn)行分區(qū)(rac1). 15
3.準(zhǔn)備裸設(shè)備規(guī)則列表(rac1& rac2). 16
六、解壓grid,配置ssh互信. 17
1.解壓grid(rac1) 17
2.配置互信(rac1) 17
3.檢查互信(rac1&rac2) 17
4.安裝grid解壓后的cvuqdisk包(rac1 & rac2) 18
七、配置本地yum源,安裝軟件包(rac1&rac2) 18
八、關(guān)閉沒有必要的服務(wù)(rac1&rac2). 18
九、安裝GI軟件(rac1) 19
十、創(chuàng)建ASM磁盤組. 30
十一、安裝數(shù)據(jù)庫軟件. 32
十二、DBCA建庫. 40
十三、安裝后檢查. 48
1.查看監(jiān)聽. 48
2.查看實(shí)例. 48
rac1 | rac2 | |
IP | 192.168.131.100/rac1 | 192.168.131.101/rac2 |
privary IP | 10.0.0.100/rac1-priv | 10.0.0.101/rac2-priv |
VIP | 192.168.131.123/rac1-vip | 192.168.131.124/rac2-vip |
scanIP | 192.168.131.125/racscan-ip | |
hostname | rac1 | rac2 |
OS版本 | RHEL 6.4 | RHEL 6.4 |
DB版本 | 11.2.0.4 | 11.2.0.4 |
Cluster software | GI 11.2.0.4 | GI 11.2.0.4 |
存儲(chǔ) | Openfile/192.168.131.191 |
在虛擬機(jī)設(shè)置界面添加兩個(gè)網(wǎng)絡(luò)配適器,一個(gè)用于公網(wǎng)(選擇NET模式),另一個(gè)用于節(jié)點(diǎn)間通信(選擇host only模式)。配置網(wǎng)卡信息如下
IP | 192.168.131.100/rac1 | 192.168.131.101/rac2 |
privary IP | 10.0.0.100/rac1-priv | 10.0.0.101/rac2-priv |
[root@rac01 ~]#chkconfig iptables off
[root@rac01 ~]#service iptables stop
關(guān)閉selinux
[root@rac01 ~]# vi /etc/selinux/config
SELINUX=disabled
vi /etc/sysconfig/network
HOSTNAME=rac1
GATEWAY=192.168.131.1
vi /etc/hosts
添加以下內(nèi)容
192.168.131.100 rac1
192.168.131.101 rac2
10.0.0.102 rac1-priv
10.0.0.103 rac2-priv
192.168.131.123 rac1-vip
192.168.131.124 rac2-vip
## vip一定是不能ping通
192.168.131.125 racscan-ip
(rac1)
GI目錄:/u01/setup/grid
DB目錄:/u01/setup/db
OS目錄:/u01/setup/os
(rac2)
OS目錄:/u01/setup/os
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 4294967296 ##該值為內(nèi)存的75%,單位為字節(jié)
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
使參數(shù)立即生效:
[root@rac01 ~]# /sbin/sysctl -p
[root@rac01 ~]# vi /etc/security/limits.conf
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384se
oracle soft nofile 1024
oracle hard nofile 65536
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmoper
groupadd -g 506 asmdba
(1) 添加用戶
useradd -g oinstall -G dba,asmdba,oper,oinstall oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba,oinstall grid
(2)為grid和oracle用戶設(shè)置密碼
[root@rac01 ~]# passwd oracle
[root@rac01 ~]# passwd grid
(3)檢查
[root@ora1 ~]# id oracle
uid=501(oracle) gid=501(oinstall)
groups=501(oinstall),502(dba),503(oper),506(asmdba)
[root@ora1 ~]# id grid
uid=502(grid) gid=501(oinstall)
groups=501(oinstall),502(dba),503(oper),504(asmadmin),505(asmoper),506(asmdba)
(root用戶)
mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/setup/grid
chown -R oracle:oinstall /u01/setup/db
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
-----切換到grid用戶下-----
rac1
[grid@rhel_linux_asm ~]$ vim .bash_profile
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
rac2
[grid@rhel_linux_asm ~]$ vim .bash_profile
export ORACLE_SID=+ASM2
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
----切換到Oracle用戶下------
rac1
# su - oracle
$ vi /home/oracle/.bash_profile
export ORACLE_SID=orcl1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
rac2
# su - oracle
$ vi /home/oracle/.bash_profile
export ORACLE_SID=orcl2
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
(1)Openfile的下載安裝
Openfile iso文件下載地址
http://www.openfiler.com/community/download
(2)訪問Openfile管理系統(tǒng)
創(chuàng)建一個(gè)新的虛擬機(jī),配置如下
硬盤說明:
硬盤1是用于Openfile系統(tǒng),硬盤2、3用于OCR盤,硬盤4-6用于DATA盤
a) 在瀏覽器中按照上面的ip地址進(jìn)入openfile管理系統(tǒng)
b) 輸入賬號openfiler,密碼password(界面很Q)
c) 進(jìn)入管理系統(tǒng)主界面
(3) 使用Openfile添加磁盤
a) 進(jìn)入services標(biāo)簽,啟動(dòng)iscsi服務(wù)
開啟iscsi服務(wù)
b) 進(jìn)入system標(biāo)簽頁
增加一個(gè)允許訪問的網(wǎng)段
查看訪問網(wǎng)段
c) 進(jìn)入volumes 創(chuàng)建物理卷
此時(shí),物理卷已經(jīng)創(chuàng)建好
d) 創(chuàng)建卷組
此時(shí),myvg卷組已經(jīng)創(chuàng)建好了
e) 創(chuàng)建邏輯卷
同理,將/dev/sdc、/dev/sdd、/dev/sde、/dev/sdf做成lv
步驟略.........
最后結(jié)果如圖
f) 添加一個(gè)IQN
g) 做一個(gè)磁盤映射
此時(shí)邏輯卷添加完成,要使用的話,需要對邏輯卷進(jìn)行掃描
(4) 客戶機(jī)端對openfile服務(wù)器進(jìn)行掃描(rac1& rac2)
命令 # iscsiadm -m discovery -t sendtargets -p 192.168.131.191 -l
如果iscsiadm命令不可用,則需要安裝iscsi-initiator rpm包
# iscsiadm -m discovery -t st -p 192.168.0.10
-bash: iscsiadm: command not found
# mount /u01/setup/os /mnt --加載光盤
mount: block device /dev/cdrom is write-protected, mounting read-only
# cd /mnt/
# cd Server/
# ls -l *iscsi*
-r--r--r-- 55 root root 579386 Dec 17 2008 iscsi-initiator-utils-6.2.0.868-0.18.el5.i386.rpm
# rpm -ivh iscsi-initiator-xxxxxxxxxxx.rpm
OK,重試iscsiadm命令
(執(zhí)行命令)
# for i in `cat /proc/partitions | awk {'print $4'} |grep sd`; do echo "### $i: `/lib/udev/scsi_id --whitelist --replace-whitespace /dev/$i`"; done
上面紅框里的內(nèi)容就是我們需要的wwid
(通過磁盤的wwid進(jìn)行綁定)
# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="14f504e46494c455234524b33457a2d493449682d6c555746",NAME="asm_ocr1", OWNER="grid",GROUP="oinstall",MODE="0660"
KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="14f504e46494c45524644775047362d445155342d33315251",NAME="asm_ocr2", OWNER="grid",GROUP="oinstall",MODE="0660"
KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="14f504e46494c4552457a786c38542d656c6c412d30547753",NAME="asm_data1", OWNER="grid",GROUP="oinstall",MODE="0660"
KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="14f504e46494c45526377784361742d525865332d48357a36",NAME="asm_data2", OWNER="grid",GROUP="oinstall",MODE="0660"
KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="14f504e46494c455271325a4a66662d5a6959672d4a337961",NAME="asm_data3", OWNER="grid",GROUP="oinstall",MODE="0660"
啟動(dòng)設(shè)備
# start_udev
查看設(shè)備
[root@rac1 ~]# cd /dev
[root@rac1 ~]# ll asm*
# su - grid
$ cd /u01/setup/grid
$ unzip p*.zip
(root用戶執(zhí)行)
# /u01/setup/grid/grid/sshsetup/sshUserSetup.sh -user oracle -hosts "rac1 rac2" -advanced -noPromptPassphrase
# /u01/setup/grid/grid/sshsetup/sshUserSetup.sh -user grid -hosts "rac1 rac2" -advanced -noPromptPassphrase
(記得每個(gè)用戶要輸入4次密碼)
su - grid
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
su - oracle
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
(驗(yàn)證互相訪問不需要密碼)
[root@rac1 grid]# cd rpm/
# rpm -ivh cvuqdisk-1.0.9-1.rpm
(root用戶)
# mount -o loop /u01/setup/os/* /mnt
# yum-config-manager --add-repo file:///mnt
vi /etc/yum.repos.d/mnt.repo
[mnt]
name=Yum Source
baseurl=file:///mnt
enabled=1
gpgcheck=0
# yum makecache
安裝如下包:
[root@rac01 opt]#yum install -y binutils compat* elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC-devel libaio-devel ksh
chkconfig autofs off
chkconfig acpid off
chkconfig sendmail off
chkconfig cups-config-daemon off
chkconfig cpus off
chkconfig xfs off
chkconfig lm_sensors off
chkconfig gpm off
chkconfig openibd off
chkconfig pcmcia off
chkconfig cpuspeed off
chkconfig nfslock off
chkconfig ip6tables off
chkconfig rpcidmapd off
chkconfig apmd off
chkconfig sendmail off
chkconfig arptables_jf off
chkconifg microcode_ctl off
chkconfig rpcgssd off
chkconfig ntpd off
1.可行性校驗(yàn)
(執(zhí)行以下腳本)
[grid@rac1 grid]$ ./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose
2.安裝GI
$ unzip /u01/setup/grid/p*
$ cd /u01/setup/grid/grid
運(yùn)行 ./run
查看集群狀態(tài)
[root@rac1 ~]# cd /u01/app/11.2.0/grid/bin/
[root@rac1 bin]# ./crs_stat -t
[grid@rac1 ~]$ export DISPLAY=192.168.131.1:0.0
[grid@rac1 ~]$ asmca
DATA盤選擇asm_data1/asm_data2/asm_data3
解壓 unzip /u01/setup/db/p*
cd /u01/setup/db/database
運(yùn)行 ./run
[oracle@rac1~]dbca
集群的監(jiān)聽由系統(tǒng)自動(dòng)創(chuàng)建,直接查看就可以了
關(guān)于“Oracle RAC如何搭建”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。