6 Connecting to Oracle Database XE

Connecting using SQL*Net

The database listener for your XE database is started with a configuration that can be viewed using the command :

lsnrctl status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.example.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /opt/oracle/product/18c/dbhomeXE/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/dbhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbhost.example.com)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=dbhost.example.com)(PORT=5500))(Security=(my_wallet_directory=/opt/oracle/admin/XE/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "77f81bd10c818208e053410cc40aef5a" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
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 "xepdb1" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully

For example, you can connect to the database from a client computer with SQL*plus using the connect identifier:

sqlplus system@"dbhost.example/XE"

The XE services are defined in the configuration in /opt/oracle/product/18c/dbhomeXE/network/admin/tnsnames.ora file.

Connecting to Oracle Using Easy Connect Naming Method

You can connect to the database using the following Easy Connect strings:
  • Multitenant container database: host[:port]

  • Pluggable database: host[:port]/service_name

    XEPDB1 is the service name defined for the first PDB created by default. If your PDB has another name, you must provide the service name for that PDB.

    Specifying the port is optional when the listener is setup with the default port 1521. You must specify the port if other port number is used.

See Also:

  • 2 Day DBA for more information about the listener and network configuration

Oracle Database Development Guide for more information about connection strategies for database applications