Oracle 12C RAC環境搭建


-- 檢查是否又數據庫在運行的命令
ps -ef|grep smon

2020-07-02
1. 操作系統: Oracle Linux 7.6 x86_64
2. 數據庫: 12c
3.數據庫實例名稱:
4.字符集:ZHS16GBK
5.數據塊大小:8k
6.IP地址:自少會有7個
7.每台機器要2塊網卡

先把linux環境安裝好
做三個系統,目錄下需要掛載好磁盤空間

1. 文件分區做好, 先每個月預留20個G
文件做好
2. 配置IP ,計算機名稱,域控等, 保證內網可以訪問, 並關閉防火牆設定
保證xshell可以訪問
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=ac52ae68-be92-4586-8479-b92425db4107
DEVICE=ens33
IPADDR=192.168.32.131
NETMASK=255.255.255.0
GATEWAY=192.168.32.2
ONBOOT=yes
NM_CONTROLLED=no
IPV6_PRIVACY=no

3. 關閉防火牆
systemctl stop firewalld.service
systemctl disable firewalld.service

查看防火牆狀態
systemctl status firewalld

NAT 網絡模式,對應網卡是ens33
需要修改
vi /etc/sysconfig/network-scripts/ifcfg-ens33

重啟網絡服務
systemctl restart network

3.系統名稱
vi /etc/hosts
192.168.32.131 ocp2

vi /etc/resolv.conf
nameserver 8.8.8.8
-- 最后安裝會報錯,現在修改為
namerserver 192.168.32.140
namerserver 192.168.32.141

結論是這部分, 在最后都不需要

------------------------------------------------------------

4. 安裝Oracle
配置 hosts
相互直接用IP跟名稱可以訪問 ,A,B 同時配置
vi /etc/hosts
192.168.32.140 CQRAC01-EN
192.168.32.141 CQRAC02-EN

192.168.30.144 CQRAC01prv -- 不要跟對外一個網段
192.168.30.145 CQRAC02prv

192.168.32.146 CQRAC01vip
192.168.32.147 CQRAC02vip

192.168.32.100 CQRACscan

5.關閉SELINIX,防火牆
echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted" >> /etc/selinux/config
setenforce 1
systemctl stop firewalld.service
systemctl disable firewalld.service

6. 禁止NTP 時間同步服務
systemctl stop ntpd
systemctl disabled ntpd
systemctl stop chronyd.service
systemctl disable chronyd.service
rm -f /etc/chrony.conf

7.配置 yum 源配置
mkdir /mnt/linux
mount /dev/cdrom /mnt/linux
cd /etc/yum.repos.d
mkdir bk
mv *.repo bk/
echo "[EL]" >> /etc/yum.repos.d/itpux.repo
echo "name=Linux 7.x DVD" >> /etc/yum.repos.d/itpux.repo
echo "baseurl=file:///mnt/linux" >> /etc/yum.repos.d/itpux.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/itpux.repo
echo "enabled=1" >> /etc/yum.repos.d/itpux.repo

cat /etc/yum.repos.d/itpux.repo


8.oracle預備安裝前的包
cd /mnt/hgfs/soft/
rpm -ivh
9.權限分配
S
/usr/sbin/groupadd -g 60001 oinstall
/usr/sbin/groupadd -g 60002 dba
/usr/sbin/groupadd -g 60003 oper
/usr/sbin/groupadd -g 60004 backupdba
/usr/sbin/groupadd -g 60005 dgdba
/usr/sbin/groupadd -g 60006 kmdba

/usr/sbin/groupadd -g 60007 asmdba
/usr/sbin/groupadd -g 60008 asmoper
/usr/sbin/groupadd -g 60009 asmadmin
/usr/sbin/useradd -u 61001 -g oinstall -G asmadmin,asmdba,dba,asmoper grid
/usr/sbin/useradd -u 61002 -g oinstall -G dba,backupdba,dgdba,kmdba,asmadmin oracle

passwd grid
passwd oracle


--------------
10. 處理文件夾

mkdir -p /u01/app/grid
mkdir -p /u01/app/12c/grid
chown -R grid:oinstall /u01

mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory

mkdir -p /u01/app/oracle/product/12c/dbhome_1
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01


