RHEL8 安装19c grid和rdbms

##安装桌面

yum -y groupinstall "Server with GUI"


##安装rpm

https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/supported-red-hat-enterprise-linux-8-distributions-for-x86-64.html#GUID-B1487167-84F8-4F8D-AC31-A4E8F592374B
https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/supported-red-hat-enterprise-linux-8-distributions-for-x86-64.html#GUID-B1487167-84F8-4F8D-AC31-A4E8F592374B
yum -y install bc bc binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libXrender libX11 libXau libXi libXtst libgcc libnsl librdmacm libstdc++ libstdc++-devel libxcb libibverbs make policycoreutils policycoreutils-python-utils smartmontools sysstat ipmiutil libnsl2 libnsl2-devel net-tools nfs-utils unixODBC unixODBC-devel libnsl gcc automake autoconf libtool make glibc-devel

##如果使用NAS或者NFS执行下面

https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/enabling-the-name-service-cache-daemon.html#GUID-2578FE34-E846-4D0D-85AC-E2A191915578
# chkconfig --list nscd
nscd                      0:off  1:off  2:off  3:on   4:off  5:off   6:off
# chkconfig --level 35 nscd on
# service nscd start
# service nscd restart
# systemctl --all |grep nscd
# nscd.service loaded active running Name Service Cache Daemon


##设置 I/O Scheduler

https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/setting-the-disk-io-scheduler-on-linux.html#GUID-B59FCEFB-20F9-4E64-8155-7A61B38D8CDF
# cat /sys/block/${ASM_DISK}/queue/scheduler
noop [deadline] cfq
#如果不是deadline,需要执行下面的命令:
# vi /etc/udev/rules.d/60-oracle-schedulers.rules
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}=“deadline"
scp 60-oracle-schedulers.rules root@node2:/etc/udev/rules.d/
udevadm control --reload-rules


##NTP和chronyd,一般在linux7上

# systemctl stop ntpd
# systemctl disable ntpd
# systemctl stop chronyd
# systemctl disable chronyd


##创建要用户和组

https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/creating-operating-system-privileges-groups.html#GUID-164A7218-166D-4B58-9A86-88149E8FCB83
https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/creating-users-groups-on-other-cluster-nodes.html#GUID-3F1C9069-66F6-4C60-B162-24BA1116F683
https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/creating-an-oracle-software-owner-user.html#GUID-C1E5CEA8-741A-4500-B03E-B4A6BC1E87BB
https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/identifying-an-oracle-software-owner-user-account.html#GUID-0A95F4B1-1045-455D-9897-A23012E4E27F
groupadd -g 11001 oinstall  
groupadd -g 11002 dba  
groupadd -g 11003 oper  
groupadd -g 11004 backupdba  
groupadd -g 11005 dgdba  
groupadd -g 11006 kmdba  
groupadd -g 11007 asmdba  
groupadd -g 11008 asmoper  
groupadd -g 11009 asmadmin  
groupadd -g 11010 racdba  
useradd -u 11011 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle  
useradd -u 11012 -g oinstall -G asmadmin,asmdba,asmoper,dba,racdba grid
[root@ray21 yum.repos.d]# echo oracle | passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
[root@ray21 yum.repos.d]# echo oracle | passwd --stdin grid
Changing password for user grid.
passwd: all authentication tokens updated successfully.


##创建目录

https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/about-creating-oracle-base-oracle-home-directories.html#GUID-E704B28B-8925-441F-88B8-0B70485AD6B6
mkdir -p /u01/app/19.0.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/


##设置资源限制

https://docs.oracle.com/en/database/oracle/oracle-database/19/cwlin/checking-resource-limits-for-oracle-software-installation-users.html#GUID-293874BD-8069-470F-BEBF-A77C06618D5A
vi /etc/security/limits.conf
grid  soft  nproc 2047
grid  hard  nproc 16384
grid  soft  nofile 1024
grid  hard  nofile 65536
grid  soft  stack 10240
grid  hard  stack 32768
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack  10240
oracle hard stack  32768
oracle hard memlock 4194304
oracle soft memlock 4194304
##memlock这个值还是应该比内存配置略小,也就是要配置的足够大。单位:k
##4194304 表示4G


##关闭防火墙和selinux

[root@ora71 ~]# systemctl stop firewalld
[root@ora71 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@ora71 ~]#
[root@ora71 ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@ora71 ~]# getenforce
Permissive
[root@ora72 ~]# egrep -v "^#|^$" /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted


##禁用透明大页

[root@ray103 yum.repos.d]# vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swap rhgb quiet numa=off transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
[root@ray103 yum.repos.d]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done


##配置sysctl文件

/sbin/sysctl -a | grep shm
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 18446744073692774399
kernel.shmmax = 18446744073692774399
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
##多私有网卡,使用下面修改私有网卡的rp_filter值为2
net.ipv4.conf.enp0s8.rp_filter = 2
net.ipv4.conf.enp0s9.rp_filter = 2
sysctl -p


##停止avahi-daemon服务

