ORA-12560: TNS: protocol adapter error when connecting to the database. How to fix it?

There is an Oracle DATABASE on a virtual machine. Access from the machine itself via sqlplus works. I can't connect to the network via sqlplus. tnsping works on the network. :

On both machines, sqlnet. ora says:

SQLNET.AUTHENTICATION_SERVICES = (NONE)

When connecting, I wrote

>SET ORACLE_SID SID
>sqlplus
  Enter user-name: sys as sysdba
  Enter password:  password

And I get an error.

ORA-12560: TNS:protocol adapter error

I tried to connect like this:

"sqlplus sys/[email protected]_name as sysdba"

I get the error

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

tnsping tns.domain_name runs without errors. I connect to other databases on other machines on the network. Where to see how to fix it?

Author: Viktorov, 2016-11-29

1 answers

I will summarize the comments.

To connect to a remote database, it does not make sense to set ORACLE_SID. By setting this variable, you can connect via the Bequeath protocol without specifying the connection string and without the participation of the listener, but only on the same machine on which the database is installed, i.e. locally.

If several clients are installed on the client machine, it is highly recommended that the network configuration files, tnsnames.ora, sqlnet.ora, etc., be placed in create a separate folder (anywhere) and create an environment variable TNS_ADMIN pointing to this folder.

How to search for files on Windows:

  • TNS_ADMIN environment
  • TNS_ADMIN registry
  • %ORACLE_HOME%\network\admin

ORACLE_HOME from the environment always takes precedence over a record from the register.

The use of the registry is poorly documented, i.e. which oracle house will be found in different clients, judging by the debates on various forums, not quite clear.
As far as I know-if you remove the database from a machine with an exotic operating system, you must always clean the registry with pens, so that its outdated records do not come up again somewhere. Apparently, the same applies to customers.

In this particular case, apparently tnsping and sqlplus found two different tnsnames. rsa and only installing the ORACLE_HOME environment managed to achieve the desired result.

 5
Author: 0xdb, 2017-12-21 20:39:12