Oracle Database
Oracle database is a relational database management system. It is also called OracleDB, or simply Oracle. It is produced and marketed by Oracle Corporation.
The system is built around a relational database framework in which data objects may be directly accessed by users (or an application front end) through structured query language (SQL). Oracle is a fully scalable relational database architecture and is often used by global enterprises which manage and process data across wide and local area networks. The Oracle database has its own network component to allow communications across networks.
Oracle DB is also known as Oracle RDBMS and, sometimes, simply as Oracle.
In this blog, we will learn the installation of Oracle Database 19c in Amazon Linux 2. You will get different blogs for it, but I have tried to keep this blog as simple as possible. Our server os details.

Requirement of swap space:-
We need swap space as per the total RAM size on the server. The required swap space size is as given below:-
RAM up to 1024MB then swap = 2 times the size of RAM RAM between 2049MB and 8192MB then swap = equal to the size of RAM RAM more than 8192MB then swap size = 0.75 times the size of RAM
I have attached one extra EBS volume to the EC2 instance of size 5 GB for swap space. We will configure swap space first.
Steps to create space:-
First, check extra volume name with lsblk command. Then use fdisk DISK-NAME to create partition.
lsblk
fdisk DISK-NAME

Type n and then press enter.

Type p and press enter.

For Partition number option keep it default and press enter.
For First sector option keep it default and press enter.
For Last sector option keep it default and enter.

Type t to set disk type as swap and then press enter. Type 82 to set this partition as swap and press enter.

Type w to save this change and exit.

Now set up this partition as swap by using mkswap command.
mkswap PARTITION-NAME

Check the UUID of newly created swap partition with blkid command and copy the UUID.
blkid PARTITION-NAME

Open /etc/fstab file with any text editor. Make an entry for the swap partition in that file.
UUID=<COPIED UUID> swap swap defaults 0 0

Close /etc/fstab file after saving it. Activate swap space for use with swapon command. And then run free -h to check swap space.
swapon -a
free -h

Set the server hostname and verify it with hostname command.
hostnamectl set-hostname HOSTNAME
hostname

Make host entry in /etc/hosts file and reboot the server.
echo "<IP ADDRESS> <FULL MACHINE NAME> <MACHINE NAME> " >> /etc/hosts

Once the server is up then login to the server and install all packages given below.
yum install -y binutils.x86_64 \
compat-libcap1.x86_64 gcc.x86_64 \
gcc-c++.x86_64 glibc.i686 \
glibc.x86_64 \
glibc-devel.i686 \
glibc-devel.x86_64 \
ksh \
xorg-x11-server-utils-7.7-20.amzn2.0.2.x86_64 \
1:xorg-x11-xauth-1.0.9-1.amzn2.0.2.x86_64 \
compat-libstdc++-33 \
libaio.i686 libaio.x86_64 \
libaio-devel.i686 \
libaio-devel.x86_64 \
libgcc.i686 libgcc.x86_64 \
libstdc++.i686 \
libstdc++.x86_64 \
libstdc++-devel.i686 \
libstdc++-devel.x86_64 \
libXi.i686 libXi.x86_64 \
libXtst.i686 \
libXtst.x86_64 \
make.x86_64 sysstat.x86_64 \
zip \
unzip
Create oinstall and dba group.
groupadd oinstall
groupadd dba
Create oracle user and add this user in oinstall and dba groups.
useradd -g oinstall -G dba oracle
Set password for oracle user.
passwd oracle
Add the following kernel parameters to /etc/sysctl.conf file at end of the file.
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 8329226240
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 = 1048586
Apply these changes. And check it with sysctl -p command.
sysctl -a
sysctl -p
Set the limits for oracle in /etc/security/limits.conf file.
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Make directories for oracle installation.
mkdir -p /opt/app/oracle/dbhome
mkdir /opt/oradata
Go to Oracle’s official site and download the Oracle Database 19c zip file.
Link to download the file:- https://www.oracle.com/in/database/technologies/oracle19c-linux-downloads.html
Note: To download this file you need to log in with Oracle account credentials.
Copy the downloaded zip file to /opt/app/oracle/dbhome and unzip it.
cp LINUX.X64_193000_db_home.zip /opt/app/oracle/dbhome
cd /opt/app/oracle/dbhome
unzip LINUX.X64_193000_db_home.zip
Change file ownership and permission.
chown -R oracle:oinstall /opt/app /opt/oradata
chmod -R 775 /opt/app /opt/oradata
Enable password authentication.
Open /etc/ssh/sshd_config file and search for “PasswordAuthentication no”. Change it to “PasswordAuthentication yes” and restart SSH service.
systemctl restart sshd


We need to login to the server with X11 forwarding supported system. If you have linux PC/laptop (Ubuntu, CentOS or RHEL with GUI) then login to the server with oracle user in X11 forwarding mode. As command is given below:-
ssh -Y oracle@IP-Address
Note: If you have a windows laptop/PC then login to the server with oracle user using the X11 forwarding supported application. You can use MobaXterm or another application like Xming and putty together in X11 forwarding mode.
Go to /opt/app/oracle/dbhome directory and run ./runInstaller script.
cd /opt/app/oracle/dbhome
./runInstaller

Step 1: Now Oracle Database setup page will open. Select Create and configure a single instance database option and click Next.

Step 2: In the Select Class page select Server class and click Next.

Step 3: In the Database Edition page, select Enterprise Edition and click Next.

Step 4: In the Installation Location page verify /opt/app/oracle in Oracle base and click Next.

Step 5: In the Create Inventory page, verify /opt/app/oraInventory as Inventory Directory and click Next.

Step 6: In the Configuration Type page, select General Purpose / Transaction Processing and click Next.

Step 7: In the Database Identifiers page, change Global Database Name from orcl.localdomain to orcl and click Next.

Step 8: In the Configuration Options page, keep it as default, and click Next.

Step 9: Keep Database Storage page as default and click Next.

Step 10: Keep Management Options as default and click Next.

Step 11: In the Recovery Options page, Click on Enable Recovery and click Next.

Step 12: In the Schema Passwords page, click on Use the same password for all accounts, type your password and click Next. If you wish you can provide different passwords for SYS, SYSTEM, and PDBADMIN accounts.

Step 13: Keep Operating System Groups as default, and click Next.

Step 14: Keep Root script execution page as default, and click Next.

Step 15: It will check the prerequisite.

Step 16: In the Summary page, verify setup and click on Install.

Step 17: After a few minutes Execute Configuration Scripts pop-up page will open. On this page, two script paths are shown that need to run in the server as the root user.



Now again go back to the installation page and click on OK on Execute Configuration Scripts pop-up page. Now seat back and relax for a few minutes.
Make one scripts directory in /home/oracle after login with oracle user.
mkdir /home/oracle/scripts
Create an environment file called “setEnv.sh”. The “$” characters are escaped using “\”. If you are not creating the file with the cat
command, you will need to remove the escape characters.
cat > /home/oracle/scripts/setEnv.sh <<EOF
#oracle setting
export TMP=/tmp
export TMPDIR=\$TMP
export ORACLE_HOSTNAME=oracle-db.localdomain
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=\$ORACLE_BASE/dbhome
export ORA_INVENTORY=/opt/data/oraInventory
export ORACLE_SID=orcl
export PDB_NAME=pdb1
export DATA_DIR=/opt/data/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
EOF
Add a reference to the “setEnv.sh” file at the end of the “/home/oracle/.bash_profile” file.
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
Run this command to apply these changes.
source /home/oracle/.bash_profile
Check listener status. You can see service status is showing ready.
lsnrctl status

Now time to login to Oracle Database.
sqlplus '/' as sysdba

We can check information about tables using the below command.
select * from tab;
To Login Oracle Database remotely first make sure that either iptables and firewall are disabled or allows Oracle Database port (1521) from it. We can download and use SQL Developer application to connect the database. I am using dbeaver for it.
Link to download SQL Developer https://www.oracle.com/database/sqldeveloper/technologies/download/
Put the server details and credentials. Then click on Test Connection.

Access Oracle Enterprise Manager Database Express
To access Oracle Enterprise Manager Database Express. Go to the browser and search https://IP-Address:5500/em. Login with user credentials.


So we have successfully installed Oracle Database 19c in Amazon Linux 2.
Nice blog for deep study
Hi, as far as I know it is not certified by oracle, isn’t it?
for test purposes only?
for me it is not displaying any graphical display
At which step?
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.