Oracle 19c 集群环境安装 Centos7

owner
2024-01-25 / 0 评论 / 69 阅读 / 正在检测是否收录...

Oracle 19c Rac Install

  • 测试环境,Vmware + CentOS 7x64 + Oracle 11g,本次测试安装系统采用最小安装

一,规划

1.1,IP规划
主机名public IPPrivate IPVIPScanner IP
rac_110.10.10.1011.11.11.1010.10.10.810.10.10.7
rac_210.10.10.1111.11.11.1110.10.10.910.10.10.7
1.2,磁盘规划

进入Windows CMD命令行窗口到VMware安装位置执行命令创建

cd C:\Program Files (x86)\VMware\VMware Workstation
vmware-vdiskmanager.exe -c -s 2Gb -a lsilogic -t 2 "C:\Users\syspn\Documents\Virtual Machines\shareDisk\OCR01.vmdk"
vmware-vdiskmanager.exe -c -s 2Gb -a lsilogic -t 2 "C:\Users\syspn\Documents\Virtual Machines\shareDisk\OCR02.vmdk"
vmware-vdiskmanager.exe -c -s 2Gb -a lsilogic -t 2 "C:\Users\syspn\Documents\Virtual Machines\shareDisk\OCR03.vmdk"
vmware-vdiskmanager.exe -c -s 20Gb -a lsilogic -t 2 "C:\Users\syspn\Documents\Virtual Machines\shareDisk\DATA.vmdk"
vmware-vdiskmanager.exe -c -s 5Gb -a lsilogic -t 2 "C:\Users\syspn\Documents\Virtual Machines\shareDisk\ARCH.vmdk"

二,系统配置

2.1,系统配置(所有节点)

进入虚拟机配置界面,添加两个网卡,一个nat,一个仅主机,IP段按照规划来配置

进入系统,挂载光盘,修改yum仓库为光驱

