Latest

Wednesday, 29 June 2022

Install Oracle Database 21c XE on Rocky Linux 8

Install Oracle Database 21c XE on Rocky Linux 8

In this article, you will learn how to install Oracle Database 21c XE on Rocky Linux or other RPM based Linux distros.

 

Table of Contents:

 

What is Oracle Database XE? :

Oracle Database (commonly referred to as Oracle DBMS, Oracle Autonomous Database, or simply as Oracle) is a multi-model database management system produced and marketed by Oracle Corporation. (Source: Wikipedia)

It is a database commonly used for running online transaction processing (OLTP), data warehousing (DW) and mixed (OLTP & DW) database workloads. Oracle Database is available by several service providers on-prem, on-cloud, or as hybrid cloud installation. It may be run on third party servers as well as on Oracle hardware (Exadata on-prem, on Oracle Cloud or at Cloud at Customer).

Express Edition or XE is the stripped down edition of Oracle Database. It is available to use free of cost but with limited features and functionality.

Install Oracle Database 21c XE on Rocky Linux 8

Recommended Online Training: Managing Oracle Cloud Autonomous Databases
Recommended Book: Practical Oracle SQL: Mastering the Full Power of Oracle Database 1st ed. Edition, Kindle Edition

 

Environment Specification:

We are using a minimal Rocky Linux 8 virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Rocky Linux 8.6 (Green Obsidian)
  • Hostname - oraclexe-01.centlinux.com
  • IP Address - 192.168.116.128 /24

 

Updating your Linux Operating System:

By using a SSH client, login to oraclexe-01.centlinux.com as root user.

Refresh yum cache by executing following command.

# dnf makecache
Rocky Linux 8 - AppStream                       1.5 kB/s | 4.8 kB     00:03
Rocky Linux 8 - AppStream                       299 kB/s | 8.5 MB     00:28
Rocky Linux 8 - BaseOS                          1.4 kB/s | 4.3 kB     00:03
Rocky Linux 8 - BaseOS                          354 kB/s | 2.6 MB     00:07
Rocky Linux 8 - Extras                          818  B/s | 3.5 kB     00:04
Rocky Linux 8 - Extras                          3.2 kB/s |  11 kB     00:03
Metadata cache created.

Execute following dnf command to update your Linux operating system.

# dnf update -y

If the above command updates your Linux Kernel, then reboot your operating system with newly installed Kernel.

# reboot

Verify the versions of your Linux Kernel and operating system.

# uname -r
4.18.0-372.9.1.el8.x86_64

# cat /etc/rocky-release
Rocky Linux release 8.6 (Green Obsidian)

 

Configure Local DNS Resolver:

Before installing Oracle Database Software, you must ensure that the Hostname of your Rocky Linux server is resolvable.

For this purpose you can either use an authoritative DNS Server of your Network, or simply configure the Local DNS resolver.

For the sake of simplicity, we are configuring the Local DNS resolver.

# vi /etc/hosts

Add following line in this file.

192.168.116.128 oraclexe-01.centlinux.com oraclexe-01

 

Installing Oracle Database Preinstall 21c:

Oracle provides a Preinstall script for Linux platform to perform most of the pre-installation actions such as creating OS user creation, setting kernel parameters, etc.

Go to link and download Oracle Database Preinstall 21c rpm.

Or you can copy the URL and use it with wget command download Oracle Database Preinstall 21c rpm directly from Linux CLI.

# wget https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
--2022-06-26 18:53:21--  https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm
Resolving yum.oracle.com (yum.oracle.com)... 184.50.21.103, 2600:140f:5:681::2a7d, 2600:140f:5:69b::2a7d
Connecting to yum.oracle.com (yum.oracle.com)|184.50.21.103|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 30772 (30K) [application/x-rpm]
Saving to: ‘oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm’

oracle-database-pre 100%[===================>]  30.05K   185KB/s    in 0.2s

2022-06-26 18:53:22 (185 KB/s) - ‘oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm’ saved [30772/30772]

Now, install Oracle Database Preinstall package.

# dnf localinstall -y oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm

 

Installing Oracle Database Express Edition on Rocky Linux:

Oracle Database Express Edition 21c is available to download at their official website.

You can copy the URL and use it with wget command to directly download Oracle Database 21c Express Edition from Linux CLI.

# wget https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
--2022-06-26 18:59:49--  https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
Resolving download.oracle.com (download.oracle.com)... 184.50.20.89
Connecting to download.oracle.com (download.oracle.com)|184.50.20.89|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm [following]
--2022-06-26 18:59:50--  https://edelivery.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
Resolving edelivery.oracle.com (edelivery.oracle.com)... 104.111.200.35, 2600:140f:5:49b::366, 2600:140f:5:483::366
Connecting to edelivery.oracle.com (edelivery.oracle.com)|104.111.200.35|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm?AuthParam=1656252108_3babad21c38cf83bfef893b4921707a7 [following]
--2022-06-26 18:59:51--  https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm?AuthParam=1656252108_3babad21c38cf83bfef893b4921707a7
Connecting to download.oracle.com (download.oracle.com)|184.50.20.89|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2339651768 (2.2G) [application/x-redhat-package-manager]
Saving to: ‘oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm’

oracle-database-xe- 100%[===================>]   2.18G  1.19MB/s    in 34m 24s

