How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?
Tags: oracle, setup, install, linux
Published: 2022-09-21 20:51:27

### Step 1:

Create VM using Virtual Box and install on it OS Oracle Enterprise Linux 8 (64-bit)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/juvh6i5iph7cwd2x9hu8.png)

The VM will have 4G RAM, 4 CPUs, 50 GB Storage and network configured.

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1iu51tlgtq9ovuylmh4i.png)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j96dixic5bx2tqy47dyr.png)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzlqmml4yah3h04ht7es.png)

### Step 2:

Download Oracle Linux 8 iso image from Oracle:

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qbvn8gwrxgofyosi4gmy.png)

### Step 3:

Attach downloaded iso image of the OS Oracle Linux 8 to the Storage Devices of the VM:

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/shtlhbntl1nxsd4q0ych.png)

### Step 4:

Start the VM with OS Oracle Linux 8 attached:

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2kw2z317b7f3r4dunbbr.png)

### Step 5:

Install the OS Oracle Linux 8:

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y4jfoxow352deepbg6i.png)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhkvc5u0b4uyf7xjxj28.png)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kg2kvdrp12pas67q4rh4.png)

Downloading and installing the packages will take some time.

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/15hj738xf0nnpj0wmxt5.png)

After installation reboot the system.

Accept the license.

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4921slhcppxuspbip91.png)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kx5max6cn0og4irmxpt.png)

### Step 6:

Configure Network as following:

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ckcjlxf0bd8t8bimjjmw.png)

Check connectivity to the created Oracle Enterprise Linux 8 machine using MobaXterm (or any other terminal application):

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4p8gn6loubcev8ou1brm.png)

### Step 7:

Set hostname of this machine:

```
oracle.labs.local
```

Set hostname of this machine:

```
hostnamectl set-hostname oracle.labs.local
```
Reboot the machine:

```
init 6
```
Ensure after reboot hostname set as expected.

```
[root@localhost ~]# hostnamectl

Static hostname: oracle.labs.local

Icon name: computer-vm

Chassis: vm

Machine ID: 3ec96794e1e54278b9dc7a2bf3d21777

Boot ID: 608f7fdb165c464fb47e2c409bb05c68

Virtualization: oracle

Operating System: Oracle Linux Server 8.3

CPE OS Name: cpe:/o:oracle:linux:8:3:server

Kernel: Linux 5.4.17-2011.7.4.el8uek.x86_64

Architecture: x86-64

[root@localhost ~]#

[root@oracle ~]# hostname

oracle.labs.local

[root@oracle ~]#

[root@oracle ~]# cat /etc/hostname

oracle.labs.local

[root@oracle ~]#
```

### Step 8:

Edit /etc/hosts file as following:

```
[root@oracle ~]# cat /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.0.55 oracle.labs.local oracle

192.168.0.254 infra.labs.local

[root@oracle ~]#
```

**oracle.labs.local** is the hostname of the Oracle Server we’re installing.

**infra.labs.local** is the hostname of another server where Kerberos Server is installed. This entry is necessary for further implementation of Kerberos based authentication for this Oracle DB Server.

### Step 9:

Use oracle-database-preinstall-19c package to perform all prerequisite setup for Oracle DB Server 19c.

```
dnf install -y oracle-database-preinstall-19c
```

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uzpoiwqrsj1deylbf4zf.png)

### Step 10:

It’s best practice to perform a full update as well.

```
yum update –y
```

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yzevhhap44rjeybqrtow.png)

The update will take some time.

### Step 11:

Setup password for oracle user.

```
[root@oracle ~]# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@oracle ~]#
```

### Step 12:

In the file /etc/selinux/config set SELINUX=disabled

```
[root@oracle ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
```

Reboot the system

### Step 13:

Disable Linux firewall:

```
[root@oracle ~]# systemctl stop firewalld
[root@oracle ~]# systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@oracle ~]#
```

### Step 14:

Create important directories in which Oracle DB software will be installed.

```
[root@oracle ~]# mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
[root@oracle ~]# mkdir -p /u02/oradata
[root@oracle ~]# chown -R oracle:oinstall /u01 /u02
[root@oracle ~]# chmod -R 775 /u01 /u02
[root@oracle ~]#
```

### Step 15:

Create a “scripts” directory

```
[root@oracle ~]# mkdir /home/oracle/scripts
[root@oracle ~]#
```

### Step 16:

Create setEnv.sh script.

```
[root@oracle ~]# cat /home/oracle/scripts/setEnv.sh
# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=oracle.labs.local
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cdb1
export PDB_NAME=pdb1
export DATA_DIR=/u02/oradata
export PATH=/usr/sbin:/usr/local/bin:$PATH
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
[root@oracle ~]#
```

### Step 17:

Add a reference to the setEnv.sh file at the end of the **/home/oracle/.bash_profile**

```
[root@oracle ~]# echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
[root@oracle ~]#
```

### Step 18:

Create start_all.sh and stop_all.sh scripts that can be called from a startup/shutdown service. Make sure the ownership and permissions are correct.

