Installing and Creating An Oracle Database 19c On Linux 7
Installing and Creating An Oracle Database 19c On Linux 7
Tutorial:
By Ahmed Baraka
Tutorial Overview
In this tutorial, you will install and create an Oracle database 19c on Linux 7 on a virtual machine. It
will be a CDB database, without Oracle Restart services.
Required Resources
• A PC with a free 8GB in its memory. This means the RAM memory in your PC should be at least
12GB.
Database Specifications
The tutorial aims at creating a database with the following high level specifications:
SID oradb
Home /u01/app/oracle/product/19.0.0/db_1
Release 19c
Version 19.3
CDB/non-CDB CDB
OS Linux 7.8
Hostname srv1
• Oracle VirtualBox, version 6. This tutorial was implemented on VirtualBox 6.0.22 for Windows. It
can be obtained from the following link.
• Oracle Virtualbox appliance with a fresh installation of Oracle Linux 7.x. You can download a
pre-built one with Oracle Linux 7.8 from here.
Alternatively, you can create one from scratch. The procedure to create an VM machine with Linux
7.x is explained in many articles in the Internet. Just Google it!
• Oracle Database 19c installation files for Linux x86-64. This can be downloaded from Oracle site.
Search the Internet for “Oracle Database 19c installation files for Linux x86-64”. At the time of this
writing, its link is here. This tutorial was implemented using Oracle Database 19c (version 19.3) for
Linux x86-64.
• Putty: which is a utility that provides a command line prompt to connect to a Linux server from
Windows.
Tutorial Steps
1. In VirtualBox Manager, open the "Settings" of srv1, click on "Shared Folders" link in the right-
hand pane. Add shared folder by pressing "plus" icon. Then select path to the location of the
oracle software installation folder, and mark the checkbox "Auto-mount". You can change the
"Folder Name", if you want to.
This folder will be used to easily exchange files between the hosting PC and Linux in the VM
machine. In the rest of this tutorial document, this folder will be referred to as the staging
folder.
2. Make sure the Network adapter type Bridged Adapter and its name is the same as the network
card of your PC. This makes your VM appliance appears in your network as a separate host and
will be assigned an IP address based on your network configuration.
3. Optionally, set a description for the appliance and change its name to “Oracle 19c DB”
4. Start srv1
6. Open a terminal window, issue ifconfig command, and obtain the current IP address assigned to
the machine. It is the IP address assigned to the NIC enp0s3
9. Click on IPv4 tab, select the Manual option, then enter the IP address and DNS information.
Then click on Apply button.
10. In the Terminal window, ping the IP address to make sure that the changes are successful.
11. Edit the /etc/hosts file and add the hostname and the IP address to it.
vi /etc/hosts
192.168.1.127 srv1.localdomain srv1
12. Verify that the changes are registered in the NIC configuration file.
cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
14. In the hosting PC, open a command line window and make sure you can ping the IP address of
srv1.
Note: Make sure the firewall in your PC allows communication with Oracle VirtualBox.
C:\> ping 192.168.1.127
C. Configuring Putty
In the following steps, you will configure Putty to connect to srv1
15. Open Putty then enter the IP address of srv1 in the Host Name field.
19. In the Putty session, make sure the current user is root then add oracle account to vboxsf
group.
The vboxsf group was created by VirtualBox Guest Additions and it allows its members to access
the shared folder (staging folder) in the hosting machine. In a production real life machine, you
may not need to implement this step.
usermod -a -G vboxsf oracle
20. Switch the current user to oracle and make a backup copy of its bash profile file:
su - oracle
mv ~/.bash_profile ~/.bash_profile_bkp
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/.local/bin:$HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/local/bin
PATH=.:${PATH}:$ORACLE_HOME/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
23. As root, run the following code to create the groups and directories required by Oracle software.
su –
groupadd oinstall
usermod -g oinstall oracle
mkdir -p /u01/app/oracle/product/19.0.0/db_1
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /u01/app/oraInventory
In the following step, you will change the kernel parameter values to the values recommended by
Oracle.
25. Create the following file then add the code that follows to it.
vi /etc/sysctl.d/97-oracle-database-sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
In the following steps, you will install further packages in srv1 that are required by Oracle database
software.
29. Run the following code to install further packages required by Oracle software.
yum install ksh
yum install libaio-devel.x86_64
In the following steps, you will install Oracle database software in srv1 and create the database.
30. Copy the Oracle database software installation file to the staging folder.
At the time of this writing, the installation file name downloaded from Oracle site is
LINUX.X64_193000_db_home.zip
31. In the Putty session, change the current user to oracle then extract the installation file into the
Oracle database software home directory
su - oracle
unzip /media/sf_staging/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME >/dev/null
33. Open a terminal window, change the current directory to the Oracle database home directory and
run the gridSetup.sh script.
cd $ORACLE_HOME
./runInstaller
Window Action
“Server Class”
“Enterprise Edition”
Operating System Select the “oinstall” group for all the options, except the
Groups OSOPER keep it blank.
Root Script Execution Mark the checkbox “Automatically run configuration scripts”
and enter the root password
Install Product When the installation reaches to nearly 12%, if will display a
confirmation message. Click on Yes button.
35. After the installation and database creation are finished, verify the database is up and running by
logging to it as sysdba
sqlplus / as sysdba
37. In the VirtualBox window of srv1, start the Firefox browser and open the EM Express using the
following URL. Accept the warning displayed by the browser. Enter the sys username, its
password, leave the container name blank then click on Login button.
https://srv1:5500/em
Note: You may consider creating and deploying a script that automatically starts up the database
when the machine is rebooted.
oradb:/u01/app/oracle/product/19.0.0/db_1:Y
4. Create the file /etc/init.d/dbora and add the following code in it:
vi /etc/init.d/dbora
#! /bin/sh
# description: Oracle auto start-stop script.
ORA_HOME=/u01/app/oracle/product/19.0.0/db_1
ORA_OWNER=oracle
case "$1" in
'start')
# Start the Oracle databases:
# Remove "&" if you don't want startup as a background process.
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" &
touch /var/lock/subsys/dbora
;;
'stop')
# Stop the Oracle databases:
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" &
rm -f /var/lock/subsys/dbora
;;
esac
5. Change the group of the dbora file to oinstall, and set its permissions to 750
chgrp oinstall /etc/init.d/dbora
chmod 750 /etc/init.d/dbora
6. Create symbolic links to the dbora script in the appropriate run-level script directories
ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora
7. Restart srv1 and wait for a few minutes to allow the database to automatically start up.
8. Login as oracle to srv1 and verify that the database has automatically started.
ps -ef | grep pmon
sqlplus / as sysdba
Summary
• In high level, the procedure to install and create an Oracle database 19c database (without
Oracle Restart) goes through the following stages:
o Set up the environment variables for the oracle OS account
o Change the kernel parameter values to the recommended values
o Install the missing packages required by Oracle software
o Install Oracle database software and create the database
Note: The appliance created by me in this tutorial can be downloaded from the following link:
http://www.ahmedbaraka.com/public/download/