Install Oracle Database 21c on Red Hat Enterprise Linux (RHEL) 8 - CentLinux

Latest

Tuesday, 14 December 2021

Install Oracle Database 21c on Red Hat Enterprise Linux (RHEL) 8

Install Oracle Database 21c on Red Hat Enterprise Linux (RHEL) 8

Step by Step on-premises installation of Oracle Database 21c on Red Hat Enterprise Linux (RHEL) 8 or similar Linux distros.

 

Table of Contents:

 

install-oracle-database-21c-red-hat-enterprise-linux-8

 

What is Oracle Database 21c?:

Oracle Database offers market-leading performance, scalability, reliability, and security, both on-premises and in the cloud. Oracle Database 19c is the current long term release, and it provides the highest level of release stability and longest time-frame for support and bug fixes.

Oracle Database 21c, also available for production use today as an innovation release, provides an early insight into the many enhancements and new capabilities. These include autonomous administration, improved multi-model support through in-database Javascript and native block-chain tables, and multi-workload improvements such as AutoML and sharding enhancements that will be incorporated into future long term releases.

Oracle has consistently taken the approach that storing and managing data in a converged database is more efficient and productive than breaking up into multiple single-use engines - which inevitably results in data integrity, consistency and security issues. Simply put, a converged database is a multi-model, multi-tenant, multi-workload database. Oracle Database fully supports multiple data models and access methods, simplifies consolidation while ensuring isolation, and excels in typical database workload use cases - both operational and analytical.

The 21c generation of Oracle's converged database therefore offers customers: best of breed support for all data types (e.g. relational, JSON, XML, spatial, graph, OLAP, etc.), and industry-leading performance, scalability, availability and security for all their operational, analytical and other mixed workloads. Oracle's converged strategy also ensures that developers benefit from all Oracle Database 21c key capabilities (e.g. ACID transactions, read consistency, parallel scans and DML, online backups, etc.) - freeing them to focus on developing applications without having to worry about data persistence.

 

Recommended Books: Red Hat RHCE 8 (EX294) Cert Guide (Certification Guide) 1st Edition by Sander van Vugt

 

New Features in Oracle Database 21c:

The distinct features of Oracle Database 21c are:

  • Blockchain Tables
  • Multilingual Engine - JavaScript Execution in the Database
  • Binary JSON Data Type
  • Per-PDB Data Guard Physical Standby (aka Multitenant Data Guard)
  • Per-PDB GoldenGate Change Capture
  • Self-Managing In-Memory
  • In-Memory Hybrid Columnar Scan
  • In-Memory Vector Joins with SIMD
  • Sharding Advisor Tool
  • Property Graph Visualization Studio
  • Automatic Materialized Views
  • Automatic Zone Maps
  • SQL Macros
  • Gradual Password Rollover

 

Environment Specification:

We are using a minimal Red Hat Enterprise Linux 8 virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Red Hat Enterprise Linux 8.5
  • Hostname – oracle-01.centlinux.com
  • IP Address - 192.168.116.128 /24

 

Set Hostname and Local DNS Resolution:

By using a SSH client, connect with oracle-01.centlinux.com as root user.

Set an appropriate hostname for your Oracle Database server with the help of following Linux command.

# hostnamectl set-hostname oracle-01.centlinux.com

Execute following command to add an entry in Local DNS Resolver or you can use a DNS server (if available).

# echo "192.168.116.128 oracle-01.centlinux.com oracle-01" >> /etc/hosts

 

Update Linux Operating System:

It is the best practice to update your Linux operating system before a new software installation. Therefore, use following dnf commands to update your exisiting software packages.

# dnf makecache
# dnf update -y

If Package Manager updates your Linux Kernel, then you should reboot your Linux operating system with the new Kernel.

# reboot

Verify the Linux Kernel and Operating System versions that are being used in this installation guide.

# uname -r
4.18.0-348.2.1.el8_5.x86_64

# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.5 (Ootpa)

 

Disable Transparent HugePages in RHEL 8:

Oracle recommends that you disable Transparent HugePages, because they may cause delays in accessing memory that can result in node restarts in Oracle RAC environments and performance issues or delays for Oracle Database single instances. Instead, Oracle recommends using Standard HugePages for Linux based operating systems.

Transparent HugePages are enable by default in EL (Enterprise Linux) 6 or later.

Verify that Transparent HugePages are enabled on your Linux server.

# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

We have already disabled the Transparent HugePages in our Linux server. You can do the same by following our previous article about how to disable transparent hugepages.

 

Install Oracle Database 21c Prerequisites on RHEL 8:

For proper functioning Oracle Database 21c depends upon various third party software packages.

Fortunately, all these required packages are available in RHEL 8 default yum repositories. Execute following dnf command to install all these prerequisites in one go.

Make sure you have acquire an active Red Hat Subscription or you may not complete this step successfully.

