Install Oracle Database 21C in silent mode on OEL8

This article presents how to install Oracle 21C on Oracle Enterprise Linux 8 (OEL8) in silent mode.

Read following article how to install Oracle Enterprise Linux 8: Install Oracle Linux 8 (OEL8) (for comfort set 8G memory for your virtual machine before proceeding with Oracle software installation).

Software

Software for 21C is available on OTN or edelivery

Original Oracle documentation for installation 21C for Linux

Database Installation Guide for Linux(Release 21c)

Database software

LINUX.X64_213000_db_home.zip

OS configuration and preparation

OS configuration is executed as root. To login as root just execute following command in terminal.

su - root

The “/etc/hosts” file must contain a fully qualified name for the server.

<IP-address>  <fully-qualified-machine-name>  <machine-name>

For example.

192.168.122.1 oel8 oel8.dbaora.com

Set hostname

hostnamectl set-hostname oel8.dbaora.com --static

It’s recommended to update OS with latest packages

dnf update

Extra configuration steps

  • add new OS groups
  • add new OS user
  • install required OS packages
  • set specific kernel parameters

Above steps can be done automatic or manually

Automatic

Execute following command

dnf install oracle-database-preinstall-21c

Details about steps executed by above statement can be found in file

/var/log/oracle-database-preinstall-21c/backup/<DATE>/orakernel.log

It will configure following things:

  • download/install required extra packages
  • configure required os groups
  • create oracle user
  • setup kernel parameters
  • setup user limits
  • change boot settings
  • network specific parameters
  • disable transparent hugepages – Refer Oracle Note:1557478.1
  • disable defrag – Refer Oracle Note:1557478.1

Manual

Manual installation can give you more control on installation

Download/Install required packages

#required

dnf install -y bc
dnf install -y binutils
dnf install -y compat-openssl10
dnf install -y elfutils-libelf
dnf install -y glibc
dnf install -y glibc-devel
dnf install -y ksh
dnf install -y libaio
dnf install -y libXrender
dnf install -y libX11
dnf install -y libXau
dnf install -y libXi
dnf install -y libXtst
dnf install -y libgcc
dnf install -y libnsl
dnf install -y libstdc++
dnf install -y libxcb
dnf install -y libibverbs
dnf install -y make
dnf install -y policycoreutils
dnf install -y policycoreutils-python-utils
dnf install -y smartmontools
dnf install -y sysstat

#optional no need to install

#(for Intelligent Platform Management Interface)
dnf install -y ipmiutil
#(for Oracle Database Client only)
dnf install -y libnsl2
#(for Oracle Database Client only)
dnf install -y libnsl2-devel
#(for KVM)
dnf install -y libvirt-libs
#(for Oracle RAC and Oracle Clusterware)
dnf install -y net-tools
#(for Oracle ACFS)
dnf install -y nfs-utils

Configure groups

groupadd -g 54321 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

Create Oracle user for database software

useradd -u 54321 -g oinstall \
-G dba,oper,backupdba,dgdba,kmdba,racdba oracle

Change password for user Oracle

passwd oracle

Setup kernel parameters to /etc/sysctl.d/99-oracle-database-preinstall-21c-sysctl.conf

# kernel parameters for 21C installation

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104

# oracle-21c setting kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1

net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range is 9000 65500

Apply kernel parameters

/sbin/sysctl -p

Add following lines to set shell limits for user oracle in file /etc/security/limits.d/oracle-database-preinstall-21c.conf

# shell limits for users oracle 21C

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
oracle soft data unlimited
oracle hard data unlimited

Disabling Transparent Hugepages and defrag

This step is recommended by Oracle to avoid later performance problems – Doc ID 1557478.1. It can be done by adding transparent_hugepage=never to /etc/default/grub

[root@oel8 ~]# cat /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/ol_oel8-swap rd.lvm.lv=ol_oel8/root rd.lvm.lv=ol_oel8/swap rhgb quiet numa=off transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

After applying and rebooting host can be checked with following command

