Oracle 一键安装脚本,演示 2 节点 RAC 一键安装过程(全程无需人工干预):(脚本包括 GRID/ORALCE PSU/OJVM 补丁自动安装)
⭐️ 脚本下载地址:Shell脚本安装Oracle数据库
脚本第三代支持 N 节点一键安装,不限制节点数!
[root@rac01 soft]# ./OracleShellInstall -n rac `# hostname prefix`\
> -hn rac01,rac02 `# rac node hostname`\
> -cn rac-cls `# cluster_name`\
> -rp oracle `# root password`\
> -gp oracle `# grid password`\
> -op oracle `# oracle password`\
> -lf ens192 `# local ip ifname`\
> -pf ens224 `# rac private ip ifname`\
> -ri 192.168.6.151,192.168.6.152 `# rac node public ip`\
> -vi 192.168.6.153,192.168.6.154 `# rac virtual ip`\
> -si 192.168.6.155 `# rac scan ip`\
> -od /dev/sdb `# rac ocr asm disk`\
> -dd /dev/sdc `# rac data asm disk`\
> -o lucifer `# dbname`\
> -ds AL32UTF8 `# database character`\
> -ns AL16UTF16 `# national character`\
> -dp oracle `# sys/system password`\
> -gpa 35940989 `# grid PSU/RU`\
> -ud Y
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██
██░░░░░██ ░██ ██░░░░░░ ░██ ░██ ░██░██ ░██ ░██ ░██
██ ░░██ ██████ ██████ █████ ░██ █████ ░██ ░██ █████ ░██ ░██░██ ███████ ██████ ██████ ██████ ░██ ░██
░██ ░██░░██░░█ ░░░░░░██ ██░░░██ ░██ ██░░░██░█████████░██████ ██░░░██ ░██ ░██░██░░██░░░██ ██░░░░ ░░░██░ ░░░░░░██ ░██ ░██
░██ ░██ ░██ ░ ███████ ░██ ░░ ░██░███████░░░░░░░░██░██░░░██░███████ ░██ ░██░██ ░██ ░██░░█████ ░██ ███████ ░██ ░██
░░██ ██ ░██ ██░░░░██ ░██ ██ ░██░██░░░░ ░██░██ ░██░██░░░░ ░██ ░██░██ ░██ ░██ ░░░░░██ ░██ ██░░░░██ ░██ ░██
░░███████ ░███ ░░████████░░█████ ███░░██████ ████████ ░██ ░██░░██████ ███ ███░██ ███ ░██ ██████ ░░██ ░░████████ ███ ███
░░░░░░░ ░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░░ ░░░░░░░░ ░░ ░░ ░░░░░░ ░░░ ░░░ ░░ ░░░ ░░ ░░░░░░ ░░ ░░░░░░░░ ░░░ ░░░
请选择安装模式 [单机(si)/单机ASM(sa)/集群(rac)] : rac
数据库安装模式: rac
请选择数据库版本 [11203/11/12/19/21] : 19
数据库版本: 19
#==============================================================#
配置本地 YUM 源
#==============================================================#
[server]
name=server
baseurl=file:///mnt
enabled=1
gpgcheck=0
#==============================================================#
获取 ASM 磁盘 UUID && 格式化磁盘头
#==============================================================#
格式化 OCR 磁盘:/dev/sdb
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.0471055 s, 21.7 kB/s
OCR磁盘组的磁盘UUID: 2e87e4f535c397171
格式化 DATA 磁盘:/dev/sdc
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.0396776 s, 25.8 kB/s
DATA磁盘组的磁盘UUID: 2f218dae15b551c5d
#==============================================================#
配置 root 用户互信
#==============================================================#
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:WWoGD210PXUNrmIMaZZY4Tkh1KeJnjQlEk//8tBpAZw root@rac01
The key's randomart image is:
+---[RSA 2048]----+
| .o+o*o.. .o.o|
| .o.OEB. o. ..|
| .=+&+o .. |
| +BoX o . |
| o oS O . |
| oo * . |
| . |
| |
| |
+----[SHA256]-----+
#==============================================================#
禁用防火墙
#==============================================================#
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Mar 11 14:50:08 rac01 systemd[1]: Starting firewalld - dynamic firewall daemon...
Mar 11 14:50:10 rac01 systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 11 14:50:11 rac01 firewalld[982]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
Mar 12 13:38:19 rac01 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Mar 12 13:38:20 rac01 systemd[1]: Stopped firewalld - dynamic firewall daemon.
#==============================================================#
禁用 SELinux
#==============================================================#
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
#==============================================================#
YUM 静默安装依赖包
#==============================================================#
bc-1.06.95-13.el7.x86_64
binutils-2.27-44.base.el7.x86_64
compat-libcap1-1.10-7.el7.x86_64
gcc-4.8.5-44.el7.x86_64
gcc-c++-4.8.5-44.el7.x86_64
elfutils-libelf-0.176-5.el7.x86_64
elfutils-libelf-devel-0.176-5.el7.x86_64
glibc-2.17-317.el7.x86_64
glibc-devel-2.17-317.el7.x86_64
libaio-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.x86_64
libgcc-4.8.5-44.el7.x86_64
libstdc++-4.8.5-44.el7.x86_64
libstdc++-devel-4.8.5-44.el7.x86_64
libxcb-1.13-1.el7.x86_64
libX11-1.6.7-2.el7.x86_64
libXau-1.0.8-2.1.el7.x86_64
libXi-1.7.9-1.el7.x86_64
libXrender-0.9.10-1.el7.x86_64
make-3.82-24.el7.x86_64
net-tools-2.0-0.25.20131004git.el7.x86_64
smartmontools-7.0-2.el7.x86_64
sysstat-10.1.5-19.el7.x86_64
e2fsprogs-1.42.9-19.el7.x86_64
e2fsprogs-libs-1.42.9-19.el7.x86_64
unzip-6.0-21.el7.x86_64
openssh-clients-7.4p1-21.el7.x86_64
readline-6.2-11.el7.x86_64
readline-devel-6.2-11.el7.x86_64
psmisc-22.20-17.el7.x86_64
ksh-20120801-142.el7.x86_64
nfs-utils-1.3.0-0.68.el7.x86_64
tar-1.26-35.el7.x86_64
device-mapper-multipath-0.4.9-133.el7.x86_64
avahi-0.6.31-20.el7.x86_64
ntp-4.2.6p5-29.el7_8.2.x86_64
chrony-3.4-1.el7.x86_64
libXtst-1.2.3-1.el7.x86_64
libXrender-devel-0.9.10-1.el7.x86_64
fontconfig-devel-2.13.0-4.3.el7.x86_64
policycoreutils-2.5-34.el7.x86_64
policycoreutils-python-2.5-34.el7.x86_64
#==============================================================#
配置主机名
#==============================================================#
rac01
#==============================================================#
配置 /etc/hosts 文件
#==============================================================#
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
## OracleBegin
## RAC1 IP's: rac01
## RAC1 Public IP
192.168.6.151 rac01
## RAC1 Virtual IP
192.168.6.153 rac01-vip
## RAC1 Private IP
1.1.1.1 rac01-priv
## RAC2 IP's: rac02
## RAC2 Public IP
192.168.6.152 rac02
## RAC2 Virtual IP
192.168.6.154 rac02-vip
## RAC2 Private IP
1.1.1.2 rac02-priv
## SCAN IP
192.168.6.155 rac-scan
#==============================================================#
创建用户和组
#==============================================================#
oracle 用户:
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba),54327(asmdba),54328(asmoper),54329(asmadmin)
grid 用户:
uid=11012(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba),54327(asmdba),54328(asmoper),54329(asmadmin)
#==============================================================#
配置 Avahi-daemon 服务
#==============================================================#
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Mar 12 13:33:14 rac01 avahi-daemon[877]: Registering new address record for fe80::f5b9:ca65:dba2:bf0 on ens192.*.
Mar 12 13:33:14 rac01 avahi-daemon[877]: Joining mDNS multicast group on interface ens192.IPv4 with address 192.168.6.151.
Mar 12 13:33:14 rac01 avahi-daemon[877]: New relevant interface ens192.IPv4 for mDNS.
Mar 12 13:33:14 rac01 avahi-daemon[877]: Registering new address record for 192.168.6.151 on ens192.IPv4.
Mar 12 13:33:14 rac01 avahi-daemon[877]: Registering new address record for fe80::a8ce:7574:2cec:a98e on ens224.*.
Mar 12 13:33:14 rac01 avahi-daemon[877]: Joining mDNS multicast group on interface ens224.IPv4 with address 1.1.1.1.
Mar 12 13:33:14 rac01 avahi-daemon[877]: New relevant interface ens224.IPv4 for mDNS.
Mar 12 13:33:14 rac01 avahi-daemon[877]: Registering new address record for 1.1.1.1 on ens224.IPv4.
Mar 12 13:39:02 rac01 systemd[1]: Stopping Avahi mDNS/DNS-SD Stack...
Mar 12 13:39:02 rac01 systemd[1]: Stopped Avahi mDNS/DNS-SD Stack.
#==============================================================#
配置透明大页 && NUMA && 磁盘 IO 调度器
#==============================================================#
args="ro rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=en_US.UTF-8 numa=off transparent_hugepage=never elevator=deadline"
-rd.lvm.lv=rhel/root
-args="ro
args="ro rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet numa=off transparent_hugepage=never elevator=deadline"
-elevator=deadline"
-transparent_hugepage=never
#==============================================================#
配置 sysctl.conf
#==============================================================#
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8369385471
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
vm.min_free_kbytes = 32692
net.ipv4.conf.ens192.rp_filter = 1
vm.swappiness = 10
kernel.panic_on_oops = 1
kernel.randomize_va_space = 2
kernel.numa_balancing = 0
net.ipv4.conf.ens224.rp_filter = 2
#==============================================================#
配置 nsysctl.conf
#==============================================================#
NOZEROCONF=yes
#==============================================================#
配置 RemoveIPC
#==============================================================#
[Login]
RemoveIPC=no
#==============================================================#
配置 /etc/security/limits.conf 和 /etc/pam.d/login
#==============================================================#
查看 /etc/security/limits.conf:
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard memlock unlimited
oracle soft memlock unlimited
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
grid soft nproc 2047
grid hard nproc 16384
查看 /etc/pam.d/login 文件:
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth substack system-auth
auth include postlogin
account required pam_nologin.so
account include system-auth
password include system-auth
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include system-auth
session include postlogin
-session optional pam_ck_connector.so
session required pam_limits.so
session required /lib64/security/pam_limits.so
#==============================================================#
配置 /dev/shm
#==============================================================#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=64fa46ff-7a45-4939-b2bf-f995a20165d1 /boot xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs size=8173228k 0 0
#==============================================================#
安装 rlwrap 插件
#==============================================================#
成功安装 rlwrap: rlwrap 0.44
#==============================================================#
Root 用户环境变量
#==============================================================#
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin
export PATH
alias so='su - oracle'
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias sg='su - grid'
alias crsctl='/u01/app/19.3.0/grid/bin/crsctl'
alias srvctl='/u01/app/19.3.0/grid/bin/srvctl'
#==============================================================#
Oracle 用户环境变量
#==============================================================#
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=lucifer1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/perl/bin:$PATH
export PERL5LIB=$ORACLE_HOME/perl/lib
alias sas='sqlplus / as sysdba'
alias awr='sqlplus / as sysdba @?/rdbms/admin/awrrpt'
alias ash='sqlplus / as sysdba @?/rdbms/admin/ashrpt'
alias alert='vi $ORACLE_BASE/diag/rdbms/*/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias adrci='rlwrap adrci'
#==============================================================#
Grid 用户环境变量
#==============================================================#
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM1
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
alias sas='sqlplus / as sysasm'
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias sqlplus='rlwrap sqlplus'
alias asmcmd='rlwrap asmcmd'
alias adrci='rlwrap adrci'
#==============================================================#
配置 multipath 多路径
#==============================================================#
create: asm_ocr_1 (2e87e4f535c397171) undef ROCKET ,IMAGEFILE
size=10G features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
`- 33:0:0:0 sdb 8:16 undef ready running
create: asm_data_1 (2f218dae15b551c5d) undef ROCKET ,IMAGEFILE
size=20G features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
`- 33:0:0:1 sdc 8:32 undef ready running
#==============================================================#
配置 UDEV 绑盘
#==============================================================#
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-2e87e4f535c397171",SYMLINK+="asm_ocr_1",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-2f218dae15b551c5d",SYMLINK+="asm_data_1",OWNER="grid",GROUP="asmadmin",MODE="0660"
/dev/asm_data_1
/dev/asm_ocr_1
UDEV 配置完成!
#==============================================================#
配置 RAC 节点:192.168.6.152
#==============================================================#
正在节点:192.168.6.152 上执行脚本:
███████ ██ ████████ ██ ██ ██ ██ ██ ██ ██
██░░░░░██ ░██ ██░░░░░░ ░██ ░██ ░██░██ ░██ ░██ ░██
██ ░░██ ██████ ██████ █████ ░██ █████ ░██ ░██ █████ ░██ ░██░██ ███████ ██████ ██████ ██████ ░██ ░██
░██ ░██░░██░░█ ░░░░░░██ ██░░░██ ░██ ██░░░██░█████████░██████ ██░░░██ ░██ ░██░██░░██░░░██ ██░░░░ ░░░██░ ░░░░░░██ ░██ ░██
░██ ░██ ░██ ░ ███████ ░██ ░░ ░██░███████░░░░░░░░██░██░░░██░███████ ░██ ░██░██ ░██ ░██░░█████ ░██ ███████ ░██ ░██
░░██ ██ ░██ ██░░░░██ ░██ ██ ░██░██░░░░ ░██░██ ░██░██░░░░ ░██ ░██░██ ░██ ░██ ░░░░░██ ░██ ██░░░░██ ░██ ░██
░░███████ ░███ ░░████████░░█████ ███░░██████ ████████ ░██ ░██░░██████ ███ ███░██ ███ ░██ ██████ ░░██ ░░████████ ███ ███
░░░░░░░ ░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░░ ░░░░░░░░ ░░ ░░ ░░░░░░ ░░░ ░░░ ░░ ░░░ ░░ ░░░░░░ ░░ ░░░░░░░░ ░░░ ░░░
#==============================================================#
配置本地 YUM 源
#==============================================================#
[server]
name=server
baseurl=file:///mnt
enabled=1
gpgcheck=0
#==============================================================#
禁用防火墙
#==============================================================#
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Mar 11 14:50:11 rac02 systemd[1]: Starting firewalld - dynamic firewall daemon...
Mar 11 14:50:13 rac02 systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 11 14:50:13 rac02 firewalld[972]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a future release. Please consider disabling it now.
Mar 12 13:39:35 rac02 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Mar 12 13:39:36 rac02 systemd[1]: Stopped firewalld - dynamic firewall daemon.
#==============================================================#
禁用 SELinux
#==============================================================#
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: disabled
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
#==============================================================#
YUM 静默安装依赖包
#==============================================================#
bc-1.06.95-13.el7.x86_64
binutils-2.27-44.base.el7.x86_64
compat-libcap1-1.10-7.el7.x86_64
gcc-4.8.5-44.el7.x86_64
gcc-c++-4.8.5-44.el7.x86_64
elfutils-libelf-0.176-5.el7.x86_64
elfutils-libelf-devel-0.176-5.el7.x86_64
glibc-2.17-317.el7.x86_64
glibc-devel-2.17-317.el7.x86_64
libaio-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.x86_64
libgcc-4.8.5-44.el7.x86_64
libstdc++-4.8.5-44.el7.x86_64
libstdc++-devel-4.8.5-44.el7.x86_64
libxcb-1.13-1.el7.x86_64
libX11-1.6.7-2.el7.x86_64
libXau-1.0.8-2.1.el7.x86_64
libXi-1.7.9-1.el7.x86_64
libXrender-0.9.10-1.el7.x86_64
make-3.82-24.el7.x86_64
net-tools-2.0-0.25.20131004git.el7.x86_64
smartmontools-7.0-2.el7.x86_64
sysstat-10.1.5-19.el7.x86_64
e2fsprogs-1.42.9-19.el7.x86_64
e2fsprogs-libs-1.42.9-19.el7.x86_64
unzip-6.0-21.el7.x86_64
openssh-clients-7.4p1-21.el7.x86_64
readline-6.2-11.el7.x86_64
readline-devel-6.2-11.el7.x86_64
psmisc-22.20-17.el7.x86_64
ksh-20120801-142.el7.x86_64
nfs-utils-1.3.0-0.68.el7.x86_64
tar-1.26-35.el7.x86_64
device-mapper-multipath-0.4.9-133.el7.x86_64
avahi-0.6.31-20.el7.x86_64
ntp-4.2.6p5-29.el7_8.2.x86_64
chrony-3.4-1.el7.x86_64
libXtst-1.2.3-1.el7.x86_64
libXrender-devel-0.9.10-1.el7.x86_64
fontconfig-devel-2.13.0-4.3.el7.x86_64
policycoreutils-2.5-34.el7.x86_64
policycoreutils-python-2.5-34.el7.x86_64
#==============================================================#
配置主机名
#==============================================================#
rac02
#==============================================================#
配置 /etc/hosts 文件
#==============================================================#
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
## OracleBegin
## RAC1 IP's: rac01
## RAC1 Public IP
192.168.6.151 rac01
## RAC1 Virtual IP
192.168.6.153 rac01-vip
## RAC1 Private IP
1.1.1.1 rac01-priv
## RAC2 IP's: rac02
## RAC2 Public IP
192.168.6.152 rac02
## RAC2 Virtual IP
192.168.6.154 rac02-vip
## RAC2 Private IP
1.1.1.2 rac02-priv
## SCAN IP
192.168.6.155 rac-scan
#==============================================================#
创建用户和组
#==============================================================#
oracle 用户:
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba),54327(asmdba),54328(asmoper),54329(asmadmin)
grid 用户:
uid=11012(grid) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba),54327(asmdba),54328(asmoper),54329(asmadmin)
#==============================================================#
配置 Avahi-daemon 服务
#==============================================================#
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Mar 12 13:31:56 rac02 avahi-daemon[909]: Joining mDNS multicast group on interface ens192.IPv4 with address 192.168.6.152.
Mar 12 13:31:56 rac02 avahi-daemon[909]: New relevant interface ens192.IPv4 for mDNS.
Mar 12 13:31:56 rac02 avahi-daemon[909]: Registering new address record for 192.168.6.152 on ens192.IPv4.
Mar 12 13:31:57 rac02 avahi-daemon[909]: Registering new address record for fe80::3044:e992:319f:95a2 on ens224.*.
Mar 12 13:31:57 rac02 avahi-daemon[909]: Joining mDNS multicast group on interface ens224.IPv4 with address 1.1.1.2.
Mar 12 13:31:57 rac02 avahi-daemon[909]: New relevant interface ens224.IPv4 for mDNS.
Mar 12 13:31:57 rac02 avahi-daemon[909]: Registering new address record for 1.1.1.2 on ens224.IPv4.
Mar 12 13:40:06 rac02 systemd[1]: Stopping Avahi mDNS/DNS-SD Stack...
Mar 12 13:40:06 rac02 avahi-daemon[909]: Got SIGTERM, quitting.
Mar 12 13:40:06 rac02 systemd[1]: Stopped Avahi mDNS/DNS-SD Stack.
#==============================================================#
配置透明大页 && NUMA && 磁盘 IO 调度器
#==============================================================#
args="ro rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet LANG=en_US.UTF-8 numa=off transparent_hugepage=never elevator=deadline"
-rd.lvm.lv=rhel/root
-args="ro
args="ro rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet numa=off transparent_hugepage=never elevator=deadline"
-elevator=deadline"
-transparent_hugepage=never
#==============================================================#
配置 sysctl.conf
#==============================================================#
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8369381375
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
vm.min_free_kbytes = 32692
net.ipv4.conf.ens192.rp_filter = 1
vm.swappiness = 10
kernel.panic_on_oops = 1
kernel.randomize_va_space = 2
kernel.numa_balancing = 0
net.ipv4.conf.ens224.rp_filter = 2
#==============================================================#
配置 nsysctl.conf
#==============================================================#
NOZEROCONF=yes
#==============================================================#
配置 RemoveIPC
#==============================================================#
[Login]
RemoveIPC=no
#==============================================================#
配置 /etc/security/limits.conf 和 /etc/pam.d/login
#==============================================================#
查看 /etc/security/limits.conf:
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle hard memlock unlimited
oracle soft memlock unlimited
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
grid soft nproc 2047
grid hard nproc 16384
查看 /etc/pam.d/login 文件:
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth substack system-auth
auth include postlogin
account required pam_nologin.so
account include system-auth
password include system-auth
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include system-auth
session include postlogin
-session optional pam_ck_connector.so
session required pam_limits.so
session required /lib64/security/pam_limits.so
#==============================================================#
配置 /dev/shm
#==============================================================#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=96b8401c-571c-4575-82e9-1ce6b248167b /boot xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs size=8173224k 0 0
#==============================================================#
安装 rlwrap 插件
#==============================================================#
成功安装 rlwrap: rlwrap 0.44
#==============================================================#
Root 用户环境变量
#==============================================================#
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin
export PATH
alias so='su - oracle'
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias sg='su - grid'
alias crsctl='/u01/app/19.3.0/grid/bin/crsctl'
alias srvctl='/u01/app/19.3.0/grid/bin/srvctl'
#==============================================================#
Oracle 用户环境变量
#==============================================================#
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=lucifer2
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/perl/bin:$PATH
export PERL5LIB=$ORACLE_HOME/perl/lib
alias sas='sqlplus / as sysdba'
alias awr='sqlplus / as sysdba @?/rdbms/admin/awrrpt'
alias ash='sqlplus / as sysdba @?/rdbms/admin/ashrpt'
alias alert='vi $ORACLE_BASE/diag/rdbms/*/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias adrci='rlwrap adrci'
#==============================================================#
Grid 用户环境变量
#==============================================================#
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/19.3.0/grid
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=+ASM2
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
alias sas='sqlplus / as sysasm'
export PS1="[`whoami`@`hostname`:"'$PWD]$ '
alias sqlplus='rlwrap sqlplus'
alias asmcmd='rlwrap asmcmd'
alias adrci='rlwrap adrci'
#==============================================================#
配置 multipath 多路径
#==============================================================#
create: asm_ocr_1 (2e87e4f535c397171) undef ROCKET ,IMAGEFILE
size=10G features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
`- 33:0:0:0 sdb 8:16 undef ready running
create: asm_data_1 (2f218dae15b551c5d) undef ROCKET ,IMAGEFILE
size=20G features='0' hwhandler='0' wp=undef
`-+- policy='service-time 0' prio=1 status=undef
`- 33:0:0:1 sdc 8:32 undef ready running
#==============================================================#
配置 UDEV 绑盘
#==============================================================#
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-2e87e4f535c397171",SYMLINK+="asm_ocr_1",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-2f218dae15b551c5d",SYMLINK+="asm_data_1",OWNER="grid",GROUP="asmadmin",MODE="0660"
/dev/asm_data_1
/dev/asm_ocr_1
UDEV 配置完成!
配置 RAC 节点:192.168.6.152 结束!
#==============================================================#
配置 GRID 用户 SSH 互信
#==============================================================#
Generating public/private rsa key pair.
Your identification has been saved in /home/grid/.ssh/id_rsa.
Your public key has been saved in /home/grid/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Xxy1rYwXHi6ugoU2xinnwvqSPqr7c7xSF6Zkz7remTg grid@rac01
The key's randomart image is:
+---[RSA 2048]----+
| . |
| . o |
| . + .|
| o o . * + |
| o * +S = * |
| + % .. o o |
| = O + . . |
| * Eooo. . |
|==+X*=+ .. |
+----[SHA256]-----+
#==============================================================#
配置 ORACLE 用户 SSH 互信
#==============================================================#
Generating public/private rsa key pair.
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:WGnj9li/3rs1bK16dc/5xe9oRJCNMZeptDn7L5Xpyac oracle@rac01
The key's randomart image is:
+---[RSA 2048]----+
| o=.o |
| . =o+ |
| = . = |
| = . = . |
| . S . + o|
| . + .. o+=|
| . . .ooBX|
| o*OB|
| .++EBB|
+----[SHA256]-----+
#==============================================================#
静默解压缩 Grid 软件包
#==============================================================#
正在静默解压缩 Grid 软件包,请稍等:
.---- -. -. . . . .
( .',----- - - ' ' ' __
\_/ ;--:- __--------------------___ ____=========_||___
__U__n_^_''__[. ooo___ | |_!_||_!_||_!_||_!_| | |..|_i_|..|_i_|..|
c(_ ..(_ ..(_ ..( /,,,,,,] | |___||___||___||___| | | |
,_\___________'_|,L______],|______________________|_i,!________________!_i
/;_(@)(@)==(@)(@) (o)(o) (o)^(o)--(o)^(o) (o)(o)-(o)(o)
""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"'""
静默解压 Grid 软件安装包: /soft/LINUX.X64_193000_grid_home.zip
静默解压 OPatch 软件补丁包: /soft/p6880880_*.zip
静默解压 Grid 软件补丁包: /soft/p35940989*.zip
#==============================================================#
静默解压 Oracle 软件包
#==============================================================#
正在静默解压缩 Oracle 软件包,请稍等:
.---- -. -. . . . .
( .',----- - - ' ' ' __
\_/ ;--:- __--------------------___ ____=========_||___
__U__n_^_''__[. ooo___ | |_!_||_!_||_!_||_!_| | |..|_i_|..|_i_|..|
c(_ ..(_ ..(_ ..( /,,,,,,] | |___||___||___||___| | | |
,_\___________'_|,L______],|______________________|_i,!________________!_i
/;_(@)(@)==(@)(@) (o)(o) (o)^(o)--(o)^(o) (o)(o)-(o)(o)
""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"""~"'""
静默解压 Oracle 软件安装包: /soft/LINUX.X64_193000_db_home.zip
静默解压 OPatch 软件补丁包: /soft/p6880880_*.zip
#==============================================================#
Grid 安装静默文件
#==============================================================#
INVENTORY_LOCATION=/u01/app/oraInventory
oracle.install.option=CRS_CONFIG
ORACLE_BASE=/u01/app/grid
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.gpnp.scanName=rac-scan
oracle.install.crs.config.gpnp.scanPort=1521
oracle.install.crs.config.clusterName=rac-cls
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.clusterNodes=rac01:rac01-vip,rac02:rac02-vip
oracle.install.crs.config.networkInterfaceList=ens192:192.168.6.0:1,ens224:1.1.1.0:5
oracle.install.crs.config.useIPMI=false
oracle.install.asm.SYSASMPassword=oracle
oracle.install.asm.diskGroup.name=OCR
oracle.install.asm.diskGroup.redundancy=EXTERNAL
oracle.install.asm.diskGroup.disks=/dev/asm_ocr_1
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asm*
oracle.install.asm.monitorPassword=oracle
oracle.install.crs.config.ClusterConfiguration=STANDALONE
oracle.install.crs.config.configureAsExtendedCluster=false
oracle.install.crs.configureGIMR=false
oracle.install.asm.storageOption=ASM
oracle.install.asm.diskGroup.AUSize=4
oracle.install.asm.configureAFD=false
oracle.install.crs.config.ignoreDownNodes=false
oracle.install.config.managementOption=NONE
oracle.install.crs.rootconfig.executeRootScript=false
oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v19.0.0
oracle.install.crs.config.scanType=LOCAL_SCAN
#==============================================================#
静默安装 Grid 软件
#==============================================================#
Preparing the home to patch...
Applying the patch /soft/35940989...
Successfully applied the patch.
The log can be found at: /tmp/GridSetupActions2024-03-12_01-45-51PM/installerPatchActions_2024-03-12_01-45-51PM.log
Launching Oracle Grid Infrastructure Setup Wizard...
[WARNING] [INS-30011] The SYS password entered does not conform to the Oracle recommended standards.
CAUSE: Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
ACTION: Provide a password that conforms to the Oracle recommended standards.
[WARNING] [INS-30011] The ASMSNMP password entered does not conform to the Oracle recommended standards.
CAUSE: Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
ACTION: Provide a password that conforms to the Oracle recommended standards.
The response file for this session can be found at:
/u01/app/19.3.0/grid/install/response/grid_2024-03-12_01-45-51PM.rsp
You can find the log of this install session at:
/tmp/GridSetupActions2024-03-12_01-45-51PM/gridSetupActions2024-03-12_01-45-51PM.log
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/19.3.0/grid/root.sh
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[rac01, rac02]
Execute /u01/app/19.3.0/grid/root.sh on the following nodes:
[rac01, rac02]
Run the script on the local node first. After successful completion, you can start the script in parallel on all other nodes.
Successfully Setup Software.
As install user, execute the following command to complete the configuration.
/u01/app/19.3.0/grid/gridSetup.sh -executeConfigTools -responseFile /soft/grid.rsp [-silent]
Moved the install session logs to:
/u01/app/oraInventory/logs/GridSetupActions2024-03-12_01-45-51PM
#==============================================================#
执行 root 脚本
#==============================================================#
节点 192.168.6.151 :
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.
Check /u01/app/19.3.0/grid/install/root_rac01_2024-03-12_14-11-35-906912822.log for the output of root script
节点 192.168.6.152 :
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.
Check /u01/app/19.3.0/grid/install/root_rac02_2024-03-12_14-20-28-398646190.log for the output of root script
#==============================================================#
Grid 软件版本
#==============================================================#
SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.22.0.0.0
#==============================================================#
Grid 补丁信息
#==============================================================#
36115038;TOMCAT RELEASE UPDATE 19.0.0.0.0 (36115038)
35967489;OCW RELEASE UPDATE 19.22.0.0.0 (35967489)
35956421;ACFS RELEASE UPDATE 19.22.0.0.0 (35956421)
35943157;Database Release Update : 19.22.0.0.240116 (35943157)
33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)
OPatch succeeded.
#==============================================================#
ASM 磁盘组创建
#==============================================================#
State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 512 4096 1048576 20480 20372 0 20372 0 N DATA/
MOUNTED EXTERN N 512 512 4096 4194304 10240 9900 0 9900 0 Y OCR/
#==============================================================#
Oracle 安装静默文件
#==============================================================#
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.CLUSTER_NODES=rac01,rac02
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
oracle.install.db.rootconfig.executeRootScript=false
oracle.install.db.rootconfig.configMethod=
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
#==============================================================#
静默安装数据库软件
#==============================================================#
Preparing the home to patch...
Applying the patch /soft/35940989...
Successfully applied the patch.
The log can be found at: /u01/app/oraInventory/logs/InstallActions2024-03-12_02-27-24PM/installerPatchActions_2024-03-12_02-27-24PM.log
Launching Oracle Database Setup Wizard...
[WARNING] [INS-13013] Target environment does not meet some mandatory requirements.
CAUSE: Some of the mandatory prerequisites are not met. See logs for details. /u01/app/oraInventory/logs/InstallActions2024-03-12_02-27-24PM/installActions2024-03-12_02-27-24PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /u01/app/oraInventory/logs/InstallActions2024-03-12_02-27-24PM/installActions2024-03-12_02-27-24PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
/u01/app/oracle/product/19.3.0/db/install/response/db_2024-03-12_02-27-24PM.rsp
You can find the log of this install session at:
/u01/app/oraInventory/logs/InstallActions2024-03-12_02-27-24PM/installActions2024-03-12_02-27-24PM.log
As a root user, execute the following script(s):
1. /u01/app/oracle/product/19.3.0/db/root.sh
Execute /u01/app/oracle/product/19.3.0/db/root.sh on the following nodes:
[rac01, rac02]
Successfully Setup Software with warning(s).
#==============================================================#
执行 root 脚本
#==============================================================#
节点 192.168.6.151 :
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.
Check /u01/app/oracle/product/19.3.0/db/install/root_rac01_2024-03-12_15-08-43-940864602.log for the output of root script
节点 192.168.6.152 :
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.
Check /u01/app/oracle/product/19.3.0/db/install/root_rac02_2024-03-12_15-08-45-122786324.log for the output of root script
#==============================================================#
Oracle 软件版本
#==============================================================#
SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.22.0.0.0
#==============================================================#
Oracle 补丁信息
#==============================================================#
35967489;OCW RELEASE UPDATE 19.22.0.0.0 (35967489)
35943157;Database Release Update : 19.22.0.0.240116 (35943157)
OPatch succeeded.