注意:所有需要在兩臺(tái)主機(jī)上都設(shè)置的操作都有注明,貼出過(guò)程僅以rac1為模版
站在用戶(hù)的角度思考問(wèn)題,與客戶(hù)深入溝通,找到吉州網(wǎng)站設(shè)計(jì)與吉州網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶(hù)體驗(yàn)好的作品,建站類(lèi)型包括:成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名申請(qǐng)、雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋吉州地區(qū)。
IP規(guī)劃:
#Public IP
192.168.1.22 rac1
192.168.1.33 rac2
#Private IP
1.1.1.111 rac1-priv
1.1.1.222 rac2-priv
#Virtual IP
192.168.1.23 rac1-vip
192.168.1.34 rac2-vip
#Scan IP
192.168.1.77 rac-scan
更改IP地址(rac1和rac2)
[root@rac1 network-scripts]# vi ifcfg-eno16777736
更改:
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=eeaef3ba-b1fe-498f-95e8-3a982ec8931e
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.1.22
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
~
由于實(shí)驗(yàn)環(huán)境缺少網(wǎng)卡2的配置文件,所以自己copy一份手動(dòng)更改
[root@rac1 network-scripts]# cp ifcfg-eno16777736 ifcfg-eno33554984
[root@rac1 network-scripts]# vi ifcfg-eno33554984
添加:
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno33554984
UUID=7b040b98-b78e-44fa-91e1-5e115f0bdd9f
DEVICE=eno33554984
ONBOOT=yes
IPADDR=1.1.1.111
NETMASK=255.255.255.0
GATEWAY=1.1.1.1
DNS1=8.8.8.8
~
根據(jù)自己的IP規(guī)劃,rac2相同操作
測(cè)試兩邊能否互相ping通
修改主機(jī)名
(測(cè)試環(huán)境安裝系統(tǒng)時(shí),已修改好)~
查看防火墻狀態(tài)(rac1和rac2)
[root@rac1 ~]# systemctl status firewalld
關(guān)閉防火墻(當(dāng)前狀態(tài))
[root@rac1 ~]# systemctl stop firewalld
關(guān)閉防火墻(永久)
[root@rac1 ~]# systemctl disable firewalld
修改host文件(rac1和rac2)
[root@rac2 network-scripts]# vi /etc/hosts
添加:
#Public IP
172.16.171.22 rac1
172.16.171.33 rac2
#Private IP
1.1.1.111 rac1-priv
1.1.1.222 rac2-priv
#Virtual IP
172.16.171.23 rac1-vip
172.16.171.34 rac2-vip
#Scan IP
172.16.171.77 rac-scan
重啟網(wǎng)絡(luò)服務(wù)(rac1和rac2)
[root@rac1 ~]# service network restart
配置內(nèi)核參數(shù)(rac1和rac2):[root@rac1 ~]# vi /etc/sysctl.conf
添加:
# for oracle 11g
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2147483648
kernel.shmmax = 68719476736
kernel.shmmni = 4096
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 = 1048586
使參數(shù)生效(rac1和rac2):[root@rac1 ~]# /sbin/sysctl –p
更改limits文件(rac1和rac2):[root@rac1 ~]# 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 16384
oracle soft nofile 1024
oracle hard nofile 65536
更改login文件(rac1和rac2):[root@rac1 ~]# vi /etc/pam.d/login
添加:
session required pam_limits.so
更改profile文件(rac1和rac2):[root@rac1 ~]# vi /etc/profile
添加:
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
關(guān)閉selinux(rac1和rac2):[root@rac1 ~]# vi /etc/selinux/config
修改:SELINUX=disabled
添加:
getsebool
getsebool: SELinux is disabled
重啟主機(jī)
添加用戶(hù)和組(rac1和rac2)
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmoper
groupadd -g 506 asmdba
useradd -g oinstall -G dba,asmdba,oper oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
設(shè)置grid’和oracle密碼(rac1和rac2):
[root@rac1 ~]# passwd grid
[root@rac1 ~]# passwd oracle
創(chuàng)建目錄(rac1和rac2):
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
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 777 /u01/app/oraInventory
chmod -R 777 /u01
切換用戶(hù),添加環(huán)境變量(rac1和rac2)
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ vi /home/oracle/.bash_profile
添加:
export ORACLE_SID=rac1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$PATH:$ORACLE_HOME/bin
注意:rac2里面:export ORACLE_SID=rac2
[oracle@rac1 ~]$ su - grid
口令:
[grid@rac1 ~]$ 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 NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:$PATH
注意:rac2里面export ORACLE_SID=+ASM2
關(guān)閉設(shè)備,修改虛擬機(jī)vmx文件。以記事本方式打開(kāi)(rac1和rac2分別操作)。添加:
disk.EnableUUID="TRUE"
disk.locking = "false"
scsi1.shared=”TRUE”
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"
scsi1:5.deviceType = "disk"
scsi1:1.shared = "true"
scsi1:2.shared = "true"
scsi1:3.shared = "true"
scsi1:4.shared = "true"
scsi1:5.shared = "true
虛擬機(jī)編輯設(shè)置,添加三塊盤(pán),分別叫:OCR_VOTE.vmdk
data.vmdk fra.vmdk(注意磁盤(pán)的大?。?/p>
剩下兩塊磁盤(pán)相同操作
注意:磁盤(pán)名以及磁盤(pán)大小和虛擬設(shè)備節(jié)點(diǎn)SCIS選擇1:2和1:3
rac2里面磁盤(pán)添加
剩下兩塊磁盤(pán)相同操作,注意虛擬設(shè)備節(jié)點(diǎn)SCIS選擇1:2和1:3與rac1上面磁盤(pán)對(duì)應(yīng)
開(kāi)啟虛擬機(jī)
查看磁盤(pán)是否掛載(rac1和rac2)
[root@rac1 ~]# fdisk –l
查詢(xún)磁盤(pán)UUID(rac1和rac2)
如果uuid查詢(xún)不到,檢查添加的虛擬機(jī)文件是否正確
虛擬機(jī)的vmx文件增加了disk.enableUUID = "TRUE"
[root@rac1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb
36000c2917d180b5daef20885fa95bfbe
[root@rac1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdc
36000c291b9457755e6bdafe27a6dd685
[root@rac1 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdd
36000c29c91113958099603eb65a72ce3
配置udev rules文件
/etc/udev/rule.d/99-oracle-asmdevices.rules
[root@rac1 rules.d]# vi 99-oracle-asmdevices.rules
添加:
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29e1359ab575540edf6a00fd489", RUN+="/bin/sh -c 'mknod /dev/asmdisk01 b $major $minor; chown grid:oinstall /dev/asmdisk01; chmod 0660 /dev/asmdisk01'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c2988f455427ca667639a40ee44f", RUN+="/bin/sh -c 'mknod /dev/asmdisk02 b $major $minor; chown grid:oinstall /dev/asmdisk02; chmod 0660 /dev/asmdisk02'"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29c692398db6baa48338cc7b9b8", RUN+="/bin/sh -c 'mknod /dev/asmdisk03 b $major $minor; chown grid:oinstall /dev/asmdisk03; chmod 0660 /dev/asmdisk03'"
運(yùn)行:(rac1和rac2)
檢查新的設(shè)備名稱(chēng):
[root@rac1 rules.d]# /sbin/udevadm trigger --type=devices --action=change
重新加載UDEV(rac1和rac2)
[root@rac1 rules.d]# /sbin/udevadm control –reload
為了診斷udev(rac1和rac2)
[root@rac1 rules.d]# /sbin/udevadm test /sys/block/sdb
[root@rac1 rules.d]# /sbin/udevadm test /sys/block/sdc
[root@rac1 rules.d]# /sbin/udevadm test /sys/block/sdd
查看是否綁定成功
[root@rac1 rules.d]# ls /dev/asm*
/dev/asmdisk01 /dev/asmdisk02 /dev/asmdisk03
解壓grid安裝包
Root用戶(hù)運(yùn)行運(yùn)行圖形化
[root@rac1 u01]# xhost +
切換用戶(hù)
[root@rac1 u01]# su – grid
設(shè)置display
(xmanager遠(yuǎn)程連接運(yùn)行圖像化)
[grid@rac1 ~]$ export DISPLAY=遠(yuǎn)程機(jī)器的IP地址:0.0
安裝grid
[grid@rac1 ~]$ cd /u01/grid/
[grid@rac1 grid]$ ./runInstaller
掛載光盤(pán)
[root@rac1 dev]# mount /dev/cdrom /mnt/
安裝所需依賴(lài)包(rac1和rac2)
[root@rac1 /]# cd /mnt/Packages
[root@rac1 Packages]# rpm -ivh elfutils-libelf-devel-0.163-3.el7.x86_64.rpm
[root@rac1 Packages]# rpm -ivh libaio-devel-0.3.109-13.el7.x86_64.rpm
缺少pdksh-5.2.14這個(gè)包,網(wǎng)上下載,安裝依賴(lài)包
[root@rac1 u01]# rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
運(yùn)行腳本(rac1和rac2)
[root@rac1 system]# cd /u01/app/oraInventory/
[root@rac1 system]# ./orainstRoot.sh
[root@rac1 system]# cd /u01/app/11.2.0/grid/
[root@rac1 system]# ./root.sh
運(yùn)行root腳本報(bào)錯(cuò)
ohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow:
2015-05-23 23:37:45.460:
[client(13782)]CRS-2101:The OLR was formatted using version 3.
原因:因?yàn)镽HEL 7使用systemd而不是initd運(yùn)行進(jìn)程和重啟進(jìn)程,而root.sh通過(guò)傳統(tǒng)的initd運(yùn)行ohasd進(jìn)程。
解決方法:
取消root.sh重新運(yùn)行
/u01/app/11.2.0/grid/crs/install/roothas.pl -deconfig -force –verbose
1. 以root用戶(hù)創(chuàng)建服務(wù)文件
#touch /usr/lib/systemd/system/ohas.service
#chmod 777 /usr/lib/systemd/system/ohas.service
2. 將以下內(nèi)容添加到新創(chuàng)建的ohas.service文件中
[root@rac1 init.d]# cat /usr/lib/systemd/system/ohas.service
[Unit]
Description=Oracle High Availability Services
After=syslog.target
[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Restart=always
[Install]
WantedBy=multi-user.target
3. 以root用戶(hù)運(yùn)行下面的命令
systemctl daemon-reload
systemctl enable ohas.service
systemctl start ohas.service
4. 查看運(yùn)行狀態(tài)
[root@rac1 init.d]# systemctl status ohas.service
ohas.service - Oracle High Availability Services
Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled)
Active: failed (Result: start-limit) since Fri 2015-09-11 16:07:32 CST; 1s ago
Process: 5734 ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple (code=exited, status=203/EXEC)
Main PID: 5734 (code=exited, status=203/EXEC)
Sep 11 16:07:32 rac1 systemd[1]: Starting Oracle High Availability Services...
Sep 11 16:07:32 rac1 systemd[1]: Started Oracle High Availability Services.
Sep 11 16:07:32 rac1 systemd[1]: ohas.service: main process exited, code=exited, status=203/EXEC
Sep 11 16:07:32 rac1 systemd[1]: Unit ohas.service entered failed state.
Sep 11 16:07:32 rac1 systemd[1]: ohas.service holdoff time over, scheduling restart.
Sep 11 16:07:32 rac1 systemd[1]: Stopping Oracle High Availability Services...
Sep 11 16:07:32 rac1 systemd[1]: Starting Oracle High Availability Services...
Sep 11 16:07:32 rac1 systemd[1]: ohas.service start request repeated too quickly, refusing to start.
Sep 11 16:07:32 rac1 systemd[1]: Failed to start Oracle High Availability Services.
Sep 11 16:07:32 rac1 systemd[1]: Unit ohas.service entered failed state.
此時(shí)狀態(tài)為失敗,原因是現(xiàn)在還沒(méi)有/etc/init.d/init.ohasd文件。
下面可以運(yùn)行腳本root.sh 不會(huì)再報(bào)ohasd failed to start錯(cuò)誤了。
如果還是報(bào)ohasd failed to start錯(cuò)誤,可能是root.sh腳本創(chuàng)建了init.ohasd之后,ohas.service沒(méi)有馬上啟動(dòng),解決方法參考以下:
當(dāng)運(yùn)行root.sh時(shí),一直刷新/etc/init.d ,直到出現(xiàn) init.ohasd 文件,馬上手動(dòng)啟動(dòng)ohas.service服務(wù) 命令:systemctl start ohas.service
[root@rac1 init.d]# systemctl status ohas.service
ohas.service - Oracle High Availability Services
Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled)
Active: active (running) since Fri 2015-09-11 16:09:05 CST; 3s ago
Main PID: 6000 (init.ohasd)
CGroup: /system.slice/ohas.service
6000 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
6026 /bin/sleep 10
Grid用戶(hù):檢查是否安裝正確完成(rac1和rac2)
[grid@rac1 grid]$ crs_stat –t
配置asm磁盤(pán)
使用grid用戶(hù)執(zhí)行asmca
[grid@rac1 grid]$ asmca
Root用戶(hù)解壓oracle,oracle用戶(hù)安裝oracle
[oracle@rac1 database]$ ./runInstaller
[oracle@rac1 database]$ export DISPLAY=遠(yuǎn)程機(jī)器的IP地址:0.0
.
Oracle用戶(hù):解決方法(rac1)
[oracle@rac1 lib]$ cd /$ORACLE_HOME/sysman/lib
[oracle@rac1 lib]$ cp ins_emagent.mk ins_emagent.mk.bak
[oracle@rac1 lib]$ vi ins_emagent.mk
輸入/NMECTL 快速查找,在參數(shù)后面加上-lnnz11 第一個(gè)是字母l 后兩個(gè)是數(shù)字1
然后回到界面點(diǎn)擊retry
運(yùn)行腳本(rac1和rac2)
[root@rac1 ~]# cd /u01/app/oracle/product/11.2.0/dbhome_1/
[root@rac1 ~]# ./root/sh
Oracle用戶(hù)DBCA創(chuàng)建數(shù)據(jù)庫(kù)(rac1)
注意oracle_sid與之前設(shè)置的環(huán)境變量里的相符合
至此,安裝完成,后續(xù)測(cè)試該環(huán)境是否能夠正常運(yùn)行。