```
[root@oracle ~]# cat /home/oracle/scripts/start_all.sh
#!/bin/bash
. /home/oracle/scripts/setEnv.sh

export ORAENV_ASK=NO
. oraenv

export ORAENV_ASK=YES

dbstart $ORACLE_HOME

[root@oracle ~]

[root@oracle ~]# cat /home/oracle/scripts/stop_all.sh
#!/bin/bash
. /home/oracle/scripts/setEnv.sh
export ORAENV_ASK=NO
. oraenv

export ORAENV_ASK=YES
dbshut $ORACLE_HOME
[root@oracle ~]#

[root@oracle ~]# chown -R oracle:oinstall /home/oracle/scripts
[root@oracle ~]# chmod u+x /home/oracle/scripts/*.sh
[root@oracle ~]#
```

These scripts will allow us to create Linux service to automatically start/stop the database.

Now we can install Oracle DB Software.

### Step 19:

Login to the created Linux machine as an **oracle** user and create directory to place Oracle DB installation files.

```
[root@oracle ~]# su - oracle
[oracle@oracle ~]$ mkdir ora_software
[oracle@oracle ~]$ pwd
/home/oracle
[oracle@oracle ~]$
```

### Step 20:

Download Oracle DB Software from Oracle Support site and place them on the Linux server we have just installed.

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dplipd5uw4cvqq93hmrv.png)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63mfjrnqh3vbozxi3epp.png)

### Step 21:

Unzip software.

```
[oracle@oracle ora_software]$ cd $ORACLE_HOME
[oracle@oracle dbhome_1]$ unzip -oq /home/oracle/ora_software/LINUX.X64_193000_db_home.zip
The unzip activity will take some time.
```

### Step 22:

The following export command required to fake Oracle Linux 7.

```
[oracle@oracle dbhome_1]$ export CV_ASSUME_DISTID=OEL7.6
[oracle@oracle dbhome_1]$
```

### Step 23:

Installation of Oracle DB Software can run in interactive or in silent mode.

To run interactive mode:

```
./runInstaller
```

In this guide we will run installer in silent mode.

```
./runInstaller -ignorePrereq -waitforcompletion -silent \
-responseFile ${ORACLE_HOME}/install/response/db_install.rsp \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOSTNAME=${ORACLE_HOSTNAME} \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=${ORA_INVENTORY} \
SELECTED_LANGUAGES=en,en_GB \
ORACLE_HOME=${ORACLE_HOME} \
ORACLE_BASE=${ORACLE_BASE} \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSBACKUPDBA_GROUP=dba \
oracle.install.db.OSDGDBA_GROUP=dba \
oracle.install.db.OSKMDBA_GROUP=dba \
oracle.install.db.OSRACDBA_GROUP=dba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true
```

The installation will take some time.

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bqpwmbhkm5ca393uwm1.png)

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1oevjdt2f7ljolpakap0.png)

### Step 24:

As suggested by installer, login as a root user and run the following:

```
[oracle@oracle dbhome_1]$ su -
Password:
[root@oracle ~]# /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.

[root@oracle ~]# /u01/app/oracle/product/19.0.0/dbhome_1/root.sh
Check /u01/app/oracle/product/19.0.0/dbhome_1/install/root_oracle.labs.local_2021-03-27_02-34-02-102394345.log for the output of root script
[root@oracle ~]#
```

Now Oracle Software is installed.

And we’re ready to create an Oracle Database.

### Step 25:

Before creating DB we should start Oracle listener:

```
[oracle@oracle ~]$ lsnrctl start
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 27-MAR-2021 02:37:46
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Starting /u01/app/oracle/product/19.0.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle.labs.local)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 27-MAR-2021 02:37:46
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/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle.labs.local)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@oracle ~]$
```

### Step 26:

Database can be created using the Database Configuration Assistance (DBCA). It can be done in interactive mode or in a silent mode.

To create database in interactive mode it can be run command:

```
dbca
```

In this guide we will use DB creation in silent mode approach.

```
dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE \
-characterSet AL32UTF8 \
-sysPassword SysPassword1 \
-systemPassword SysPassword1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName ${PDB_NAME} \
-pdbAdminPassword PdbPassword1 \
-databaseType MULTIPURPOSE \
-memoryMgmtType auto_sga \
-totalMemory 2000 \
-storageType FS \
-datafileDestination "${DATA_DIR}" \
-redoLogFileSize 50 \
-emConfiguration NONE \
-ignorePreReqs
```

This activity will take some time.

![How to setup Oracle 19c DB on OS Oracle Enterprise Linux 8?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k02pftsw1e0bajf3ayfv.png)

The progress will look like:

```
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
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.
[oracle@oracle ~]$
```

### Step 27:

```
Edit /etc/oratab file as following:
[oracle@oracle ~]$ cat /etc/oratab
cdb1:/u01/app/oracle/product/19.0.0/db_1:Y
[oracle@oracle ~]$
```

### Step 28:

Enable Oracle Managed Files (OMF) and make sure the PDB starts when the instance starts.

```
[oracle@oracle ~]$ sqlplus / as sysdba <<EOF
alter system set db_create_file_dest='${DATA_DIR}';
alter pluggable database ${PDB_NAME} save state;
exit;
EOF
```

### Step 29:

Connect to the Oracle DB:

```
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 27 03:01:33 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL>
```