[root@ray151 ~]# systemctl stop avahi-daemon.socket
[root@ray151 ~]# systemctl disable avahi-daemon.socket
Removed /etc/systemd/system/sockets.target.wants/avahi-daemon.socket.
[root@ray151 ~]# systemctl stop avahi-daemon.service
[root@ray151 ~]# systemctl disable avahi-daemon.service
Removed /etc/systemd/system/multi-user.target.wants/avahi-daemon.service.
Removed /etc/systemd/system/dbus-org.freedesktop.Avahi.service.
[root@ray151 ~]# ps -ef|grep avahi-daemon
root        2493    1709  0 11:22 pts/0    00:00:00 grep --color=auto avahi-daemon

##编辑共享磁盘

[root@ray21 ~]# /usr/lib/udev/scsi_id -g -u -d /dev/sdb
1ATA_VBOX_HARDDISK_VBe5a06cf8-14a27d28
[root@ray21 ~]# /usr/lib/udev/scsi_id -g -u -d /dev/sdc
1ATA_VBOX_HARDDISK_VB7cc0c900-27b2606d
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sdb", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBe5a06cf8-14a27d28",  OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sdc", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB7cc0c900-27b2606d",  OWNER="grid", GROUP="asmadmin", MODE="0660"
#重启服务
udevadm trigger --type=devices --action=change
##验证权限和属组
ls -Ll /dev/mapper/*
ls -Ll /dev/oraasm-*
ls -Ll /dev/dm-*
#多路径配置
#/etc/multipath.conf
multipaths {
        multipath {
                wwid 36006048cd70c3e37a4a85c04d0c79c6d
                alias data1
        }
        multipath {
                wwid 36006048cb82e28ed3701a9e1eecb820a
                alias crs1
         }
         multipath {
                 wwid 3600601606a003a001eebdf56d80e0b2f
                 alias data2
         }
         multipath {
                 wwid 3600601606a003a004aebdf56fce34966
                 alias data3
         }
}
#配置udev
cd /dev/mapper
for i in `ls mpath*`; do printf "%s %s\n" "$i" "$(udevadm info --query=all --name=/dev/mapper/$i |grep -i dm_uuid)"; done
data1 E: DM_UUID=mpath-36006048cd70c3e37a4a85c04d0c79c6d
crs1 E: DM_UUID=mpath-36006048cb82e28ed3701a9e1eecb820a
data2 E: DM_UUID=mpath-3600601606a003a001eebdf56d80e0b2f
data3 E: DM_UUID=mpath-3600601606a003a004aebdf56fce34966
[root@rac1 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36006048cd70c3e37a4a85c04d0c79c6d",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-36006048cb82e28ed3701a9e1eecb820a",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600601606a003a001eebdf56d80e0b2f",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-3600601606a003a004aebdf56fce34966",SYMLINK+="oraasm-$env{DM_NAME}",OWNER="grid",GROUP="asmadmin",MODE="0660"
#重启udev服务
udevadm trigger --type=devices --action=change
##验证权限和属组
ls -Ll /dev/mapper/*
ls -Ll /dev/oraasm-*
ls -Ll /dev/dm-*

##编辑profile文件

[root@ray151 ~]# su - grid
[grid@ray151 ~]$ vi .bash_profile
ORACLE_SID=+ASM; export ORACLE_SID
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/19.0.0/grid; export ORACLE_HOME
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
[root@ray151 ~]# su - oracle
[oracle@ray151 ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1
export ORACLE_SID=raysuen
PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

##安装cvu

[root@ray151 ~]# rpm -ivh /u01/app/19.0.0/grid/cv/rpm/cvuqdisk-1.0.10-1.rpm


#因系统兼容问题,需要执行下面的命令,否则将会报错

[INS-08101] Unexpected error while executing the action at state: 'supportedOSCheck'
#解决:
export CV_ASSUME_DISTID=RHEL7.6


##安装    

[grid@ray151 grid]$ ./gridSetup.sh

##错误

Error in invoking target 'libasmclntsh19.ohso libasmperl19.ohso client_sharedlib' of makefile ins_rdbms.mk
#解决:
yum -y install glibc-devel


##安装RDBMS

export CV_ASSUME_DISTID=RHEL7.6
cd /u01/app/oracle/product/19.0.0/db_1/
./runInstaller


##DBCA建库
dbca












[root@ray151 ~]# /u01/app/grid/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/grid/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/grid/oraInventory to oinstall.
The execution of the script is complete.
[root@ray151 ~]# /u01/app/19.0.0/grid/root.sh
Performing root user operation.
The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /u01/app/19.0.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.
Using configuration parameter file: /u01/app/19.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/ray151/crsconfig/roothas_2022-02-22_04-40-17PM.log
2022/02/22 16:40:24 CLSRSC-363: User ignored prerequisites during installation
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node ray151 successfully pinned.
2022/02/22 16:40:34 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
ray151     2022/02/22 16:41:17     /u01/app/grid/crsdata/ray151/olr/backup_20220222_164117.olr     724960844     
2022/02/22 16:41:18 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

##安装RDBMS








##建库















请使用浏览器的分享功能分享到微信等