# dnf install -y  \
> bc \
> binutils \
> compat-openssl10 \
> elfutils-libelf \
> glibc \
> glibc-devel \
> ksh \
> libaio \
> libXrender \
> libX11 \
> libXau \
> libXi \
> libXtst \
> libgcc \
> libnsl \
> libstdc++ \
> libxcb \
> libibverbs \
> make \
> policycoreutils \
> policycoreutils-python-utils \
> smartmontools \
> sysstat \
> libnsl2 \
> libnsl2-devel \
> net-tools \
> nfs-utils \
> unzip

 

Create Linux Users and Groups:

Create Linux users and groups as required by Oracle Database 21c.

# groupadd -g 1501 oinstall
# groupadd -g 1502 dba
# groupadd -g 1503 oper
# groupadd -g 1504 backupdba
# groupadd -g 1505 dgdba
# groupadd -g 1506 kmdba
# groupadd -g 1507 racdba
# useradd -u 1501 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba oracle
# echo "oracle" | passwd oracle --stdin
Changing password for user oracle.
passwd: all authentication tokens updated successfully.

 

Set Security limits for oracle user:

Create a configuration file in /etc/security/limits.d directory, to set the security limits for the oracle user.

# vi /etc/security/limits.d/30-oracle.conf

Add following lines in this file.

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

 

Set Linux Kernel Parameters for Oracle Database 21c:

Create a configuration file in /etc/sysctl.d directory.

# vi /etc/sysctl.d/98-oracle.conf

Set the following Linux Kernel parameters as required by the Oracle Database 21c.

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
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 = 9000 65500

Reload Kernel parameters now by using sysctl command.

# sysctl -p

 

Configure SELinux Target Mode in RHEL 8:

Persistently set SELinux mode to permissive.

# sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
# setenforce permissive

 

Configure Linux Firewall:

Allow Oracle SQL* Net Listener port 1521/tcp in Linux Firewall.

# firewall-cmd --permanent --add-port=1521/tcp
success
# firewall-cmd --reload
success

 

Create Directories for Oracle Database 21c:

Create the necessary directories for Oracle software and adjust the ownership and permissions on these directories.

# mkdir -p /u01/app/oracle/product/21.3.0/dbhome_1
# mkdir -p /u02/oradata
# chown -R oracle:oinstall /u01 /u02
# chmod -R 775 /u01 /u02

Here, we have created two directories, /u01 for the Oracle RDBMS and /u02 for the Oracle Databases.

 

Configure Linux Environment for Oracle User:

Connect as oracle user and open .bash_profile in vim text editor.

# su - oracle
$ vi ~/.bash_profile

Add following lines to set environment variables for oracle user.

# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=oracle-01.centlinux.com
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/21.3.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cdb1
export PDB_NAME=pdb1
export DATA_DIR=/u02/oradata

export PATH=$ORACLE_HOME/bin:$PATH

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

Manually execute the .bash_profile to set the environment for current Linux shell.

$ source ~/.bash_profile

 

Install Oracle Database 21c on RHEL 8 in Silent Mode:

You can download Oracle Database 21c from Oracle official website. You have to create a free Oracle Single Sign-On account to login and download the software.

download-oracle-database-21c

We have downloaded Oracle Database 21c (21.3) for Linux and transferred it into home directory of oracle user.

Unzip the downloaded zip file to ORACLE_HOME directory.

$ unzip LINUX.X64_213000_db_home.zip -d $ORACLE_HOME

Go to ORACLE_HOME directory and start Oracle Database 21c installation in silent mode.

$ cd $ORACLE_HOME
$ ./runInstaller -ignorePrereq -waitforcompletion -silent \
> oracle.install.option=INSTALL_DB_SWONLY \
> ORACLE_HOSTNAME=${ORACLE_HOSTNAME} \
> UNIX_GROUP_NAME=oinstall \
> INVENTORY_LOCATION=${ORA_INVENTORY} \
> ORACLE_HOME=${ORACLE_HOME} \
> ORACLE_BASE=${ORACLE_BASE} \
> oracle.install.db.InstallEdition=EE \
> oracle.install.db.OSDBA_GROUP=dba \
> oracle.install.db.OSBACKUPDBA_GROUP=backupdba \
> oracle.install.db.OSDGDBA_GROUP=dgdba \
> oracle.install.db.OSKMDBA_GROUP=kmdba \
> oracle.install.db.OSRACDBA_GROUP=racdba \
> SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
> DECLINE_SECURITY_UPDATES=true
Launching Oracle Database Setup Wizard...

The response file for this session can be found at:
 /u01/app/oracle/product/21.3.0/dbhome_1/install/response/db_2021-12-10_08-46-35AM.rsp

You can find the log of this install session at:
 /tmp/InstallActions2021-12-10_08-46-35AM/installActions2021-12-10_08-46-35AM.log

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/21.3.0/dbhome_1/root.sh

Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[oracle-01]
Execute /u01/app/oracle/product/21.3.0/dbhome_1/root.sh on the following nodes:
[oracle-01]


Successfully Setup Software.
Moved the install session logs to:
 /u01/app/oraInventory/logs/InstallActions2021-12-10_08-46-35AM

Connect as root user and execute post-installation scripts.

$ su -
Password:
Last login: Fri Dec 10 08:23:01 EST 2021 from 192.168.116.1 on pts/0
# /u01/app/oraInventory/orainstRoot.sh
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.

