tnsnames.ora file --- including port along with Hostname/ IP address

Can we include the port along with the IP address in tnsnames.ora file to connect to an IP address across a port (not in the same LAN network) ?

eg: HOST = 65012 (PORT = 1521)

or HOST =  (PORT = 65012)

both the above the examples did not work for me ,

any ideas/inputs/suggestions ?

(Btw, do we always need PORT =1521 to be included for oracle ? or are there any alternatives) ?

Who is Participating?
konektorConnect With a Mentor Commented:
<database name, which u will use to connect>.<domain name, usually "world"> =
      (ADDRESS = (PROTOCOL = TCP)(HOST = <IP of db server, or it's name>)(PORT = <port>))
      (SERVICE_NAME = <database SID>)

but <port> is the number of port on which database listerner listen. it is usually 1521 - but u can change it while installing (usually, when 1521 is used)
port is usually 4-digit, i'm affraid, that your number 65012 is port of something else ...
jdlambert1Connect With a Mentor Commented:
The correct syntax is:

(HOST =  (PORT = 65012)

You can use any port number, but the client and server need to be configured on the same port -- it does no good to "talk" on one port number if the Listener isn't listening on that port. Also, since both computers should be behind firewalls, both firewalls will have to have the same port number open for Oracle traffic. Port 1521 is the standard (default) port for Oracle.
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.

All Courses

From novice to tech pro — start learning today.