2022-06-26 19:34:16 (1.08 MB/s) - ‘oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm’ saved [2339651768/2339651768]

Now, install Oracle Database XE by using dnf command as follow.

# dnf localinstall -y oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm
Last metadata expiration check: 1:03:11 ago on Sun 26 Jun 2022 06:38:36 PM PKT.
Dependencies resolved.
================================================================================
 Package                      Architecture Version     Repository          Size
================================================================================
Installing:
 oracle-database-xe-21c       x86_64       1.0-1       @commandline       2.2 G

Transaction Summary
================================================================================
Install  1 Package

Total size: 2.2 G
Installed size: 5.8 G
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Running scriptlet: oracle-database-xe-21c-1.0-1.x86_64                    1/1
  Installing       : oracle-database-xe-21c-1.0-1.x86_64                    1/1
  Running scriptlet: oracle-database-xe-21c-1.0-1.x86_64                    1/1
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure Oracle Database XE, optionally modify the parameters in '/etc/sysconfig/oracle-xe-21c.conf' and then execute '/etc/init.d/oracle-xe-21c configure' as root.

  Verifying        : oracle-database-xe-21c-1.0-1.x86_64                    1/1

Installed:
  oracle-database-xe-21c-1.0-1.x86_64

Complete!

After successful installation of Oracle Database software, configure the Oracle Instance by executing following command.

# /etc/init.d/oracle-xe-21c configure
Specify a password to be used for database 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]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database XE.
Enter SYS user password:
********
Enter SYSTEM user password:
***********
Enter PDBADMIN User Password:
*********
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
33% complete
37% complete
40% complete
43% complete
Completing Database Creation
47% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/XE.
Database Information:
Global Database Name:XE
System Identifier(SID):XE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/XE/XE.log" for further details.

Connect to Oracle Database using one of the connect strings:
     Pluggable database: oraclexe-01.centlinux.com/XEPDB1
     Multitenant container database: oraclexe-01.centlinux.com
Use https://localhost:5500/em to access Oracle Enterprise Manager for Oracle Database XE

Enable and start Oracle Database service.

# systemctl enable --now oracle-xe-21c
oracle-xe-21c.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable oracle-xe-21c

 

Configure Linux Firewall:

Allow the Oracle Listener and Oracle EM Express service ports in Linux firewall.

# firewall-cmd --add-port={1521,5500}/tcp --permanent
success
# firewall-cmd --reload
success

 

Configure Oracle Database Environment:

Switch to oracle user.

# su - oracle

Edit .bash_profile by using vim text editor.

$ vi ~/.bash_profile

And add following commands therein.

export ORACLE_HOME=/opt/oracle/product/21c/dbhomeXE
export ORACLE_SID=XE
export PATH=$PATH:/opt/oracle/product/21c/dbhomeXE/bin/

Execute updated .bash_profile to apply changes to current session.

$ source ~/.bash_profile

Now, you can execute Oracle RDBMS commands from Linux CLI.

Execute lsnrctl command to check the status of Oracle Listener.

$ lsnrctl status

LSNRCTL for Linux: Version 21.0.0.0.0 - Production on 27-JUN-2022 22:02:08

Copyright (c) 1991, 2021, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oraclexe-01.centlinux.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 21.0.0.0.0 - Production
Start Date                27-JUN-2022 21:44:50
Uptime                    0 days 0 hr. 17 min. 19 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /opt/oracle/homes/OraDBHome21cXE/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/oraclexe-01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oraclexe-01.centlinux.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=127.0.0.1)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/homes/OraDBHome21cXE/admin/XE/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "e25cd873d1d23143e0538074a8c0e324" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
Service "xepdb1" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully

Now, connect to Oracle Database XE instance by using sqlplus command.

$ sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Mon Jun 27 22:02:33 2022
Version 21.3.0.0.0

Copyright (c) 1982, 2021, Oracle.  All rights reserved.


Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL>

Check the list of Pluggable databases in your XE container database.

SQL> select PDB_NAME from dba_pdbs;

PDB_NAME
--------------------------------------------------------------------------------
XEPDB1
PDB$SEED

Exit from SQL shell.

SQL> exit
Disconnected from Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

 

Configure Oracle EM Express:

Oracle EM Express is a simple database management/monitoring tool integrated with Oracle Database 12c or later.

In Oracle Database 21c, EM Express service by default runs on the local interface. This makes it inaccessible from the network.

Execute following command to verify this.

# ss -tulpn | grep 5500
tcp   LISTEN 0      128        127.0.0.1:5500       0.0.0.0:*    users:(("tnslsnr",pid=1172,fd=18))

To change EM Express to listen on public interface of your Linux server, Connect to Oracle Instance as sys user and execute following command.

SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

PL/SQL procedure successfully completed.

Again check the status of EM Express.

# ss -tulpn | grep 5500
tcp   LISTEN 0      128                *:5500             *:*    users:(("tnslsnr",pid=1172,fd=18))

The EM Express is now running on the public interface of your Rocky Linux server.

To access EM Express, open URL https://192.168.116.128:5500/em in a web browser.

Oracle EM Express Login

After successful login, you will reached at the Dashboard of Oracle EM Express.

Oracle EM Express Dashboard

 

Conclusion:

In this article, you have learned how to install Oracle Database 21c XE on Rocky Linux or other RPM based Linux distros.

No comments:

Post a Comment