[root@oel8 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

Next steps

Create directory structure for binaries as user root

  • ORACLE_BASE – /ora01/app/oracle
  • ORACLE_HOME – /ora01/app/oracle/product/21.3.0.0/db_1
mkdir -p /ora01/app/oracle/product/21.3.0.0/db_1
chown oracle:oinstall -R /ora01

Disable firewall

systemctl stop firewalld
systemctl disable firewalld

Add following lines in /home/oracle/.bash_profile for user oracle

# Oracle Settings
export TMP=/tmp

export ORACLE_HOSTNAME=oel8.dbaora.com
export ORACLE_UNQNAME=ORA21C
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/21.3.0.0/db_1
export ORACLE_SID=ORA21C

PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

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

envo

Copy database software

Connect as user oracle

[root@oel8 ~]# su - oracle

Copy zip to ORACLE_HOME directory and then uznip it

[oracle@oel8 ~]$ 
cp LINUX.X64_213000_db_home.zip /ora01/app/oracle/product/21.3.0.0/db_1

cd /ora01/app/oracle/product/21.3.0.0/db_1 unzip LINUX.X64_213000_db_home.zip

after unzip you should see following

[oracle@oel8 db_1]$ pwd
/ora01/app/oracle/product/21.3.0.0/db_1
[oracle@oel8 db_1]$ ls
addnode dbs instantclient md oracore python sdk usm
assistants deinstall inventory mgw ord QOpatch slax utl
bin demo javavm network ords R sqldeveloper xdk
clone diagnostics jdbc nls oss racg sqlj
crs dv jdk odbc oui rdbms sqlpatch
css env.ora jlib olap owm relnotes sqlplus
ctx has ldap oml4py perl root.sh srvm
cv hs lib OPatch plsql runInstaller suptools
data install LINUX.X64_213000_db_home.zip opmn precomp schagent.conf ucp

check environment settings

--I defined 4 aliases in .bash_profile of user oracle to make 
--administration easier :)

[oracle@oel8 ~]$ alias envo tns cdoh cdob
alias envo='env | grep ORACLE'
alias tns='cd $ORACLE_HOME/network/admin'
alias cdoh='cd $ORACLE_HOME'
alias cdob='cd $ORACLE_BASE'

--run alias command envo to display environment settings
[oracle@oel8 ~]$ envo
ORACLE_UNQNAME=ORA21C
ORACLE_SID=ORA21C
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOSTNAME=oel8.dbaora.com
ORACLE_HOME=/ora01/app/oracle/product/21.3.0.0/db_1
--run alias command cdob and cdoh --to check ORACLE_BASE, ORACLE_HOME [oracle@oel8 ~]$ cdob [oracle@oel8 oracle]$ pwd /ora01/app/oracle [oracle@oel8 ~]$ cdoh [oracle@oel8 db_1]$ pwd /ora01/app/oracle/product/21.3.0.0/db_1

Configure binaries, databaase, listener

Next steps:

  • configure binares
  • create listener
  • create database

It can be done using two options

  • response files
  • single commands

Response files

Once Oracle 21C binaries are unzipped. In following directories you can find response files that stores parameters necessary to install Oracle components:

directory response file  
$ORACLE_HOME/install/response db_install.rsp  
$ORACLE_HOME/assistants/dbca dbca.rsp  
$ORACLE_HOME/assistants/netca netca.rsp  
  • db_install.rsp – used to install oracle binaries, install/upgrade a database in silent mode
  • dbca.rsp – used to install/configure/delete a database in silent mode
  • netca.rsp – used to configure simple network for oracle database in silent mode
[oracle@oel8 response]$ cd $ORACLE_HOME/install/response

[oracle@oel8 response]$ pwd
/ora01/app/oracle/product/21.3.0.0/db_1/install/response

[oracle@oel8 response]$ ls *.rsp
db_install.rsp
[oracle@oel8 dbca]$ cd $ORACLE_HOME/assistants/dbca

[oracle@oel8 dbca]$ pwd
/ora01/app/oracle/product/21.3.0.0/db_1/assistants/dbca

[oracle@oel8 dbca]$ ls *.rsp
dbca.rsp
[oracle@oel8 dbca]$ cd $ORACLE_HOME/assistants/netca

[oracle@oel8 netca]$ pwd
/ora01/app/oracle/product/21.3.0.0/db_1/assistants/netca

[oracle@oel8 netca]$ ls *.rsp
netca.rsp

Using response files is optional so I’ll show as well how to do it without response file

Configure binaries

It’s the best to preserve original response file db_install.rsp before editing it

[oracle@oel8 response]$ cp db_install.rsp db_install.rsp.bck

Edit file db_install.rsp to set parameters required to install binaries. This is just example and in next releases parameters can be different. Each of presented parameter is very well described in db_install.rsp. I just give here brief explanations.

--------------------------------------------
-- force to install only database software
--------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

--------------------------------------------
-- set unix group for oracle inventory
--------------------------------------------
UNIX_GROUP_NAME=oinstall

--------------------------------------------
-- set directory for oracle inventory
--------------------------------------------
INVENTORY_LOCATION=/ora01/app/oraInventory

