HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

ORA-12154 TNS: could not resolve the connect identifier specified with SQLPLUS

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
theconnectidentifiertnswithcouldoraresolvesqlplusnot

Problem

I am using Toad to connect my database and its working fine for me .
But when i try to connect with the same credential , i am getting the error message as shown below:

ORA-12154 TNS: could not resolve the connect identifier specified


Steps:

  • Opened command promt



  • Reach to the path of SQLPLUS (C:\programs\Oracle\Ora11g\BIN)



  • C:\programs\Oracle\Ora11g\BIN\sqlplus username@schema_name



-
Enter Password :

ERROR:
ORA-12154 TNS: could not resolve the connect identifier specified

-
But when i open this with the owner of the schema ,it works for me

-
C:\programs\Oracle\Ora11g\BIN\sqlplus schema_name@schema_name

-
Enter Password:

-
Connected to :......................

So,my question is why my username is not able to connect that particular schema ,while the owner of that schema can connect .
Note:I can connect to that schema with my username with Toad ,but not with sqlplus

My TNSNAME.ORA is under TNS_ADMIN folder

Please help me out of this .

Solution

So you don't need to specify the full path when you run sqlplus.exe:

Set your %TNS_ADMIN% variable to the full path of the relevant folder (C:\programs\Oracle\Ora11g\TNS_ADMIN ?). Instructions for doing so are a google away. At the same time, make sure %ORACLE_HOME% is set to C:\programs\Oracle\Ora11g and that your %PATH% has C:\programs\Oracle\Ora11g\bin added to it.

The problem you're actually having is because of the parameters you're passing to sqlplus.

You've been doing:

C:\programs\Oracle\Ora11g\BIN\sqlplus username@schema_name


Which is wrong & interpreted by sqlplus as:

C:\programs\Oracle\Ora11g\BIN\sqlplus username@database_name


Also, in Oracle, the owner of a schema (hence the schema name) is the user name. Obviously, grants can be given to other users to perform DML/DDL on other schemas, but you still have to login with a user with sufficient rights. (Proxy logins exist, as does alter session set current_schema=blah, but both are beyond the scope of this answer).

Code Snippets

C:\programs\Oracle\Ora11g\BIN\sqlplus username@schema_name
C:\programs\Oracle\Ora11g\BIN\sqlplus username@database_name

Context

StackExchange Database Administrators Q#34952, answer score: 4

Revisions (0)

No revisions yet.