两个机器的系统初始化(略)参考 https://blog.csdn.net/sudahai102448567/article/details/119611507 前期准备 两个节点配置private ip ,然后准备hosts
192.168.168.51 19crac1
192.168.168.52 19crac2
1.1.1.1 19crac1-pri
1.1.1.2 19crac2-pri
192.168.168.53 19crac1-vip
192.168.168.54 19crac2-vip
192.168.168.55 ora19crac-scan
检查并创建用户组
grep 54[4,3] /etc/group
groupadd -g 54421 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
groupadd -g 54330 racdba
grep 54[4,3] /etc/group
检查并创建用户
grep oracle /etc/passwd
grep grid /etc/passwd
/usr/sbin/useradd -u 54322 -g oinstall -G asmadmin,asmdba,asmoper,racdba grid
/usr/sbin/useradd -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
echo "oracle" | passwd --stdin oracle
echo "grid" | passwd --stdin grid
创建目录并授权
mkdir -p /u01/app/19.3.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle
chown -R grid:oinstall /u01
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/
需要安装的软件包信息
yum install -y setarch binutils compat-libstdc++-33 compat-db compat-libstdc++ compat-gcc elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make ksh numactl sysstat libXp unixODBC unixODBC-devel udev libXtst compat-libcap* nfs-utils*
检查已安装的软件包
rpm -qa bc binutils compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libXrender-devel libX11 libXau libXi libXtst libgcc libstdc++ libstdc++-devel libxcb make net-tools targetcli smartmontools sysstat gcc gcc-c++ gcc-info gcc-locale gcc48 gcc48-info gcc48-locale gcc48-c++
rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" bc binutils compat-libcap1 compat-libstdc++ elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libXrender-devel libX11 libXau libXi libXtst libgcc libstdc++ libstdc++-devel libxcb make net-tools targetcli smartmontools sysstat gcc gcc-c++ gcc-info gcc-locale gcc48 gcc48-info gcc48-locale gcc48-c++
配置ZEROCONF (双节点)
cat >>/etc/sysconfig/network <<EOF
NOZEROCONF=yes
EOF
修改系统内核参数
/etc/sysctl.conf
kernel.shmall = 4294967296
kernel.sem = 510 65280 510 128
kernel.shmmni = 4096
kernel.shmmax = 137438953472
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.file-max = 6815744
fs.aio-max-nr = 1048576
vm.swappiness = 0
vm.dirty_background_ratio = 3
vm.dirty_ratio = 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.tcp_wmem = 262144
net.ipv4.tcp_rmem = 4194304
配置LIMITS 限制参数
/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft memlock 3145728
oracle hard memlock 3145728
oracle soft stack 10240
oracle hard stack 32768
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 65536
grid hard nofile 65536
grid soft memlock 3145728
grid hard memlock 3145728
grid soft stack 10240
grid hard stack 32768
cat >>/etc/pam.d/login <<EOF
session required pam_limits.so
EOF
配置系统环境变量
cat >> /etc/profile <<EOF
if [ $USER = "oracle" ]||[ $USER = "grid" ] ; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
source /etc/profile
配置root 用户环境变量
cat >> /root/.bash_profile <<EOF
export CVUQDISK_GRP=oinstall
EOF
source /root/.bash_profile
配置grid 用户环境变量
export TMP=/tmp
export TMPDIR=$TMP
export EDIT=vi
alias vi=vim
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
umask 022
配置oracle 用户环境变量
export TMP=/tmp
export TMPDIR=$TMP
export EDIT=vi
alias vi=vim
export ORACLE_HOSTNAME=$HOSTNAME
export ORACLE_UNQNAME=woo19c
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORACLE_SID=db19c1
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
umask 022
关闭THP 和NUMA (两个节点都做)
[root@19crac1 ~]
[root@19crac1 ~]
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-a4eda59baf964f80909c7c13a8ecbe70
Found initrd image: /boot/initramfs-0-rescue-a4eda59baf964f80909c7c13a8ecbe70.img
done
[root@19crac1 ~]
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-a4eda59baf964f80909c7c13a8ecbe70
Found initrd image: /boot/initramfs-0-rescue-a4eda59baf964f80909c7c13a8ecbe70.img
done
禁用avahi (两个节点都做)
systemctl stop avahi-dnsconfd
systemctl stop avahi-daemon
systemctl disable avahi-dnsconfd
systemctl disable avahi-daemon
准备共享磁盘 参考 https://blog.csdn.net/sudahai102448567/article/details/108123811 https://blog.csdn.net/sudahai102448567/article/details/107631462 配置SSH
/etc/ssh/sshd_config
UseDNS no
LoginGraceTime 0
TCPKeepAlive yes
systemctl restart sshd
安装集群软件
[grid@19crac1 ~]$ ll /tmp/
-rw-r--r-- 1 root root 2889184573 Sep 8 21:16 LINUX.X64_193000_grid_home.zip
[grid@19crac1 tmp]$ unzip -q LINUX.X64_193000_grid_home.zip -d $ORACLE_HOME
安装CVU (两个节点都做)
export CVUQDISK_GRP=oinstall
[root@19crac1 tmp]
Preparing...
ls: cannot access /usr/sbin/smartctl: No such file or directory
/usr/sbin/smartctl not found.
error: %pre(cvuqdisk-1.0.10-1.x86_64) scriptlet failed, exit status 1
error: cvuqdisk-1.0.10-1.x86_64: install failed
报错解决
yum install -y smartmontools
[root@19crac1 tmp]
Preparing...
Updating / installing...
1:cvuqdisk-1.0.10-1
配置SSH 互信 grid users :
[root@19crac1 tmp]
oracle users :
[root@19crac1 tmp]
验证SSH 有效性
[root@19crac1 ~]
Last login: Fri Feb 28 18:57:27 CST 2020 on pts/1
[oracle@ora19crac1 ~]$ ssh ora19crac2 date
Sat Feb 29 19:58:14 CST 2020
[oracle@19crac1 ~]$ exit
Logout
[root@19crac1 ~]
Last login: Sat Feb 29 19:57:48 CST 2020 on pts/0
[grid@ora19crac1 ~]$ ssh ora19crac2 date
Sat Feb 29 19:58:21 CST 2020
[root@19crac2 ~]
Last login: Fri Feb 28 18:50:26 CST 2020 on pts/0
[oracle@ora19crac2 ~]$ ssh ora19crac1 date
Sat Feb 29 19:59:02 CST 2020
[oracle@19crac2 ~]$ exit
Logout
[root@19crac2 ~]
Last login: Fri Feb 28 18:50:06 CST 2020 on pts/0
[grid@19crac2 ~]$
[grid@19crac2 ~]$ ssh ora19crac1 date
Sat Feb 29 19:59:12 CST 2020
安装前环境检查GI
[grid@19crac1 ~]$ $ORACLE_HOME/runcluvfy.sh stage -pre crsinst -n "19crac1,19crac2" -fixup -verbose
开始安装GI
[grid@19crac1 grid]$
[grid@19crac1 ~]$ cd $ORACLE_HOME
[grid@19crac1 grid]$ ./gridSetup.sh
这里注意集群名和scan 名字要以字母开头且不能超多15 个字符 解决之后再检查一次 第一个脚本在每个节点上依次执行,然后执行第二个脚本 节点一脚本一:
[root@19crac1 u01]
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
节点一脚本二:
[root@19crac1 ~]
Performing root user operation.
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/19.3.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Relinking oracle with rac_on option
Using configuration parameter file: /u01/app/19.3.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
/u01/app/grid/crsdata/19crac1/crsconfig/rootcrs_19crac1_2021-09-09_00-13-57AM.log
2021/09/09 00:14:05 CLSRSC-594: Executing installation step 1 of 19: 'SetupTFA'.
2021/09/09 00:14:05 CLSRSC-594: Executing installation step 2 of 19: 'ValidateEnv'.
2021/09/09 00:14:05 CLSRSC-363: User ignored prerequisites during installation
2021/09/09 00:14:05 CLSRSC-594: Executing installation step 3 of 19: 'CheckFirstNode'.
2021/09/09 00:14:07 CLSRSC-594: Executing installation step 4 of 19: 'GenSiteGUIDs'.
2021/09/09 00:14:08 CLSRSC-594: Executing installation step 5 of 19: 'SetupOSD'.
2021/09/09 00:14:08 CLSRSC-594: Executing installation step 6 of 19: 'CheckCRSConfig'.
2021/09/09 00:14:09 CLSRSC-594: Executing installation step 7 of 19: 'SetupLocalGPNP'.
2021/09/09 00:14:30 CLSRSC-594: Executing installation step 8 of 19: 'CreateRootCert'.
2021/09/09 00:14:35 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2021/09/09 00:14:35 CLSRSC-594: Executing installation step 9 of 19: 'ConfigOLR'.
2021/09/09 00:14:43 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'.
2021/09/09 00:14:43 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'.
2021/09/09 00:14:46 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'.
2021/09/09 00:14:47 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2021/09/09 00:15:30 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'.
2021/09/09 00:16:01 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'.
2021/09/09 00:16:53 CLSRSC-594: Executing installation step 15 of 19: 'InstallKA'.
2021/09/09 00:16:58 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'.
[INFO] [DBT-30161] Disk label(s) created successfully. Check /u01/app/grid/cfgtoollogs/asmca/asmca-210909AM121731.log for details.
2021/09/09 00:18:24 CLSRSC-482: Running command: '/u01/app/19.3.0/grid/bin/ocrconfig -upgrade grid oinstall'
CRS-4256: Updating the profile
Successful addition of voting disk f57faaaf26554fa7bfa2569c88971bd7.
Successfully replaced voting disk group with +OCR.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
-- ----- ----------------- --------- ---------
1. ONLINE f57faaaf26554fa7bfa2569c88971bd7 (AFD:OCR1) [OCR]
Located 1 voting disk(s).
2021/09/09 00:19:43 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'.
2021/09/09 00:20:40 CLSRSC-343: Successfully started Oracle Clusterware stack
2021/09/09 00:20:40 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'.
2021/09/09 00:21:51 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'.
2021/09/09 00:22:37 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded
节点二脚本二(脚本一不粘贴):
[root@19crac2 grid]
Performing root user operation.
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/19.3.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Relinking oracle with rac_on option
Using configuration parameter file: /u01/app/19.3.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
/u01/app/grid/crsdata/19crac2/crsconfig/rootcrs_19crac2_2021-09-09_00-24-19AM.log
2021/09/09 00:24:24 CLSRSC-594: Executing installation step 1 of 19: 'SetupTFA'.
2021/09/09 00:24:24 CLSRSC-594: Executing installation step 2 of 19: 'ValidateEnv'.
2021/09/09 00:24:24 CLSRSC-363: User ignored prerequisites during installation
2021/09/09 00:24:24 CLSRSC-594: Executing installation step 3 of 19: 'CheckFirstNode'.
2021/09/09 00:24:26 CLSRSC-594: Executing installation step 4 of 19: 'GenSiteGUIDs'.
2021/09/09 00:24:26 CLSRSC-594: Executing installation step 5 of 19: 'SetupOSD'.
2021/09/09 00:24:26 CLSRSC-594: Executing installation step 6 of 19: 'CheckCRSConfig'.
2021/09/09 00:24:26 CLSRSC-594: Executing installation step 7 of 19: 'SetupLocalGPNP'.
2021/09/09 00:24:28 CLSRSC-594: Executing installation step 8 of 19: 'CreateRootCert'.
2021/09/09 00:24:28 CLSRSC-594: Executing installation step 9 of 19: 'ConfigOLR'.
2021/09/09 00:24:33 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'.
2021/09/09 00:24:33 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'.
2021/09/09 00:24:35 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'.
2021/09/09 00:24:35 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2021/09/09 00:24:51 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2021/09/09 00:25:34 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'.
2021/09/09 00:26:11 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'.
2021/09/09 00:27:09 CLSRSC-594: Executing installation step 15 of 19: 'InstallKA'.
2021/09/09 00:27:11 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'.
2021/09/09 00:27:19 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'.
2021/09/09 00:28:04 CLSRSC-343: Successfully started Oracle Clusterware stack
2021/09/09 00:28:04 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'.
2021/09/09 00:28:19 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'.
2021/09/09 00:28:50 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded
Error 4 opening dom ASM/Self in 0x4677d30
Domain name to open is ASM/Self
Error 4 opening dom ASM/Self in 0x4677d30
上面的错误暂时忽略,没有影响,后续研究
asmca 创建ASM 磁盘组 结果如下: 安装数据库软件
[oracle@19crac1 ~]$ ll
total 2987996
-rw-r--r-- 1 oracle oinstall 3059705302 Sep 9 21:45 LINUX.X64_193000_db_home.zip
[oracle@19crac1 ~]$ unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
Archive: LINUX.X64_193000_db_home.zip
checkdir: cannot create extraction directory: /u01/app/oracle/product/19.3.0/dbhome_1
No such file or directory
[oracle@19crac1 ~]$ mkdir -p $ORACLE_HOME
[oracle@19crac1 ~]$ unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
安装数据库
[oracle@19crac1 ~]$ cd $ORACLE_HOME
[oracle@19crac1 dbhome_1]$ ./runInstaller
不要自动跑脚本
[oracle@19crac1 dbhome_1]$ dbca
|