11.-----------
-- 修改配置文件
vi /etc/sysctl.conf

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
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

# 配置生效
sysctl -p

------------
12. 環境變量的配置
su - grid
vi ~/.bash_profile
umask 022
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/12c/grid
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin

source ~/.bash_profile

env |grep ORACLE

--------------------------------------------------------------------
su - grid
vi ~/.bash_profile
umask 022
export ORACLE_SID=+ASM2
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/12c/grid
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin

source ~/.bash_profile

env |grep ORACLE

------------------------------------------------------------------
su - oracle
vi ~/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12c/dbhome_1
export ORACLE_UNQNAME=lfscq
export ORACLE _SID=ifscq1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin


source ~/.bash_profile
env |grep ORACLE

---------------------------------------------------------------------
su - oracle
vi ~/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12c/dbhome_1
export ORACLE_UNQNAME=lfscq
export ORACLE _SID=ifscq2
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin


source ~/.bash_profile
env |grep ORACLE


13. 配置共享存儲
rm -rf asm
-- 這是刪除目錄的命令,不要經常用,避免刪除不應該刪除的東西

IP: 192.168.32.142
配置ASM目錄
vi /etc/exports
/data *(rw,sync,no_wdelay,insecure,no_root_squash)

systemctl restart nfs-server.service


showmount -t
exportfs -v

14. 關閉共享存儲配置的
echo "SELINUX=disabled" > /etc/selinux/config
echo "#SELINUXTYPE=targeted" >> /etc/selinux/config

cat /etc/selinux/config

systemctl stop firewalld.service
systemctl disable firewalld.service

15. RAC主機配置
mkdir /asm
vi /etc/fstab
192.168.32.142:/data /asm nfs rw,bg,hard,nointr,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 0 0


mount -a
chown -R grid:asmadmin /asm


15. ASM共享磁盤創建
mkdir -p /data/oracleasm/disks
dd if=/dev/zero of=/data/oracleasm/disks/asm1 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm2 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm3 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm4 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm5 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm6 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm7 bs=8192k count=1280
dd if=/dev/zero of=/data/oracleasm/disks/asm8 bs=8192k count=1280
chown grid:asmadmin /data/oracleasm/disks/asm1
chown grid:asmadmin /data/oracleasm/disks/asm2
chown grid:asmadmin /data/oracleasm/disks/asm3
chown grid:asmadmin /data/oracleasm/disks/asm4
chown grid:asmadmin /data/oracleasm/disks/asm5
chown grid:asmadmin /data/oracleasm/disks/asm6
chown grid:asmadmin /data/oracleasm/disks/asm7
chown grid:asmadmin /data/oracleasm/disks/asm8

-- 這個授權有個問題, 就是, 是否是, RAC主機授權這個路徑,還是,在共享磁盤組里面,創建grid賬號組,再授權。。。
chown grid:asmadmin /asm/oracleasm/disks/asm1
chown grid:asmadmin /asm/oracleasm/disks/asm2
chown grid:asmadmin /asm/oracleasm/disks/asm3
chown grid:asmadmin /asm/oracleasm/disks/asm4
chown grid:asmadmin /asm/oracleasm/disks/asm5
chown grid:asmadmin /asm/oracleasm/disks/asm6
chown grid:asmadmin /asm/oracleasm/disks/asm7
chown grid:asmadmin /asm/oracleasm/disks/asm8

 

16. 安裝grid , 先把軟件壓縮包拷貝到/mnt中
用grid 用戶解壓文件到
su - grid
cd $ORACLE_HOME
unzip linuxx64_12201_grid_home.zip

su - root
rpm -Uvh /u01/app/12c/grid/cv/rpm/cvuqdisk*

17. 執行grid 安裝
grid賬戶登錄虛擬機
cd $ORACLE_HOME
./gridSetup.sh


18. 需要兩塊網卡
cp ifcfg-ens33 ifcfg-ens37

為網卡生成新的編碼
命令: uuidgen ens37


UUID
5958e51e-233c-47f7-a864-df41a9cb160e

df38ce14-8968-47d1-99b6-defaa0018849

vi /etc/sysconfig/network-scripts/ifcfg-ens37


systemctl restart network

19. 安裝grid
注意事項: 如果服務器重啟,那么記得需要先把共享存儲掛起來。
oracle

