5 Installing Oracle Database XE

You can install Oracle Database Express Edition using RPM packages.

An RPM-based installation performs preinstallation checks, extracts the database software, reassigns ownership of the extracted software to the preconfigured user and groups, maintains the Oracle inventory, and executes all root operations required to configure the Oracle Database software for a single-instance Oracle Database creation and configuration.

The RPM–based installation process detects when the minimum requirements for an installation are not met and prompts you to finish these minimum preinstallation requirements.

This section covers the following topics:

Installing Oracle Database XE Using RPM Packages

Perform the following steps to install and configure Oracle Database XE using RPM packages.

Before attempting to install Oracle Database XE 21c, uninstall any existing Oracle Database XE or database with the SID XE from the target system.

An Oracle Database XE installation will consume around 9 gigabytes of disk space under /opt. If this disk partition does not have the required disk space available, you must add space or mount an alternative partition as /opt/oracle. This disk partition is the defined Oracle Base where the software and database will reside.

Note:

The Oracle Database XE installation does not support usage of symbolic links (symlink) for that disk.

Installing Oracle Database XE RPM

  1. Use sudo to log in as root.

    $ sudo -s
  2. Run the Oracle Database Preinstallation RPM

    1. For Oracle Linux, the Database Preinstallation RPM is pulled automatically.

      For Oracle Linux 8:

      # dnf -y install oracle-database-preinstall-21c

      For Oracle Linux 7:

      # yum -y install oracle-database-preinstall-21c
    2. For Red Hat Enterprise Linux distributions, download and install the Oracle Database Preinstallation RPM using the following commands:

      For Red Hat Enterprise Linux 7

      # curl -o oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm
      # yum -y localinstall oracle-database-preinstall-21c-1.0-1.el7.x86_64.rpm

      For Red Hat Enterprise Linux 8:

      # curl -o oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
      # dnf -y localinstall oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm

      Note:

      • The Oracle Database Preinstallation RPM automatically creates Oracle installation owner and groups. It also sets up other kernel configuration settings required for Oracle installations. If you plan to use job-role separation, then create the extended set of database users and groups depending on your requirements.
      • Use the -y option if you want yum to skip the package confirmation prompt.
      • The yum command that is provided with Oracle Linux 8 is a symbolic link to the dnf command. The yum and dnf commands are completely interchangeable. However, the dnf command provides significant improvements in functionality and performance when compared to the yum command.
      • See, About DNF for more information about the dnf command.
  3. Access the Oracle XE software download page:

    https://www.oracle.com/database/technologies/xe-downloads.html

  4. Download an appropriate rpm file required for performing an RPM-based installation to a directory of your choice:
    • For Oracle Linux 7: oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm
    • For Oracle Linux 8: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
  5. Install the database software.
    • For Oracle Linux 7:

      # yum -y localinstall oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm
    • For Oracle Linux 8:

      # dnf -y localinstall oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm

Note:

Check the RPM log file to review the system configuration changes. For example, review this file for latest changes: /var/log/oracle-database-preinstall-21c/results/orakernel.log.

The installation of Oracle Database software is now complete.

Creating and Configuring an Oracle Database

The configuration script creates a container database (XE) with one pluggable database (XEPDB1) and configures the listener at the default port (1521) and Enterprise Manager Express on port 5500.

You can modify the configuration parameters by editing the /etc/sysconfig/oracle—xe–21c.conf file.

The parameters set in this file are explained in more details in the silent mode installation procedure: Performing a Silent Installation.

To create the Oracle XE database with the default settings, perform the following steps:

  1. Execute as user root using sudo.

    $ sudo -s
  2. Run the service configuration script:

    # /etc/init.d/oracle-xe-21c configure

    At the prompt, specify a password for the SYS, SYSTEM, and PDBADMIN administrative user accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].

    See Also:

    The same password will be used for these accounts. The password should conform to the Oracle recommended standards. See Oracle Database Security Guide for more information about guidelines for securing passwords

    After the configuration completes, the database and listener are started.

Configuration, Database Files and Logs Location

Table 5-1 Configuration, Database Files and Logs Location

File Name and Location Purpose

/opt/oracle

Oracle Base. This is the root of the Oracle Database XE directory tree.

/opt/oracle/product/21c/dbhomeXE

Oracle Home. This home is where the Oracle Database XE is installed. It contains the directories of the Oracle Database XE executables and network files.

/opt/oracle/oradata/XE

Database files.

/opt/oracle/diag subdirectories

Diagnostic logs. The database alert log is /opt/oracle/diag/rdbms/xe/XE/trace/alert_XE.log

/opt/oracle/cfgtoollogs/dbca/XE

Database creation logs. The XE.log file contains the results of the database creation script execution.

/etc/sysconfig/oracle-xe-21c.conf

Configuration default parameters.

/etc/init.d/oracle-xe—21c

Configuration and services script.

Note:

If a host does not have any IP address other than loop back address assigned (typically in a docker or in an another container environment), Oracle Net Configuration Assistant (Oracle NETCA) may fail during the installation with the error No valid IP Address returned for the host hostname in the netca trace log. Please assign an IP address and retry the installation.

Performing a Silent Installation

You can install Oracle Express Edition using the silent mode. This mode can be used for embedded install of XE (with your application) or unattended operation.

To perform a silent installation, a password for the administrative accounts must be provided as a parameter to the script, or specified in the configuration file.

  1. Create a wrapper shell script to perform the silent installation.

    It should contain commands similar to the following:

    For Oracle Linux 7:

    #!/bin/bash
     
    yum -y localinstall /downloads/oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm > /xe_logs/XEsilentinstall.log 2>&1
    
    /etc/init.d/oracle-xe-21c configure >> /xe_logs/XEsilentinstall.log 2>&1
    

    For Oracle Linux 8

    #!/bin/bash
     
    yum -y localinstall /downloads/oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm > /xe_logs/XEsilentinstall.log 2>&1
    
    /etc/init.d/oracle-xe-21c configure >> /xe_logs/XEsilentinstall.log 2>&1
    

    Alternatively, you can pass on the password in the script, such as:

    (echo "password"; echo "password";) | /etc/init.d/oracle-xe-21c configure >> /xe_logs/XEsilentinstall.log 2>&1

    Replace password with a password that is secure. The password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].

  2. Make the wrapper script executable.

    chmod +x myscript.sh
  3. Run as root using sudo.
    sudo ./myscript.sh

    XE Oracle Home is /opt/oracle/product/21c/dbhomeXE .

    For details of the installation, review the /xe_logs/XEsilentinstall.log file.

The XE database is configured with default settings. It is not necessary to modify these parameters unless you have specific requirements. Make a copy of the configuration file /etc/sysconfig/oracle-xe-21c.conf before modifying it. Make your modifications after the RPM install and before configuring the database.

The provided configuration file /etc/sysconfig/oracle-xe-21c.conf sets the following:

  • LISTENER_PORT: A valid listener numeric port value for the database listener. Do not specify for automatic port assignment.

  • EM_EXPRESS_PORT: A valid port numeric value for Oracle Enterprise Manager (EM) Express listener. This is set to port 5500.

  • CHARSET: Character set of the database. This is set to AL32UTF8.

  • DBFILE_DEST Database file directory. By default, the database files are stored in the Oracle Base /opt/oracle/oradata subdirectory. You can also create your own database file directory. However, the permissions for this file path should be owned by oracle user.

  • SKIP_VALIDATIONS: Skip validation for memory and disk space. Default: false.

Caution:

When you modify and save a file containing plain text password, ownership of the file should be given to the Oracle software installation owner only, and permissions on the file should be changed to 600. Oracle strongly recommends that database administrators or other administrators delete or secure such files containing plain text passwords when they are not in use.

Note:

The password should conform to the Oracle recommended standards. See Oracle Database Security Guide for more information about guidelines for securing passwords

You can find the database creation logs under the Oracle Base /opt/oracle/cfgtoollogs/dbca/ subdirectory.

See Also:

Configuration, Database Files and Logs Location for a summary of important files and their locations

Setting the Oracle Database XE Environment Variables

After you have installed and configured Oracle Database XE, you must set the environment before using Oracle Database XE.

The oraenv and coraenv scripts can be used to set your environment variables. 

For example, to set your environment variables in Bourne, Bash, or Korn shell without being prompted by the script:

$ export ORACLE_SID=XE 
$ export ORAENV_ASK=NO 
$ . /opt/oracle/product/21c/dbhomeXE/bin/oraenv

ORACLE_HOME = [] ? /opt/oracle/product/21c/dbhomeXE
The Oracle base has been set to /opt/oracle
For C shell:
$ setenv ORACLE_SID XE
$ setenv ORACLEENV_ASK NO
$ source /opt/oracle/product/21c/dbhomeXE/bin/coraenv

See Oracle Database Administrator's Reference for Linux and UNIX-Based Operating Systems for more information about setting a common environment.