Home / Oracle Error / ORA-12154: TNS could not resolve service name

ORA-12154: TNS could not resolve service name

TNS could not resolve service name

is a very common error, always related to your local copy of the tnsnames.ora file, your listener configuration, and your database name aliases.

  • Make sure that your listener is listening for the same service name that you are using.
  • Your service name might have an alias, so check for global (world) entries and local entries.  Check:
    $ORACLE_HOME/network/admin/tnsnames.ora
  • Check your global_name setting with this SQL:
    select * from global_name;

The query value should match your init.ora prams for db_name and db_domain,  You can change the global_name with an ALTER DATABASE command, as follows:

Update .bash_profile File.

If you are using the standard Oracle client, the Database attribute value must specify a valid service name defined in tnsnames.ora which is located in$ORACLE_HOME/network/admin/tnsnames.ora For example, for the followingtnsnames.ora entry, the Database attribute value needs to be orcldb:
If we do not use tnsnames.ora , we can use SQL connection string , connection string format below:

Check Also

ORA-00920

ORA-00920 ORA-00920: invalid relational operator tips is a syntax issue and can easily be resolved …

ORA-00922

ORA-00922 ORA-00922: missing or invalid option is one of many Oracle errors, which does not …

Leave a Reply