安裝失敗后,最好把路徑的軟件都刪除,重新做
rm -rf 路徑/*

一定要保證grid安裝完成后,才能去安裝Oracle ,否則, 更麻煩

cat /etc/resolv.conf

CQRAC01-EN 192.168.32.140
CQRAN02-EN 192.168.32.141
CQRAC01prv 192.168.30.144
CQRAC02prv 192.168.30.145
CQRAC01vip 192.168.32.146
CQRAC02vip 192.168.32.147
CQRACscan 192.168.32.100

CQRACcluster
CQRACscan

CQRAC01-EN
CQRAC01vip

CQRAC02-EN
CQRAC02vip

mv /etc/resolv.conf /etc/resolv.conf.20180620.bak
這個文件中不能配置, 否則會報錯

20,虛擬機內存要大於最小限制的8個G

temp 空間不足

mkdir /u01/tmp
chown root:root /u01/tmp
chmod 1777 /u01/tmp


vi ~/.bash_profile
export TEMP=/u01/tmp
export TMPDIR=/u01/tmp

source ~/.bash_profile

env |grep TMP

 

21. 不光盤掛載一下,看看需要的包
su - root
mount /dev/sr0 /mnt
cd /mnt
cd Packages/
ls compat*


rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
rpm -ivh libstdc++-devel-4.8.5-16.el7.x86_64.rpm
rpm -ivh ksh-20120801-34.el7.x86_64.rpm
rpm -ivh glibc-devel-2.17-196.el7.x86_64.rpm
rpm -ivh libaio-devel-0.3.109-13.el7.x86_64.rpm
rpm -ivh glibc-headers-2.17-196.el7.x86_64.rpm
rpm -ivh kernel-headers-2.6.18-274.el5.x86_64.rpm

如果發現有些包安裝不上, 那是因為有依賴包要先安裝, 如果光盤里面沒有,那么請到網上下載,並上傳到服務器,安裝后,再做


22,檢查grid集群運行狀態

 

出現的錯誤:

--- 11

 

Check Failed on Nodes: [cqrac01-en,  cqrac02-en]  

Verification result of failed node: cqrac01-en

Expected Value

 : 8GB (8388608.0KB)

Actual Value

 : 7.5445GB (7910952.0KB)

 Details:

 - 

PRVF-7530 : Sufficient physical memory is not available on node "cqrac01-en" [Required physical memory = 8GB (8388608.0KB)]  - Cause:  Amount of physical memory (RAM) found does not meet minimum memory requirements.  - Action:  Add physical memory (RAM) to the node specified.

 

 

-- 22

 

 

 

 

Swap Size - This is a prerequisite condition to test whether sufficient total swap space is available on the system.

  Check Failed on Nodes: [cqrac01-en,  cqrac02-en]  

Verification result of failed node: cqrac01-en

Expected Value

 : 7.5445GB (7910952.0KB)

Actual Value

 : 3.875GB (4063228.0KB)

 Details:

 - 

PRVF-7573 : Sufficient swap size is not available on node "cqrac01-en" [Required = 7.5445GB (7910952.0KB) ; Found = 3.875GB (4063228.0KB)]  - Cause:  The swap size found does not meet the minimum requirement.  - Action:  Increase swap size to at least meet the minimum swap space requirement.

 

 

--33

 

 

Free Space: cqrac01-en:/usr,cqrac01-en:/var,cqrac01-en:/etc,cqrac01-en:/sbin,cqrac01-en:/tmp - This is a prerequisite condition to test whether sufficient free space is available in the file system.  Error:

 - 

PRVF-7501 : Sufficient space is not available at location "/tmp" on node "cqrac01-en" [Required space = 1GB ; available space = 596MB ]  - Cause:  There was not enough free space at location specified.  - Action:  Free up additional space or select another location.

 - 

PRVF-7501 : Sufficient space is not available at location "/" on node "cqrac01-en" [Required space = [25MB (/usr) + 5MB (/var) + 25MB (/etc) + 10MB (/sbin) + 1GB (/tmp) = 1.0635GB ]; available space = 596MB ]  - Cause:  There was not enough free space at location specified.  - Action:  Free up additional space or select another location.

 

 

 

--44

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM