DEV Community

Udara Dananjaya
Udara Dananjaya

Posted on

Setting Up Oracle Database 19c on CentOS 7 in an AWS EC2 Instance

Oracle Database 19c is the long-term release packed with powerful features, ensuring high availability, scalability, and performance for enterprise-grade workloads. In this guide, we’ll walk through setting up Oracle Database 19c on CentOS 7 hosted on an AWS EC2 instance, detailing each step to help even a beginner execute it confidently.


Why Use Oracle Database 19c?

Oracle Database 19c offers:

  • Long-term support: Continuous bug fixes and security updates until 2027.
  • Autonomous management capabilities: Automated tuning, backup, and recovery.
  • High availability and disaster recovery features: Multitenancy, Real Application Clusters (RAC), and Data Guard.

Prerequisites

Before we dive in, ensure the following are in place:

  1. AWS EC2 Instance:
    • CentOS 7 is installed and running.
    • At least 8 GB of RAM and 50 GB of disk space.
  2. IAM Role or SSH Access: Ensure administrative (sudo) access to the server.
  3. Network Configuration: Open port 1521 for Oracle Database.

Step 1: Update the System

Updating your system ensures you have the latest software and security patches. Run:

sudo yum update -y  
sudo yum install wget -y  
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Required Packages

Oracle requires several system libraries and utilities. Install them as follows:

sudo yum install -y bind-utils compat-libcap1 glibc-devel ksh libaio-devel libstdc++-devel net-tools nfs-utils psmisc smartmontools sysstat unzip xorg-x11-utils xorg-x11-xauth  
Enter fullscreen mode Exit fullscreen mode

These packages are essential for the Oracle Database runtime environment.


Step 3: Add the Oracle RPM Key

To ensure the authenticity of Oracle’s RPM packages, import their GPG key:

sudo rpm --import http://yum.oracle.com/RPM-GPG-KEY-oracle-ol7  
Enter fullscreen mode Exit fullscreen mode

Step 4: Install the Pre-requisites for Oracle Database

Oracle provides a pre-installation RPM that configures the system with required settings and packages. Download and install it using:

wget -O oracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm  
sudo rpm -ivh oracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm  
Enter fullscreen mode Exit fullscreen mode

This script configures kernel parameters, limits, and other system prerequisites automatically.


Step 5: Download and Install Oracle Database 19c

Download the Oracle Database RPM package. Note that you'll need an Oracle account to access the download URL:

wget -O oracle-database-ee-19c-1.0-1.x86_64.rpm "https://download.oracle.com/otn/linux/oracle19c/190000/oracle-database-ee-19c-1.0-1.x86_64.rpm?AuthParam=1736365242_b5e2dde43253dfab3ed2c0dfbe8ca3ff"  
Enter fullscreen mode Exit fullscreen mode

Install the RPM:

sudo rpm -ivh oracle-database-ee-19c-1.0-1.x86_64.rpm  
Enter fullscreen mode Exit fullscreen mode

Step 6: Configure Oracle Database

Run the configuration script to set up Oracle Database with default settings:

sudo /etc/init.d/oracledb_ORCLCDB-19c configure  
Enter fullscreen mode Exit fullscreen mode

This command:

  • Creates the Oracle Home directory.
  • Configures the listener.
  • Creates the default database instance (ORCLCDB).

Step 7: Verify the Installation

Switch to the Oracle user and verify the installation directory:

su - oracle  
ls /opt/oracle/product/19c/dbhome_1  
Enter fullscreen mode Exit fullscreen mode

Set the Oracle environment variables to enable database management:

export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1  
export PATH=$ORACLE_HOME/bin:$PATH  
export ORACLE_SID=ORCLCDB  
Enter fullscreen mode Exit fullscreen mode

Step 8: Secure the SYS and SYSTEM Accounts

Log in to the Oracle database as SYSDBA using SQL*Plus:

sqlplus / as sysdba  
Enter fullscreen mode Exit fullscreen mode

Run the following commands to secure the SYS and SYSTEM accounts with passwords:

ALTER USER SYS IDENTIFIED BY "YourSecurePassword123";  
ALTER USER SYSTEM IDENTIFIED BY "YourSecurePassword123";  
Enter fullscreen mode Exit fullscreen mode

Additional Tips

  1. Access the Database:

    Use tools like SQL Developer to connect to the database remotely. Ensure port 1521 is open in your AWS Security Group.

  2. Monitor Database Health:

    Use Oracle’s built-in tools like Oracle Enterprise Manager to monitor performance.

  3. Backup the Database:

    Implement backup policies using Oracle RMAN (Recovery Manager).


Useful Links


Conclusion

Setting up Oracle Database 19c on CentOS 7 within an AWS EC2 instance ensures a powerful, flexible, and scalable database solution. With proper configuration and security practices, your Oracle instance will be ready for production workloads or development environments.

Found this guide helpful? Share it with your network and explore the power of Oracle Database!

Top comments (0)