I have configured oracle 12c on Rhel 7. When I try to connect database using following command it gets connected with no issues:
sqlplus system/Forest123@orcl
I'm facing problem when I try to put the connection string with hostname
and port
as shown below:
sqlplus system/Forest123@localhost:1521/orcl
Error occurred is
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I have gone through the questions asked before, but none of them helped me solve this problem.
Following are my tnsnames.ora
, sqlnet.ora
and listener.ora
files.
tnsnames.ora
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle_12C.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.localdomain)
)
)
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle_12C.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
hosts file
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
127.0.0.1 localhost4
127.0.0.1 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
::127.0.0.1 localhost.localdomain localhost
172.31.15.86 oracle_12C.localdomain oracle_12C
$lsnrctl status listener
.hostname
andport
in the connection string?sqlplus system/Forest123@localhost:1521/orcl.localdomain
work? Your service name is usually suffixed by your domain. Your tnsnames.ora entry connects to orcl.localdomain.