I installed oracle 12c pn windows following the defaults settings… I end up with ORCL and ORCLPDB…
I can connect to ORCLPDB using EZCONNECT via CONN system/password@//localhost:1521/ORCLPDB
. Then I added a service name in my tnsnames.ora like this :
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb)
)
)
But when I try connect system/password@ORCLPDB
I get the following error :
ORA-12154: TNS:could not resolve the connect identifier specified
This is strange because lsnrctl services
has the following entry :
Service "orclpdb" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service…
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
What should I do ?
Best Answer
The problem is the TNS name which contains a leading whitespace.
For example:
[Whitespace]ORCLPDB = (DESCRIPTION = ...
As we know, the
@
in connection string should immediately followed by the TNS name we can't have whitespace in front of a TNS name.