This guide provides a complete setup for installing and configuring Oracle Database 21c Express Edition (XE) on Oracle Linux 8 using Vagrant. It includes database installation, verification, listener configuration, remote access setup, and troubleshooting steps.
Note
If you have questions, issues, or suggestions related to this setup, feel free to start a discussion or open an issue in this repository.
-
Download the required RPMs and place them in the same folder as your
Vagrantfile:
Launch the VM:
vagrant up
vagrant ssh- Username:
system - Password:
Oracle123
-
SSH into the VM and switch to the
oracleuser:vagrant ssh sudo su - oracle
-
Start SQL*Plus:
sqlplus
-
Login:
Enter user-name: system Enter password: Oracle123 -
Run a test query:
SELECT 'Hello, Oracle!' AS test_message FROM dual;
Expected output:
TEST_MESSAGE -------------- Hello, Oracle!
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
This error indicates that the service (e.g., XE) is not registered with the Oracle listener.
-
Switch to the Oracle user:
vagrant ssh sudo su - oracle
-
Login as SYSDBA:
sqlplus / as sysdba
-
Check database status:
SELECT status FROM v$instance;
If the result is not
OPEN, start the database:STARTUP;
-
Register the service:
ALTER SYSTEM REGISTER;
-
Verify listener status:
Exit SQL*Plus:
exitThen run:
lsnrctl status
Look for:
Service "XE" has 1 instance(s). Instance "XE", status READY, has 1 handler(s) for this service...
Caution
This section is intended for advanced users. Modifying Oracle listener and network configurations without understanding the implications can result in service unavailability or connectivity issues. Only proceed if you understand what you're doing.
| File | Purpose | Location |
|---|---|---|
listener.ora |
Listener config | /opt/oracle/homes/OraDBHome21cXE/network/admin/listener.ora |
tnsnames.ora |
Client config | ~/.oracle/network/admin/tnsnames.ora or /etc/tnsnames.ora |
Edit the file:
sudo vi /opt/oracle/homes/OraDBHome21cXE/network/admin/listener.oraUpdate contents to:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = XERestart the listener:
lsnrctl stop
lsnrctl start
lsnrctl statusEnsure XE service appears in the output.
On the client machine (or host system), create or edit tnsnames.ora:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.38)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = XE)
)
)Replace 192.168.56.38 with the actual IP address of the Oracle VM.
From a system with Oracle tools installed:
sqlplus system/Oracle123@XEOr connect directly using the full descriptor:
sqlplus system/Oracle123@//192.168.56.38:1521/XE- Vagrant Documentation:
- Oracle XE 21c Documentation: