• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2795
  • Last Modified:

ORA-12560: TNS:protocol adapter error - Want to "connect scott/tiger"

When I do this:

SQL> connect scott/tiger
ORA-12560: TNS:protocol adapter error

However this works:

SQL> connect scott/tiger@svrmargus

I would like to know why "connect scott/tiger" is not working and how to fix it ?
1 Solution
Jay ToopsCommented:
normally you would say
connect {Servername}

then it would prompt for
userid and password

there is not "Default" dabase in the interactive sql tool

connect scott/tiger doesn't work because you havent told it what server that userid/password is on

If you are loging-in from the Client you must have the @Service Name
From the DB Server, it depends on how the SQLNET.ora file parameters are setup

MargusLehisteAuthor Commented:
Show how would i set up this parameter,

Im using SQL*Plus on the same machine as DB is located @
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

simple say that the sqlplus session does not know where it should connect to, so a connection string that specify the connection in the TNSNAMES.ORA should be specify:

If you are on the same machine of the database, just set the SID environment variable, say you are on NT:

C:\set ORACLE_SID=xyz
C:\sqlplus /nolog
SQL>connect scott/tiger
hi there

the connectino string in oracle is like a human ear, which is used to listen to the oracle database.

the connection string is created and stored in the tnsnames.ora file using the net8 easy config menu option which asks for the host or the server name, the database name, the protocol and the connection string name.

Baonguyen1 has the gist of it.  If the database and client are on the same server, then set the ORACLE_SID parameter.
In Unix(using Korn shell) it would be:  export ORACLE_SID=abc1
In Windows 2000/NT/XP it would be : set ORACLE_SID=abc1

Additionally, depending on the version of Oracle you are using, you can set the environment variable of LOCAL=YES which would indicate that the connection is to occur on the server you are currently on.
You do not have to specify the connect name or database name unless the database is on a different machine than the one you are currently own or if you want to use SQLNet to connect to a database even though you are on the same server as the database.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now