D. Vas D. Vas - 3 months ago 7
Linux Question

How to connect to Oracle database from another machine?

I have Oracle 12c db on first virtual machine and Client on second. How to connect them? And how to check the connection?
machines: Linux RedHat 6

Answer

Here's an example TNSNAMES.ORA from one of our servers:

PRODDB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = WIN-ORACLE-EN-1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PRODDB)
    )
  )

You also need to make sure that the LISTENER.ORA has been configured correctly and that both database and listener services are running.

After installing SQL*plus or SQL Developer, also make sure that on the client machine the TNSNAMES.ORA matches the server configuration, then try:

TNSPING PRODDB

and you should receive an "OK" as a result.

Here's an article with more information (taken from "dummies.com", shouldn't be any insult ;-) ):

http://www.dummies.com/how-to/content/how-to-connect-to-the-oracle-12c-database-instance.html