--------------------------------------------
-- set oracle home for binaries
--------------------------------------------
ORACLE_HOME=/ora01/app/oracle/product/21.3.0.0/db_1

--------------------------------------------
-- set oracle home for binaries
--------------------------------------------
ORACLE_BASE=/ora01/app/oracle

--------------------------------------------
-- set version of binaries to install
-- EE - enterprise edition
--------------------------------------------
oracle.install.db.InstallEdition=EE

--------------------------------------------
-- specify extra groups for database management
--------------------------------------------
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba

once edition is completed. Start binaries installation.

cd /ora01/app/oracle/product/21.3.0.0/db_1
./runInstaller -silent -ignorePrereq \
-responseFile /ora01/app/oracle/product/21.3.0.0/db_1/install/response/db_install.rsp

output is following

[oracle@oel8 db_1]$ ./runInstaller -silent -ignorePrereq \ -responseFile /ora01/app/oracle/product/21.3.0.0/db_1/install/response/db_install.rsp
Launching Oracle Database Setup Wizard...

[WARNING] [INS-13014] Target environment does not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2022-03-06_03-25-19PM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2022-03-06_03-25-19PM.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:
/ora01/app/oracle/product/21.3.0.0/db_1/install/response/db_2022-03-06_03-25-19PM.rsp

You can find the log of this install session at:
/tmp/InstallActions2022-03-06_03-25-19PM/installActions2022-03-06_03-25-19PM.log

As a root user, execute the following script(s):
1. /ora01/app/oraInventory/orainstRoot.sh
2. /ora01/app/oracle/product/21.3.0.0/db_1/root.sh

Execute /ora01/app/oraInventory/orainstRoot.sh on the following nodes:
[oel8]
Execute /ora01/app/oracle/product/21.3.0.0/db_1/root.sh on the following nodes:
[oel8]

Successfully Setup Software with warning(s).
Moved the install session logs to:
/ora01/app/oraInventory/logs/InstallActions2022-03-06_03-25-19PM

I got warnings about swap memory but it’s ignorebale error

you are asked to run two scripts as user root. Once it’s done binaries are installed.

[root@oel8 /]# 
/ora01/app/oraInventory/orainstRoot.sh
/ora01/app/oracle/product/21.3.0.0/db_1/root.sh

quick binary verification

[oracle@oel8 ~]$ sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Sun Mar 6 15:34:10 2022
Version 21.3.0.0.0

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

Connected to an idle instance.

SQL>

Configure listener

Again based on response file Oracle Net will be configured

cd /ora01/app/oracle/product/21.3.0.0/db_1/assistants/netca
cp netca.rsp netca.rsp.bck

You can edit netca.rsp to set own parameters. I didn’t changed anything here. So just start standard configuration. It will configure LISTENER with standard settings.

netca -silent -responseFile /ora01/app/oracle/product/21.3.0.0/db_1/assistants/netca/netca.rsp

Script output

[oracle@oel8 ~]$ netca -silent -responseFile /ora01/app/oracle/product/21.3.0.0/db_1/assistants/netca/netca.rsp

Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /ora01/app/oracle/product/21.3.0.0/db_1/assistants/netca/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/ora01/app/oracle/product/21.3.0.0/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

Check LISTENER status

[oracle@oel8 ~]$ lsnrctl status

LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 06-MAR-2022 15:36:50

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel8.dbaora.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date 06-MAR-2022 15:34:59
Uptime 0 days 0 hr. 1 min. 51 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /ora01/app/oracle/homes/OraDB21Home1/network/admin/listener.ora
Listener Log File /ora01/app/oracle/diag/tnslsnr/oel8/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel8)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

Configure database

The last setup is to create new container database ORA21C.dbaora.com with one pluggable database PORA21C1 and configure and enable oracle db express

Prepare directories for database datafiles and flash recovery area

mkdir /ora01/app/oracle/oradata
mkdir /ora01/app/oracle/flash_recovery_area

backup original response file for dbca

cd /ora01/app/oracle/product/21.3.0.0/db_1/assistants/dbca

cp dbca.rsp dbca.rsp.bck
vi dbca.rsp

set own parameters

--------------------------------------------
-- global database name
--------------------------------------------
gdbName=ORA21C.dbaora.com

--------------------------------------------
-- instance database name
--------------------------------------------
sid=ORA21C

--------------------------------------------
--create container database
--------------------------------------------
createAsContainerDatabase=true

--------------------------------------------
-- number of pluggable databases
--------------------------------------------
numberOfPDBs=1

--------------------------------------------
-- list of pluggable databases
--------------------------------------------
pdbName=PORA21C1

