Reputation: 65
Installation
DB Version: Oracle 18c XE
on Ubuntu 18.04 Server running inside Virtual Machine Manager
Problem
After Installation of Oracle XE 18c I log on as user oracle and start the listener
lsnrctl start
When I try to connect there are the following problems:
A. Using:
sqlplus / as sysdba
=>
ERROR:
ORA-12547: TNS:lost contact
B. Using:
sqlplus oracle@ubu-srv as sysdba
=>
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Check Listener:
lsnrctl status
=>
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 28-MAR-2020 22:05:40
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ubu-srv)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 18.0.0.0.0 - Production
Start Date 28-MAR-2020 21:28:33
Uptime 0 days 0 hr. 37 min. 6 sec
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/ubu-srv/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ubu-srv)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
Content of listener.ora:
# listener.ora Network Configuration File: /opt/oracle/product/18c/dbhomeXE/network/admin/listener.ora
# Generated by Oracle configuration tools.
DEFAULT_SERVICE_LISTENER = XE
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ubu-srv)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
Content of tnsnames.ora:
# tnsnames.ora Network Configuration File: /opt/oracle/product/18c/dbhomeXE/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = ubu-srv)(PORT = 1521))
Upvotes: 2
Views: 1401
Reputation: 7043
It doesn't appear that the database is running, or if it is that it has registered with the network listener. If the database was running, you should see several services listed when you run "lsnrctl status", like this:
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
You shouldn't need the listener running at all for your Option A, connecting from the same host, but you will need to set the ORACLE_SID environment variable to match the SID of the database (Container or Pluggable DB) that you want to connect to. To connect to the container DB, as to manually start all database services, you would do this:
export ORACLE_SID=XE
sqlplus / as sysdba
For option B, connecting over the network, your connect string also appears malformed; it should usually include a service name (minimum) in addition to the hostname. See here for examples: https://docs.oracle.com/en/database/oracle/oracle-database/18/sqpug/starting-SQL-Plus.html#GUID-A33231E7-9180-4544-A055-411209FD0363
sqlplus username@[//]host[:port][/service_name]
sqlplus pdb_admin@ubu-srv:1521/xepdb1
That said, Oracle isn't certified with Ubuntu Linux, so results are not guaranteed. You should be running this on CentOS, Red Hat, or Oracle Linux. The full list of supported Linux versions is here: https://docs.oracle.com/en/database/oracle/oracle-database/18/ladbi/operating-system-checklist-for-oracle-database-installation-on-linux.html#GUID-E5C0A90E-7750-45D9-A8BC-C7319ED934F0
Upvotes: 2