oracle19c-silent installation (centos7)

Directory

  • 1. Environmental preparation
    • 1. Turn off the firewall
    • 2. Close SELINUX
    • 3. Configure local yum source
    • 4. Install ORACLE prerequisite packages
    • 5. Modify the LINUX kernel file
    • 6. Add the following parameters to /etc/security/limits.conf
    • 7. Add the following entries to /etc/pam.d/login
    • 8. Add the following statements to the environment variables
    • 9. Create file directories and corresponding users
    • 10. Configure the environment variables of the oracle user
    • 11. Upload the software and unzip it
  • 2. Silent installation
    • The first step is to execute the installation command
    • Step 2: Execute the corresponding file
    • Step 3 Configure monitoring silently
    • Step 4: Build the database silently
    • Step 5 Test
  • 3. Set up auto-start at boot


19c installation package

Link: https://pan.baidu.com/s/1qqd9tAKZC80-jAODq6URhw

Extraction code: odnq

– Sharing from Baidu Netdisk super member V2

rsp three files
Link: https://pan.baidu.com/s/1AapWtduIiRq5PTj1NBPFAQ
Extraction code: kclh
– Sharing from Baidu Netdisk super member V2

Environment centos7 4 core 16G

1. Environment preparation

1. Turn off the firewall

#Check firewall status
systemctl status firewalld.service

#Temporarily turn off the firewall. The firewall will still be started when the system starts next time.
systemctl stop firewalld.service

#Turn off the firewall completely and permanently
systemctl disable firewalld.service

2. Close SELINUX

vi /etc/selinux/config
will content
SELINUX=enforcing
change to
SELINUX=disabled

Or command to shut down selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

3. Configure local yum source

