Site icon CentLinux

How to install Oracle 21c on Rocky Linux 8

Share on Social Media

Learn how to install Oracle 21c on Rocky Linux 8 with our comprehensive step-by-step guide. Set up your Oracle database efficiently on Rocky Linux 8 today. #centlinux #linux #oracle

What is Oracle 21c?

Oracle Database offers market-leading performance, scalability, reliability, and security, both on-premises and in the cloud. Oracle Database 21c 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 is available for production with 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.

Unlike Oracle Linux, to install Oracle 21c on Rocky Linux 8, we have to perform additional configuration steps. Because the Preinstall package only works for Oracle Linux OS, therefore, we need to manually perform each step to install Oracle 21c on Rocky Linux 8.

What’s new in Oracle 21c?

The distinct features of Oracle Database 21c are:

Now, you have understand the features and benefits of industry most popular database server. Let’s move forward to install Oracle 21c on Rocky Linux 8.

Recommended Online Training: Complete Oracle Database Administration course (19C,21C)

Environment Specification

We are using a Rocky Linux 8 minimal server  with following specifications.

Configure Hostname and Local DNS Resolution

Connect with oracle-02.centlinux.com as root user by means of a ssh client.

Set the hostname of your Rocky Linux server by using hostnamectl command.

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

It is a good idea to set local DNS resolution, so your Linux server does not look for a Private DNS server to resolve it’s own hostname.

To setup local DNS resolution, you need to add an entry in /etc/hosts file. The following command will do this, you only need to change IP Address and hostname according to your environment.

# echo "192.168.116.129 oracle-02.centlinux.com oracle-02" >> /etc/hosts

Update Linux Software Packages

Rebuild cache of your enabled yum repositories.

# dnf makecache
Rocky Linux 8 - AppStream                       191  B/s | 4.8 kB     00:25
Rocky Linux 8 - BaseOS                          1.3 kB/s | 4.3 kB     00:03
Rocky Linux 8 - Extras                          1.1 kB/s | 3.5 kB     00:03
Metadata cache created.

Now, you can easily update software packages in your Linux operating system by using dnf command.

# dnf update -y

If the above command updates your Linux Kernel, then you should reboot your operating system before moving forward.

# reboot

After successful reboot, verify the versions of Linux operating system and Kernel that are being used in this tutorial.

# cat /etc/rocky-release
Rocky Linux release 8.6 (Green Obsidian)

# uname -r
4.18.0-372.16.1.el8_6.0.1.x86_64

Disable Transparent Hugepages

Oracle recommends that, you must disable the Transparent Hugepages before installing their database server.

We have already wrote an tutorial on how to disable the Transparent Hugepages in Linux. You can follow that guide, to disable this Linux memory management feature.

Before start to Oracle 21c installation, you can verify that, if the Transparent Hugepages are successfully disabled in your Linux operating system.

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

if you find the [never] in the output of above command, then this memory management feature has been disabled successfully.

Install Oracle 21c Prerequisites

We are providing a single dnf command to install all the prerequisite software packages of Oracle Database 21c. Execute this command at your Linux bash prompt.

# 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 
> net-tools 
> nfs-utils 
> unzip

Create Linux Users and Groups

Oracle Database 21c requires a few Linux users and groups. You can create it by executing following group of commands.

# 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 Linux 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

Define following settings 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

Create a configuration file in /etc/sysctl.d directory by using vim text editor.

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

Define 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

Persistently set SELinux target mode to permissive by executing following commands at Linux bash prompt.

# 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 21c Installation

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
# Install Oracle 21c on Rocky Linux 8
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=oracle-02.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

How to Install Oracle 21c on Rocky Linux 8?

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

Oracle Database Software Downloads

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

$ ls ~
LINUX.X64_213000_db_home.zip

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_2022-07-23_10-08-38PM.rsp

You can find the log of this install session at:
 /tmp/InstallActions2022-07-23_10-08-38PM/installActions2022-07-23_10-08-38PM.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-02]

Execute /u01/app/oracle/product/21.3.0/dbhome_1/root.sh on the following nodes:

[oracle-02]

Successfully Setup Software. Moved the install session logs to: /u01/app/oraInventory/logs/InstallActions2022-07-23_10-08-38PM

Connect as root user and execute post-installation scripts.

$ su -
Password:
Last login: Sat Jul 23 22:55:06 PKT 2022 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-02.centlinux.com_2022-07-23_22-55-33-827691288.log for the output of root script

# exit
logout

You have successfully install Oracle 21c on Linux 8. If you feel any difficulty in understanding the above commands, then we recommend that you should read the following book or it is much better if you attend the following online training for quick results.

Recommended Book: How Linux Works, 3rd Edition: What Every Superuser Should Know (PAID LINK) by Brian Ward (Author)

Create Your First Oracle Multitenant Database

Start Oracle Listener by executing lsnrctl command.

$ lsnrctl start

LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 23-JUL-2022 22:56:29

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-02/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle-02.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 23-JUL-2022 22:56:29
Uptime 0 days 0 hr. 0 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle-02/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle-02.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.

Edit /etc/oratab file by using vim text editor.

$ vi /etc/oratab

Find and edit following setting to enable autostart of Oracle Instance.

cdb1:/u01/app/oracle/product/21.3.0/dbhome_1:Y

Connect to SQL Shell by using sqlplus command.

$ sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Sat Jul 23 23:40:09 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>

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 21c Server

To configure autostart of Oracle Database 21c on Rocky 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: Sat Jul 23 23:35:24 PKT 2022 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

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 Sat 2022-07-23 23:44:20 PKT; 42s ago
  Process: 4021 ExecStart=/u01/app/oracle/product/21.3.0/dbhome_1/bin/dbstart />
    Tasks: 62 (limit: 12216)
   Memory: 1.1G
   CGroup: /system.slice/dbora.service
           ├─4136 ora_pmon_cdb1
           ├─4140 ora_clmn_cdb1
           ├─4144 ora_psp0_cdb1
           ├─4148 ora_vktm_cdb1
           ├─4154 ora_gen0_cdb1
           ├─4158 ora_mman_cdb1
           ├─4164 ora_gen1_cdb1
           ├─4166 ora_gen2_cdb1
           ├─4168 ora_vosd_cdb1
           ├─4173 ora_diag_cdb1
           ├─4177 ora_ofsd_cdb1
           ├─4179 ora_dbrm_cdb1
           ├─4182 ora_vkrm_cdb1
           ├─4186 ora_svcb_cdb1
           ├─4188 ora_pman_cdb1
           ├─4190 ora_dia0_cdb1

Read Also:
Install Oracle Database 21c XE on Rocky Linux 8
Install Oracle Database 21c on RHEL 8

Final Thoughts

Thank you for following our guide on how to install Oracle 21c on Rocky Linux 8. We hope this tutorial has been helpful in setting up your Oracle database. If you need further assistance or customized support, please visit my Fiverr page here.

Exit mobile version