# /u01/app/oracle/product/21.3.0/dbhome_1/root.sh
Check /u01/app/oracle/product/21.3.0/dbhome_1/install/root_oracle-01.centlinux.com_2021-12-10_09-16-32-458187002.log for the output of root script
# exit

Oracle Database 21c has been installed on Red Hat Enterprise Linux 8.

 

Create an Oracle Multitenant Database in Silent Mode:

Start Oracle Listener by executing following command.

$ lsnrctl start
LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 10-DEC-2021 09:18:26

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

Starting /u01/app/oracle/product/21.3.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oracle-01/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle-01.centlinux.com)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date                10-DEC-2021 09:18:26
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracle-01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle-01.centlinux.com)(PORT=1521)))
The listener supports no services
The command completed successfully

Create an Oracle Multitenant database by using the following command.

$ dbca -silent -createDatabase \
> -templateName General_Purpose.dbc \
> -gdbname ${ORACLE_SID} \
> -sid ${ORACLE_SID} \
> -responseFile NO_VALUE \
> -characterSet AL32UTF8 \
> -sysPassword Str@ngP@55 \
> -systemPassword Str@ngP@55 \
> -createAsContainerDatabase true \
> -numberOfPDBs 1 \
> -pdbName ${PDB_NAME} \
> -pdbAdminPassword Str@ngP@55 \
> -databaseType MULTIPURPOSE \
> -automaticMemoryManagement false \
> -totalMemory 800 \
> -storageType FS \
> -datafileDestination "${DATA_DIR}" \
> -redoLogFileSize 50 \
> -emConfiguration NONE \
> -ignorePreReqs
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
53% 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:
 /u01/app/oracle/cfgtoollogs/dbca/cdb1.
Database Information:
Global Database Name:cdb1
System Identifier(SID):cdb1
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb1/cdb1.log" for further details.

Switch to root user and execute following command to enable autostart of Oracle database instances.

$ su -
Password:
Last login: Fri Dec 10 10:04:05 EST 2021 on pts/0
# sed -i 's/:N$/:Y/g' /etc/oratab
# exit
logout

Connect to SQL Shell by using sqlplus command.

$ sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Dec 10 10:09:09 2021
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>

Enable Oracle Managed File (OMF) to simplify the creation of databases and database files.

SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST='/u02/oradata' SCOPE=BOTH;

System altered.

Enable autostart of Pluggable databases with the startup of Container Database.

SQL> ALTER PLUGGABLE DATABASE PDB1 SAVE STATE;

Pluggable database altered.

SQL> exit
Disconnected from Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

 

Configure AutoStart of Oracle Database Server on RHEL 8:

To configure autostart of Oracle Database 21c on Red Hat Enterprise Linux 8, you have to create a Systemd service.

Switch to root user and create a Systemd service unit by using vim text editor.

$ su -
Password:
Last login: Fri Dec 10 10:06:34 EST 2021 on pts/0
# vi /usr/lib/systemd/system/dbora.service

Add following directives in this file.

[Unit]
Description=Oracle Database Service
After=network.target

[Service]
Type=forking
ExecStart=/u01/app/oracle/product/21.3.0/dbhome_1/bin/dbstart /u01/app/oracle/product/21.3.0/dbhome_1
ExecStop=/u01/app/oracle/product/21.3.0/dbhome_1/bin/dbshut /u01/app/oracle/product/21.3.0/dbhome_1
User=oracle
TimeoutSec=300s

[Install]
WantedBy=multi-user.target

Execute following command to notify Systemd about changes in unit files.

# systemctl daemon-reload

Enable and start Oracle Database 21c service.

# systemctl enable --now dbora.service
Created symlink /etc/systemd/system/multi-user.target.wants/dbora.service → /usr/lib/systemd/system/dbora.service.

Verify the status of the Oracle Database 21c service.

# systemctl status dbora.service
● dbora.service - Oracle Database Service
   Loaded: loaded (/usr/lib/systemd/system/dbora.service; enabled; vendor prese>
   Active: active (running) since Fri 2021-12-10 21:11:43 EST; 40s ago
  Process: 1761 ExecStart=/u01/app/oracle/product/21.3.0/dbhome_1/bin/dbstart />
 Main PID: 1772 (tnslsnr)
    Tasks: 1 (limit: 12267)
   Memory: 5.0M
   CGroup: /system.slice/dbora.service
           └─1772 /u01/app/oracle/product/21.3.0/dbhome_1/bin/tnslsnr LISTENER >

Dec 10 21:11:42 oracle-01.centlinux.com systemd[1]: Starting Oracle Database Se>
Dec 10 21:11:43 oracle-01.centlinux.com dbstart[1761]: Processing Database inst>
Dec 10 21:11:43 oracle-01.centlinux.com systemd[1]: Started Oracle Database Ser>

 

Conclusion:

You have successfully installed Oracle Database 21c on Red Hat Enterprise Linux (RHEL) 8 in silent mode, and created an Oracle Multitenant Database on this database server.

No comments:

Post a Comment