Saturday, March 26, 2016

ORA-12154: TNS: could not resolve service name

When running Oracle RMAN backup, RMAN manages to connect to the target database but fails to connect to the Recovery Catalog by giving below errors:
RMAN-04004: error from recovery catalog database:
ORA-12154: TNS:could not resolve service name
Recently I receive and issue from one user, he has created a separate tablespace and user for recovery catalog and registered database in recovery catalog, but unable to connect to catalog using CONNECT CATALOG COMMAND. When he tries to connect catalog database with @database is giving error without @database he is able to connect successfully.
Cause: TNS: could not resolve the connect identifier specified
A connection to a database or other service was requested using the connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming method configured. For Example, if the type of connect identifier used was net service name then the net service name could not be found in a naming method repository or the repository cold not be located or reached.
Solution: If you are using local naming method make sure the tnsname.ora file having the correct entry there is no syntax error.
Simply try to connect your catalog database in SQL*plus
SQL> sys/*****@orcl3
or try to ping your catalog database
cmd> tnsping catalog_DB
If it is not working, then check your tnsnames.ora for catalog database entry there must be any thing wrong entered, correct it try to tnsping again as long as it will start pinging then try to reload listener
cmd>lsnrctl
lsnrctl> reload listener
when tns entry start pinging and listener is OK then
cmd> set oracle_sid=catalog_db
cmd> rman catalog rman/rman@catalog
ORA-12154: TNS: Could not resolve service name.
I need to create an ODBC connection to access oracle table data. I already installed oracle client on the system having ORACLE-BASE=C:\oracle9i through which allow a configuration of listener in a net configuration utility. When I try to connect getting the following error: ORA-12154: TNS: Could not resolve service name.
1. Find the tnsname.ora from the ORACLE-HOME\Network\Admin folder and try to change it accordingly:
SERVICENAME_alias =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = HOST.XYZi.com)(PORT = 1521))
 (CONNECT_DATA = (SERVICE_NAME = SERVICENAME))

I already written some more tnsname.ora file rules in my older article. Here in this article I am going to describe the solution which is different than above solution. I found the problem is because oracle database does not like the space in C:\program files (x86)/Toad so we need to create a new directory named without space such as: C:\oracle\toad.

The another solution to this problem found an environmental variable called TNS_ADMIN set in My Computer => Properties => Advanced => Environment Variables => look in System variables for an entry called TNS_ADMIN.
TNS_ADMIN is added to change the default path for tnsnames.ora entry. This is useful when it used in a network environment where a generic tnsnames.ora entry can be setup for all the network computers. To look at the default path of tnsnames.ora add the default path in TNS_ADMIN.
Sometimes if the SID service is hangs due to any reason same problem occurs in that case you need to restart the service name.
More Related Links:

No comments:

Post a Comment