RHEL 7.6 安装oracle database 18c dataguard on ASM Part2: Grid Infrastructure配置
RHEL 7.6 安装oracle database 18c dataguard on ASM Part3: Database配置
RHEL 7.6 安装oracle database 18c dataguard on ASM Part4: DataGuard配置
1 硬件信息
cpu:4core
memory:24G
storage:150G
2 软件环境
2.1 操作系统
rhel-server-7.6-x86_64-dvd
Red Hat Enterprise Linux Server release 7.6 (Maipo)
2.2 软件版本
2.2.1 oracle软件
LINUX.X64_180000_db_home.zip
2.2.2 Opatch补丁
p28822489_180000_Linux-x86-64.zip
2.2.3 GI软件
LINUX.X64_180000_grid_home.zip
2.2.4 GI补丁
p28828717_180000_Linux-x86-64.zip
3 部署规划
系统安装调整
[grid@node OPatch]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/root-root00 20G 4.2G 16G 22% /
devtmpfs 12G 0 12G 0% /dev
tmpfs 12G 640M 12G 6% /dev/shm
tmpfs 12G 11M 12G 1% /run
tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/sda1 297M 148M 149M 50% /boot
/dev/mapper/ora-ora 49G 35G 15G 70% /app
tmpfs 2.4G 8.0K 2.4G 1% /run/user/42
tmpfs 2.4G 48K 2.4G 1% /run/user/0[root@nodedg ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/root-root00 20G 4.7G 16G 24% /
devtmpfs 9.8G 0 9.8G 0% /dev
tmpfs 9.9G 0 9.9G 0% /dev/shm
tmpfs 9.9G 9.5M 9.8G 1% /run
tmpfs 9.9G 0 9.9G 0% /sys/fs/cgroup
/dev/sda1 197M 142M 55M 73% /boot
/dev/mapper/ora-app 50G 33M 50G 1% /app
tmpfs 2.0G 8.0K 2.0G 1% /run/user/42
tmpfs 2.0G 0 2.0G 0% /run/user/0
app:软件安装目录
安装目录规划
#GI_patch
ORACLE_BASE=/app/grid
ORACLE_HOME=/app/grid/product/18.3.0/crsmkdir -p /app/grid/product/18.3.0/crs#ORACLE_path
ORACLE_BASE=/app/oracle
ORACLE_HOME=/app/oracle/product/18.3.0/dbhome_1mkdir -p /app/oracle/product/18.3.0/dbhome_1
注:需提前创建好全路径,否则安装软件时检测不到路径。软件会安装在gridSetup所在路径。
4 安装前准备
4.1 安装18c最低硬件要求
建议不小于2GB的RAM
建议至少1024x768的显示分辨率,从而确保OUI显示正确
建议SWAP:RAM在2.5GB~16GB之间SWAP设置为相同的大小的RAM,RAM大于16GB时SWAP设置为16GB
建议至少留给OracleBase7.5GB空间
4.2 验证硬件信息
RAM:24GB
SWAP:20GB
kernel:3.10.0-957.el7.x86_64
shm:12GB
4.3 系统安装包检查
使用下面命令检查软件包是否安装
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' bc \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
glibc \
glibc-devel \
ksh \
libaio \
libaio-devel \
libX11 \
libXau \
libXi \
libXtst \
libXrender-devel \
libXrender \
libgcc \
libstdc++ \
libstdc++-devel \
libxcb \
make \
nfs-utils \
net-tools \
python \
python-configshell \
python-rtslib \
python-six \
smartmontools \
sysstat \
targetcli
安装软件包
yum install bc binutils compat-libcap1 compat-libstdc++-33 glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender-devel libXrender libgcc libstdc++ libstdc++-devel libxcb make nfs-utils net-tools python python-configshell8 python-rtslib python-six smartmontools sysstat targetcli libgcc_s.so.1 libc.so.6
RedHat7.*的镜像文件中没有compat-libstdc包,需要手动安装
compat-libstdc++-33-3.2.3-72.el7.i686.rpm
compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
4.4 确认用户及相应权限设置
/usr/sbin/groupadd -g 54321 asmadmin
/usr/sbin/groupadd -g 54322 asmdba
/usr/sbin/groupadd -g 54323 asmoper
/usr/sbin/groupadd -g 54324 dba
/usr/sbin/groupadd -g 54325 oper
/usr/sbin/groupadd -g 54326 oinstall
/usr/sbin/groupadd -g 54327 backupdba
/usr/sbin/groupadd -g 54328 dgdba
/usr/sbin/groupadd -g 54329 kmdba
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
/usr/sbin/useradd -u 54322 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
配置环境变量
--- grid 环境变量配置[grid@node ~]$ more ~/.bash_profile
# .bash_profile# Get the aliases and functions
if [ -f ~/.bashrc ]; then. ~/.bashrc
fi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHORACLE_SID=+ASM;export ORACLE_SID
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/app/grid; export ORACLE_BASE
ORACLE_HOME=/app/grid/product/18.3.0/crs; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"; export NLS_DATE_FORMAT
#NLS_LANG=american_america.ZHS16GBK; export NLS_LANG
export NLS_LANG=AMERICAN_AMERICA.UTF8
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/app/tmp
export TMPDIR=/app/tmp
umask 022
export DISPLAY=10.6.0.243:0.0
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'--- oracle 环境变量配置[oracle@node ~]$ more .bash_profile
# .bash_profile# Get the aliases and functions
if [ -f ~/.bashrc ]; then. ~/.bashrc
fi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHORACLE_SID=dg;export ORACLE_SID
ORACLE_UNQNAME=dg;export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/app/oracle; export ORACLE_BASE
ORACLE_HOME=/app/oracle/product/18.3.0/dbhome_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"; export NLS_DATE_FORMAT
#NLS_LANG=american_america.ZHS16GBK; export NLS_LANG
export NLS_LANG=AMERICAN_AMERICA.UTF8
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/app/tmp
export TMPDIR=/app/tmp
umask 022
export DISPLAY=10.6.0.243:0.0
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
4.5 系统参数配置
配置linux内核参数
fs.aio-max-nr = 1048576
fs.file-max = 6815744
#kernel.shmall = 2097152
#kernel.shmmax = 4294967295
kernel.shmall = 4294967296
kernel.shmmax = 12640516096
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 = 1048576
shmall大于或等于shmmax的值,以页为单位。shmmax物理内存大小的一半(以字节为单位)
用root用户执行sysctl -p 使修改生效。
设置 grid、oracle 用户的 Shell 限制
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
grid soft memlock 3145728
grid hard memlock 3145728oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft memlock 3145728
oracle hard memlock 3145728
设置PAM
session required pam_limits.so
5 共享存储规划
配置ASM磁盘
#查看磁盘UUID
/usr/lib/udev/scsi_id -g -u /dev/sdc
/usr/lib/udev/scsi_id -g -u /dev/sdd
#udev绑定
vi /etc/udev/rules.d/99-my-asmdevices.rulesKERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT=="36000c29114467cad91650d8a9df70263", 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=="36000c29ee103a04ff486f1df948d21f2", RUN +="/bin/sh -c 'mknod /dev/asmdisk02 b $major $minor; chown grid:oinstall /dev/asmdisk02; chmod 0660 /dev/asmdisk02'"/sbin/udevadm trigger --type=devices --action=change
查看磁盘状态
ls -rtl /dev/asm*
至此基础环境配置完成。