mv /etc/yum.repos.d/* /tmp/
echo "[local_yum]" >> /etc/yum.repos.d/henry.repo
echo "name = henry_repo" >> /etc/yum.repos.d/henry.repo
echo "baseurl = file:///mnt/" >> /etc/yum.repos.d/henry.repo
echo "enabled = 1" >> /etc/yum.repos.d/henry.repo
echo "gpgcheck = 0" >> /etc/yum.repos.d/henry.repo
mount /dev/cdrom /mnt/
2.2,添加硬盘(所有节点)

将上边的硬盘添加到虚拟机,然后点击高级-勾选独立-永久-确定,集群中虚拟机都需要添加创建的几个磁盘,模式都设置成独立永久

然后关闭虚拟机,打开虚拟机保存目录修改所有虚拟机的文件Oracle_Rac_1.vmx

#添加以下代码
disk.locking="FALSE"
disk.EnableUUID = "TRUE"

修改完成后开机

2.3,网络(所有节点)

rac中所有服务器按照规划中的IP划分做好,两张网卡,一张public IP,一张private IP

2.4,检查系统依赖(所有节点)
vi /etc/yum.repos.d/iso.repo
[iso]
name=iso
baseurl=file:///mnt
enabled=1
gpgcheck=0

mount /dev/cdrom /mnt

yum -y install binutils compat-libstdc++-33 glibc ksh libaio libgcc libstdc++ make compat-libcap1 gcc gcc-c++ glibc-devel libaio-devel libstdc++-devel sysstat autoconf automake binutils binutils-devel bison cpp dos2unix ftp gcc gcc-c++ lrzsz python-devel compat-libcap1 compat-libstdc* libXpm-*.i686 libXext libXext.i686 libX11 libX11.i686 libxcb libxcb.i686 libaio* libaio-devel libaio-devel.i686 ksh libXp libaio-devel numactl numactl-devel make sysstat unixODBC unixODBC-devel elfutils-libelf-devel redhat-lsb-core unzip libXrender libXrender-devel nfs-utils smartmontools tigervnc* libvirt* e2fsprogs.x86_64 libXau* libXi* libXtst* libstdc* glibc* libgcc* ksh gcc-c++*
2.5,操作系统内核参数调整(所有节点)
vi /etc/sysctl.conf
kernel.shmall = 965322
#填入命令echo "`cat /proc/meminfo | grep "MemTotal" | awk '{print $2}'` / (`getconf PAGESIZE` / 1024)" | bc 的运行结果
kernel.shmmax = 3163167129
#填入命令echo "`cat /proc/meminfo | grep "MemTotal" | awk '{print $2}'` * 1024 * 0.8" | bc  | sed 's#\..*$##' 的运行结果
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 104857
vm.swappiness = 0
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
sysctl -p   使参数生效
2.6,关闭 SElinux、防火墙(所有节点)

根据安装规范,此两项内容应该已经被关闭 使用如下命令关闭:

sed -i 's/enforcing/disabled/g' /etc/selinux/config
setenforce 0
service firewalld stop
chkconfig firewalld off
service NetworkManager stop
chkconfig NetworkManager off
2.7,修改主机hosts文件(所有节点)
#PUBLIC
10.10.10.10    rac1
10.10.10.11    rac2
 
#PRIVATE
11.11.11.10    rac1-priv
11.11.11.11    rac2-priv

#VIP
10.10.10.8   rac1-vip
10.10.10.9   rac2-vip
10.10.10.7    rac-scan
2.8,用户组相关设置(所有节点)
groupadd -g 1000 oinstall
groupadd -g 1001 dba
groupadd -g 1002 oper
groupadd -g 1003 asmadmin
groupadd -g 1004 asmdba
groupadd -g 1005 asmoper
useradd -u 1001 -g oinstall -G dba,asmadmin,asmdba,asmoper grid
useradd -u 1002 -g oinstall -G dba,oper,asmadmin,asmdba oracle
echo grid |passwd --stdin grid
echo grid |passwd --stdin oracle
2.9,创建目录(所有节点)
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory

mkdir -p /u01/app/grid
chown -R grid:oinstall /u01/app/grid
chmod -R 775 /u01/app/grid

mkdir -p /u01/app/19c/grid
chown -R grid:oinstall /u01/app/19c/grid
chmod -R 775 /u01/app/19c/grid

mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle

mkdir -p /u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall /u01/app/oracle/product/19c/db_1
chmod -R 775 /u01/app/oracle/product/19c/db_1
2.10,修改系统资源限制(所有节点)
echo "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" > /etc/security/limits.conf
2.11,修改/etc/profile,添加如下配置(所有节点)
vi /etc/profile
echo "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" > /etc/profile
2.12,修改/etc/csh.log,添加如下配置(所有节点)
vi /etc/csh.login
echo "if ( \$USER = \"oracle\" || \$USER = \"grid\" ) then
    limit maxproc 16384
    limit descriptors 65536
    endif" > /etc/csh.login
2.13,修改grid用户环境变量(所有节点)
su - grid
vi .bash_profile
echo "export ORACLE_BASE=/u01/app/grid
export ORACLE_SID=+ASM1  #节点2 为+ASM2
export ORACLE_HOME=/u01/app/19c/grid
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
NAME=`hostname`
PS1=\"[$NAME:$LOGNAME]:\${PWD}>\"  
umask 022" > .bash_profile
2.14,修改oracle环境变量(所有节点)
su - oracle
vi .bash_profile
echo "export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl1  #节点2 为orcl2
export ORACLE_HOME=$ORACLE_BASE/product/19c/db_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
NAME=`hostname`
PS1=\"[$NAME:$LOGNAME]:\${PWD}>\"
umask 022" > .bash_profile
2.15、grid节点互信

节点1

su - grid
rm -rf ~/.ssh
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa

节点2

su - grid
rm -rf ~/.ssh
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa

节点1追加互信并拷贝至节点2

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp /home/grid/.ssh/authorized_keys rac2:~/.ssh/authorized_keys

节点1验证互信(无需密码)

ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date

节点2验证互信(无需密码)

ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
2.16, ORACLE用户互信

节点1

su - oracle
rm -rf ~/.ssh
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa

节点2

su - oracle
rm -rf ~/.ssh
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa

节点1追加互信并拷贝至节点2

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp /home/oracle/.ssh/authorized_keys rac2:~/.ssh/authorized_keys

节点1验证互信(无需密码)

ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date

节点2验证互信(无需密码)

ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
2.17,设置UDEV规则

绑定前需要查看下虚机的配置文件的disk.EnableUUID参数需要是TRUE,如果不是需要关闭操作系统修改参数后再重启

修改文件/etc/udev/rules.d/99-oracle-asmdevices.rules,运行一下脚本:

for i in b c d e f;
do
echo "KERNEL==\"sd*\",  ENV{DEVTYPE}==\"disk\",SUBSYSTEM==\"block\", PROGRAM==\"/lib/udev/scsi_id -g -u -d \$devnode\",RESULT==\"`/usr/lib/udev/scsi_id -g -u  /dev/sd$i`\",RUN+=\"/bin/sh -c 'mknod /dev/asm-disk$i b  \$major \$minor; chown grid:asmadmin /dev/asm-disk$i; chmod 0660 /dev/asm-disk$i'\"">>/etc/udev/rules.d/99-oracle-asmdevices.rules
done

重启UDEV以使上述设置生效:

/sbin/udevadm control --reload-rules
udevadm trigger

三,开始安装GRID

3.1,上传GRID包

将LINUX.X64_193000_grid_home.zip上传到主节点grid用户下,解压到/u01/app/

使用x11工具连接到grid用户,在主节点

3.2,开始安装

到解压的路径执行./gridSetup.sh开始安装

    configure Oracle Grid Inftastructure for a New Cluster

next

    Configure an Oracle Standalone Cluster

next

Create Local Scan

    Cluster Name:   ora-rac
    SCAN Name:      rac-scan    #hosts中配置的racscan名称
    SCAN Port:      1521
next
    点击add,将其他节点添加到上边的列表,按照已有的节点格式
next
    更改Private的接口为ASM & Private
next
    Use Oracle Flex ASM for storage
next
    No
next
    点击 Change Discovery Path... 修改为/dev/asm*
    ok
    Disk Group Name : CRS
    勾选上 /dev/asm-diskb,/dev/asm-diskc,/dev/asm-diskd 三个大小一样的磁盘
next
    Use Same passwords for these accounts
        specify Password:   设置密码
next
    Do not use Intelligent Platform Management Interface (IPMI)
next
    Management Options 不修改
next
    Operating System Groups 不修改
next
    Installation Location 不修改
next
    Create Inventory 不修改
next
    Root Script execution 不修改
next
    检查结果过呢根据实际情况处理,如需安装包,则所有节点都要安装上
    完成后 勾选上Ignore All忽略其他的
next
    Install
    # 安装过程中根据提示,使用root账户执行脚本,一个节点执行完了再执行下一个下点
next
    finish

四,开始安装Oracle

4.1,上传db包

将LINUX.X64_193000_db_home.zip上传到主节点,并解压

使用x11工具连接到oracle用户,在主节点

4.2,开始安装

到解压的路径执行./runInstaller开始安装

    Set Up Software Only
next
    Oracle Real Application Clusters database installation
next
    确保所有节点都被勾选
next
    Enterprise Edition
next
    确保 Oracle base 路径正确
next
    Operating System Groups 不修改
next
    Root Script execution 不修改
next
    根据检查结果自行决定是否需要调整系统
next
    summary 检查结果,确认无误点击Install
Install
    安装过程中根据提示在所有节点上执行脚本
finish

安装完成

0

评论 (0)

取消