I'm trying to connect to an oracle 12c database from a remote machine, but it fails with two errors.
sqlplus "user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.1.37)(Port=1521))(CONNECT_DATA=(SID=ora12)))"
SQL*Plus: Release 9.2.0.8.0
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name: user
Enter password: (pass)
ERROR:
ORA-12545: Connect failed because target host or object does not exist
On the connecting machine I can do:
$ tnsping server12
TNS Ping Utility for Linux: Version 9.2.0.8.0
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.37)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora12)))
OK (0 msec)
So there seems to be connectivity.
If I run the same sqlplus command on the DB server, I get
$ sqlplus "user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.1.37)(Port=1521))(CONNECT_DATA=(SID=ora12)))"
SQL*Plus: Release 12.2.0.1.0
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
The TNS on the connecting machine says
server12 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.37)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ora12)
)
)
I can also connect from SQLDeveloper using Basic Connection Type and hostname = 192.168.1.37 and port 1521 and SID=ora12.
Any ideas on how to make it connect?
lsnrctl status
on the server is always a good indication of what you're currently able to connect to