Linux – AWS ORACLE Linux 7.4 – Connection issue

awsinstallationlinuxoracletcpip

I tried to install oracle 12c in Oracle Linux 7.4 instance upon AWS ORACLE Linux 64 EC2 instance,
I could make the installation and connect to the database from the ec2 server without any issue however when I try connecting to the database from my desktop I get generic TNS Protocol adapter error.

Please find more information about my instance:
1. I have set following rule for my EC2 instance
instance rule

Please note, I am not sure why i am getting every roles twice also I am not sure why type is 'Oracle -RDS', i always check the type as 'Custom TCP'

  1. hostname value from my unix

ip-xx-x-x-xxx.ap-south-1.compute.internal

  1. tnsnames.ora

ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =
ip-xx-x-x-xxx.ap-south-1.compute.internal)(PORT = 1521)) (CONNECT_DATA
= (SERVER = DEDICATED) (SERVICE_NAME = orcl.ap-south-1.compute.internal) )
)

  1. listener.ora

LISTENER = (DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip-xx-x-x-xxx.ap-south-1.compute.internal)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
) )

  1. lsnrctl status

eLSNRCTL for Linux: Version 12.1.0.2.0 - Production on 30-JAN-2018 13:53:11'
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ip-xx-x-x-xxx.ap-south-1.compute.internal)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 30-JAN-2018 13:25:18
Uptime 0 days 0 hr. 27 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/ip-10-0-0-253/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ip-xx-x-x-xxx.ap-south-1.compute.internal)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=ip-xx-x-x-xxx.ap-south-1.compute.internal)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.1.0/dbhome_1/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl.ap-south-1.compute.internal" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB.ap-south-1.compute.internal" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "pdborcl.ap-south-1.compute.internal" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...

  1. Value from v$instance table

SQL> select host_name, instance_name from v$instance;

HOST_NAME
—————————————————————- INSTANCE_NAME
—————- ip-xx-x-x-xxx.ap-south-1.compute.internal orcl

I am not sure why I cannot connect from outside of ec2 instance; Please help me out of this issue

Best Answer

Did you check firewall enabled or not on your Linux machine? If it is enabled then you should need to add your port 1521 for accepting requests just like the following command.

sudo iptables -I INPUT -p tcp --dport 1521 -j ACCEPT