Oracle 18.1 RAC部署

版本信息

$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 Production on Wed May 2 14:17:07 2018
Version 18.1.0.0.0

Copyright (c) 1982, 2017, Oracle.  All rights reserved.


Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.1.0.0.0

SQL>

安装文件获取

Oracle Database 18.1下载

安装操作系统

推荐使用 Oracle Linux

操作系统配置

Disable NTP

# systemctl stop ntpd
# systemctl disable ntpd

Disable selinux

# mv /etc/selinux/config /etc/selinux/config.bak
# cat >> "/etc/selinux/config" <<EOF
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
EOF

Disable Transparent HugePages

# echo never > /sys/kernel/mm/transparent_hugepage/enabled

Disable iptables

# chkconfig iptables off

Disable firewalld

# systemctl stop firewalld.service
# systemctl disable firewalld.service

安装依赖

# mv /etc/yum.repos.d/public-yum-ol7.repo /etc/yum.repos.d/public-yum-ol7.repo.bak
# echo "
[ol-source]
name=Red Hat Enterprise Linux \$releasever Beta - \$basearch - Source
baseurl=file:///run/media/root/OL-7.5\ Server.x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle" >/etc/yum.repos.d/ol-source.repo 

# yum install -y oracle-database-server-12cR2-preinstall unixODBC unixODBC-devel

oracle-database-server-12cR2-preinstall添加了oracle相关用户及用户组

# cat /etc/group | grep oracle
oinstall:x:54321:oracle
dba:x:54322:oracle
oper:x:54323:oracle
backupdba:x:54324:oracle
dgdba:x:54325:oracle
kmdba:x:54326:oracle
racdba:x:54330:oracle
# cat /etc/passwd | grep oracle
oracle:x:54321:54321::/home/oracle:/bin/bash

创建Grid相关用户组及用户

# groupadd -g 54327 asmdba
# groupadd -g 54328 asmoper
# groupadd -g 54329 asmadmin
# useradd -u 54331 -d /home/grid -m -g oinstall -G dba,asmdba,asmoper,asmadmin,racdba grid

修改Grid用户环境变量

#  mv /home/grid/.bash_profile /home/grid/.bash_profile.bak
# cat >> /home/grid/.bash_profile  << CONFIG_EOF
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=\$PATH:\$HOME/.local/bin:\$HOME/bin

# Grid Environment
export ORACLE_BASE=/u01/app/grid
export ORACLE_SID=+ASM1
#export ORACLE_SID=+ASM2
export ORACLE_HOME=/u01/app/18.1.0/grid
export PATH=\$PATH:\$ORACLE_HOME/bin:/usr/local/bin/:.
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
export ORACLE_TERM=xterm
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
export TNS_ADMIN=\$ORACLE_HOME/network/admin
#export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
#export NLS_LANG="Simplified Chinese_China.ZHS16CGB231280"
#export NLS_LANG="Simplified Chinese_China.UTF8"
export DISPLAY=$G_DISPLAY_IP:0.0
export LANG=en_US
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022

export PATH

CONFIG_EOF

修改Oracle用户环境变量

# mv /home/oracle/.bash_profile /home/oracle/.bash_profile.bak
# cat >> /home/oracle/.bash_profile  << CONFIG_EOF
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=\$PATH:\$HOME/.local/bin:\$HOME/bin

# Oracle Environment
export ORACLE_SID=testdb1
#ORACLE_SID=testdb2
export ORACLE_UNQNAME=testdb
export JAVA_HOME=/usr/local/java
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/product/18.1.0/dbhome_1
export ORACLE_TERM=xterm; export ORACLE_TERM
export NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"
#export NLS_LANG=american_america.ZHS16GBK
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export ORA_NLS11=\$ORACLE_HOME/nls/data
export PATH=.:\${JAVA_HOME}/bini:\${PATH}:\$HOME/bin:\$ORACLE_HOME/bin:\$ORA_CRS_HOME/bin
export PATH=\${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
export CLASSPATH=\$ORACLE_HOME/JRE
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export DISPLAY=$G_DISPLAY_IP:0.0
export CLASSPATH
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask 022

export PATH
CONFIG_EOF

创建目录

# mkdir -p /u01/app/18.1.0/grid
# mkdir -p /u01/app/grid
# mkdir -p /u01/app/oracle
# mkdir -p /u01/app/oracle/product/18.1.0/dbhome_1
# chown -R grid:oinstall /u01
# chown oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/

配置ASM磁盘

配置Multipath

Multipath别名

multipaths {
    multipath {
    wwid "36006016010e04200271a8a594a34d845"
     alias ORA-DATA-00
    }
}

udev修改ASM磁盘用户权限

# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="dm-*",ENV{DM_NAME}=="ORA*",OWNER="grid",GROUP="asmadmin",MODE="0660"
# udevadm control --reload-rules
# udevadm trigger

配置

安装Grid

解压grid_181.zip至$ORACLE_HOME目录

# cd $ORACLE_HOME
# pwd
/u01/app/18.1.0/grid
# ll grid181.tar.gz
-rw-r--r--. 1 grid oinstall 4386858423 Apr 25 16:59 grid181.tar.gz
# sh gridSetup.sh

安装失败问题解决

  • ORA-00845: MEMORY_TARGET not supported on this system

修改shm大小

SQL> show parameter target

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
memory_max_target                    big integer 1076M
memory_target                        big integer 1076M
pga_aggregate_target                 big integer 0
sga_target                           big integer 0

大小不小于memory_max_target

# cat /etc/fstab | grep tmpfs
tmpfs                   /dev/shm                tmpfs   defaults,size=4G 0 0

# mount -o remount,size=4G /dev/shm
# df -h | grep shm
tmpfs                 4.0G     0  4.0G   0% /dev/shm
    原文作者:liocveei
    原文地址: https://www.jianshu.com/p/3bf106414cfe
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