--------------------------------------------
-- pluggable administrator password
--------------------------------------------
pdbAdminPassword=Oracle21c#

--------------------------------------------
-- template name used to create database
--------------------------------------------
templateName=General_Purpose.dbc

--------------------------------------------
-- password for user sys
--------------------------------------------
sysPassword=Oracle21c#

--------------------------------------------
-- password for user system
--------------------------------------------
systemPassword=Oracle21c#

--------------------------------------------
-- configure dbexpress with port 5500
--------------------------------------------
emConfiguration=DBEXPRESS
emExpressPort=5510

--------------------------------------------
-- password for dbsnmp user
--------------------------------------------
dbsnmpPassword=Oracle21c#

--------------------------------------------
-- default directory for oracle database datafiles
--------------------------------------------
datafileDestination=/ora01/app/oracle/oradata

--------------------------------------------
-- default directory for flashback data
--------------------------------------------
recoveryAreaDestination=/ora01/app/oracle/flash_recovery_area

--------------------------------------------
-- storage used for database installation
-- FS - OS filesystem
--------------------------------------------
storageType=FS

-------------------------------------------- -- database character set -------------------------------------------- characterSet=AL32UTF8 -------------------------------------------- -- national database character set -------------------------------------------- nationalCharacterSet=AL16UTF16 -------------------------------------------- -- listener name to register database to -------------------------------------------- listeners=LISTENER -------------------------------------------- --specify database type --has influence on some instance parameters -------------------------------------------- databaseType=OLTP -------------------------------------------- -- defines size of memory used by the database -------------------------------------------- totalMemory=4096

run database installation

dbca -silent -createDatabase \
-responseFile /ora01/app/oracle/product/21.3.0.0/db_1/assistants/dbca/dbca.rsp

Example output

[oracle@oel8 dbca]$ dbca -silent -createDatabase \ -responseFile /ora01/app/oracle/product/21.3.0.0/db_1/assistants/dbca/dbca.rsp
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/ora01/app/oracle/cfgtoollogs/dbca/ORA21C.
Database Information:
Global Database Name:ORA21C.dbaora.com
System Identifier(SID):ORA21C
Look at the log file "/ora01/app/oracle/cfgtoollogs/dbca/ORA21C/ORA21C.log" for further details.

Verify connection

[oracle@oel8 ~]$ sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Sun Mar 6 16:00:52 2022
Version 21.3.0.0.0

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


Connected to:
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> show parameter db_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string ORA21C
SQL> alter session set container=PORA21C1;

Session altered.

SQL> show con_id

CON_ID
------------------------------
3
SQL> show con_name

CON_NAME
------------------------------
PORA21C1
SQL>

Check port status of db express in root database

SQL> ALTER SESSION SET CONTAINER=cdb$root;

Session altered.

SQL> select DBMS_XDB_CONFIG.GETHTTPSPORT from dual;

GETHTTPSPORT
------------
5510

SQL>

Single commands

Configure binaries

./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile /ora01/app/oracle/product/21.3.0.0/db_1/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/ora01/app/oraInventory \
ORACLE_HOME=/ora01/app/oracle/product/21.3.0.0/db_1 \
ORACLE_BASE=/ora01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=oper \
oracle.install.db.OSDGDBA_GROUP=dgdba \
oracle.install.db.OSKMDBA_GROUP=kmdba \
oracle.install.db.OSRACDBA_GROUP=racdba

Run as root following scripts

As a root user, execute the following script(s):
1. /ora01/app/oraInventory/orainstRoot.sh
2. /ora01/app/oracle/product/21.3.0.0/db_1/root.sh

Configure listener

lsnrctl start

Configure database

Prepare directories for database datafiles and flash recovery area

mkdir /ora01/app/oracle/oradata
mkdir /ora01/app/oracle/flash_recovery_area

run command

dbca -silent -createDatabase \
-gdbname ORA21C.dbaora.com \
-sid ORA21C \
-responseFile NO_VALUE \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName PORA21C1 \
-pdbAdminPassword Oracle21c# \
-templateName General_Purpose.dbc \
-sysPassword Oracle21c# \
-systemPassword Oracle21c# \
-emConfiguration DBEXPRESS \
-emExpressPort 5510 \
-dbsnmpPassword Oracle21c# \
-datafileDestination "/ora01/app/oracle/oradata" \
-recoveryAreaDestination "/ora01/app/oracle/flash_recovery_area" \
-storageType FS \
-characterSet AL32UTF8 \
-nationalCharacterSet AL16UTF16 \
-databaseType OLTP \
-totalMemory 4096 \
-ignorePreReqs

Have a fun 🙂

  Tomasz

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.