[root@localhost ~]# mkdir /yums
[root@localhost ~]# cd /run/media/root/CentOS\ 7\ x86_64/Packages/
[root@localhost Packages]# cp * /yums
[root@localhost Packages]# cd /yums
[root@localhost yums]# createrepo .
...
[root@localhost yums]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# vim yum.local.repo
[local]
name=yum local repo
baseurl=file:///yums
gpgcheck=0
enable=1
[root@localhost yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: local
Cleaning up list of fastest mirrors

[root@localhost yum.repos.d]# yum repolist

4. Install ORACLE prerequisite software packages

yum install -y bc
yum install -y compat-libcap1*
yum install -y compat-libcap*
yum install -y binutils
yum install -y compat-libstdc + + -33
yum install -y elfutils-libelf
yum install -y elfutils-libelf-devel
yum install -y gcc
yum install -y gcc-c++
yum install -y glibc-2.5
yum install -y glibc-common
yum install -y glibc-devel
yum install -y glibc-headers
yum install -y ksh libaio
yum install -y libaio-devel
yum install -y libgcc
yum install -y libstdc++
yum install -y libstdc++ -devel
yum install -y make
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install -y libXp*
yum install -y glibc-kernheaders
yum install -y net-tools-*

5. Modify LINUX kernel files

#Modify configuration
vi /etc/sysctl.conf
kernel.shmmax = 277495689510912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
fs.file-max = 6815744
kernel.shmall = 67747971072
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
#net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_keepalive_probes = 6
net.ipv4.tcp_keepalive_intvl = 5
net.ipv4.tcp_timestamps = 0
fs.aio-max-nr = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2

#Generate system parameters
sysctl-p

6. Add the following parameters to /etc/security/limits.conf

vi /etc/security/limits.conf

oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728

7. Add the following entries to /etc/pam.d/login

vim /etc/pam.d/login

session required /lib/security/pam_limits.so
session required pam_limits.so

8. Add the following statements to the environment variables

vim /etc/profile

if [ $USER = "oracle" ]; then
   if [ $SHELL = "/bin/ksh" ]; then
      ulimit -p 16384
      ulimit -n 65536
      else
      ulimit -u 16384 -n 65536
   fi
fi

#Generate environment variables
source /etc/profile

9. Create file directories and corresponding users

groupadd oinstall
groupadd dba
groupaddoper
useradd -g oinstall -G dba,oper oracle

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

#19c requires additional creation
--ORACLE's HOME directory
mkdir -p /u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall /u01/app/oracle/product/

#oracle account creation password
passwd oracle

10. Configure the environment variables of the oracle user

su-oracle

vim .bash_profile

export EDITOR=vi
export TMP=/tmp
exportTMPDIR=$TMP
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/db_1
export INVENTORY_LOCATION=/u01/oraInventory
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin
umask 022

source .bash_profile

Parameter Description
export EDITOR=vi The default editor is vi
export TMP=/tmp ORACLE’s default temporary directory is /tmp
export TMPDIR=$TMP temporary directory generation
export ORACLE_SID=orcl The ORACLE instance name is orcl
export ORACLE_BASE=/u01/app/oracle ORACLE's base directory
export ORACLE_HOME=$ORACLE_BASE/product/19c/db_1 HOME directory of the ORACLE database
export INVENTORY_LOCATION=/u01/oraInventory inventory during ORACLE installation
export TNS_ADMIN=$ORACLE_HOME/network/admin ORACLE's network home directory
export LD_LIBRARY_PATH=$ORACLE_HOME/lib ORACLE library file directory
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" ORACLE's character set, but we deprecated it because we use UTF8
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS" ORACLE's date format. We modify it using the session method. Deprecated
export PATH=$ORACLE_HOME/bin:/bin:/usr

11. Upload the software and unzip it

#Upload to/u01/app/oracle/product/19c/db_1
chown -R oracle:oinstall compressed package

#Switch oracle account
su-oralce
unzip compressed package

2. Silent installation

The first step is to execute the installation command

Upload three scripts to /home/oracle without modifying the owner group.
db_install.rsp
netca.rsp
dbca.rsp

#Enter $ORACLE_HOME and execute the following command. Be sure to remember where you put the rsp file.
./runInstaller -silent -force -noconfig -ignorePrereq -responseFile /home/oracle/db_install.rsp

The second step is to execute the corresponding file

#When you see the following: especially those 1 and 2, you need to start another LINUX connection client and execute it. Remember to execute it as the ROOT user!
As a root user, execute the following script(s):
        1. /u01/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/19c/db_1/root.sh
    
 #Execute the above file with root
 [root@localhost ~]# /u01/oraInventory/orainstRoot.sh
Changing permissions of /u01/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/oraInventory to oinstall.
The execution of the script is complete.
[root@localhost ~]# /u01/app/oracle/product/19c/db_1/root.sh
Check /u01/app/oracle/product/19c/db_1/install/root_localhost.localdomain_2023-08-28_14-29-28-951266686.log for the output of root script
When you see this result, the execution is complete.

Step 3: Configure monitoring silently

#Silent configuration listening
 netca -silent -responsefile /home/oracle/netca.rsp
 
Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /home/oracle/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
    Running Listener Control:
      /u01/app/oracle/product/19c/db_1/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
Seeing the above content indicates that the monitoring configuration is successful.
#lsnrctl status Check the monitoring status. Successful means the monitoring is normal.
 lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 28-AUG-2023 14:36:08

Copyright (c) 1991, 2019, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
--------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 28-AUG-2023 14:31:20
Uptime 0 days 0 hr. 4 min. 48 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/19c/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

Step 4: Build the database silently

#dbca silently build database
dbca -silent -createDatabase -responseFile /home/oracle/dbca.rsp

#The installation is complete
Successful installation:
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/ecology.
Database Information:
Global Database Name:ecology
System Identifier(SID):ecology
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ecology/ecology.log" for further details.

Step 5 Test

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Aug 28 02:42:50 2023
Version 19.3.0.0.0

Copyright (c) 1982, 2022, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

3. Set up auto-start at boot

oracle configuration starts automatically at boot
1. vim /etc/oratab
      Change N to Y
     /u01/app/oracle/product/19c/db_1:Y
2. vim /usr/bin/oracle.sh

  #!/bin/bash
/u01/app/oracle/product/19c/db_1/bin/lsnrctl start
/u01/app/oracle/product/19c/db_1/bin/dbstart /u01/app/oracle/product/19c/db_1
3. Give permission chmod 777 /usr/bin/oracle.sh
4. vim /etc/systemd/system/oracle19c.service
  
[Unit]
Description=Oracle19c
After=syslog.target network.target
[Service]
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=oneshot
RemainAfterExit=yes
User=oracle
Environment="ORACLE_HOME=/u01/app/oracle/product/19c/db_1"
ExecStart=/usr/bin/oracle.sh
[Install]
WantedBy=multi-user.target
5.systemctl enable oracle19c
6.systemctl is-enabled oracle19c.service #Check whether the service starts automatically at boot