Symptom:
When trying to connect to Oracle the following error is generated:
ORA-12154: TNS:could not resolve service name
Cause:
This error indicates that the service (or TNS alias) specified when trying to connect does not exist.
‘TNS aliases’ or ‘service names’ are defined locally to each workstation. Thus different workstations could have a completely different alias to refer to the same database.
Remedy:
* Check what aliases are defined on the workstation, either use one that is defined or add an appropriate one.
The following methods can be used to view the TNS names:
* Look in the file ‘ORANT\ Network\ Admin\ Tnsnames.ora’ (for versions of Oracle prior to 8.1) or ‘Oracle\ Ora81\ Network\ Admin\ Tnsnames.ora’ (for versions of Oracle from 8.1 onwards). In this file each defined name will normally have ‘.world’ appended to it.
* For Oracle 8, run ‘Oracle Net8 Easy Config’. This will list the available service names.
* For Oracle 7, run ‘SQL Net Easy Configuration’. This provides the option to list the available service names.
* For Oracle 8.1 onwards: Try specifying the full service name, i.e. as it appears in the tnsnames file.
If a connection alias is not being explicitly provided then try to identify what alias Oracle thinks you are using. This will typically be contained in the ‘sqlnet.log’ file that the Oracle client will produce. Possible places where Oracle could be getting this (default) alias from:
* The environment variable ‘LOCAL’.
No comments:
Post a Comment