SQL Developer is an Integrated Development Environment (IDE) for developing SQL in Oracle database. This is a free tool from Oracle which is used by both developer and database administrator. This article assumes that you have an Oracle database installed on a Linux server. You have installed SQL Developer to connect to the database. SQL Developer requires a minimum of host name or IP, port, and a database SID and a database user account to make the connection to the database.
Sometime all the information required to make a connection to SQL Developer are provided even then the connection failed with an error message. This is the most common issue I see with a new Oracle database set up or when something changes on server side. Let's find out all the breaking points, test them and fix the connection.
See error message!
status: failure - test failed: IO Error: The network Adapter could not establish the connection
We are now going to troubleshoot this connection issue. Some may know the answers but with this article, we will explore and verify everything that makes this connection. What are few things you need for this connections to succeed beside Oracle user account, host/port and SID?
Verify each listed below for successful connection.
Everything is verified, the host and oracle database is up but still cannot connect to database using SQL Developer.
service iptables save
open file /etc/sysconfig/iptables:
# vi /etc/sysconfig/iptables
and put the below line of code just above the RECJECT code
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
service iptables restart
Check if the rule of 1521 is active
iptables -L -n | grep 1521
The port 1521 is now open on the firewall. This resolved SQL Developer connection issue.
You should be connected by now if you are using a basic thin client connection. The FAT client connection may required some additional troubleshooting steps which we will discuss on next article.
Sometime all the information required to make a connection to SQL Developer are provided even then the connection failed with an error message. This is the most common issue I see with a new Oracle database set up or when something changes on server side. Let's find out all the breaking points, test them and fix the connection.
See error message!
status: failure - test failed: IO Error: The network Adapter could not establish the connection
We are now going to troubleshoot this connection issue. Some may know the answers but with this article, we will explore and verify everything that makes this connection. What are few things you need for this connections to succeed beside Oracle user account, host/port and SID?
Verify each listed below for successful connection.
- Database host is up
- Oracle SID name
- Oracle database is open
- Oracle Listener is listening
- listening port (1521)
- Oracle user account
- Ping host IP 192.168.1.120 from your pc cmd. This test if the host where the database is installed is up or not. # verified,
- Echo $ORACLE_SID # verified the name of SID
- On sqlplus run ( select status from v$instance;) # verified the database is open and running
- LSNRCTL status # verified the listener is listening for the above SID
- Verify port 1521 is the listening port # verified the listening port
- Able to connect to database using the user credential via SQLPlus.
The listener is up and listening at port 1521
oracle@oracldev etc]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JUL-2015 13:25:12
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracldev.baniya.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JUL-2015 13:15:00
Uptime 0 days 0 hr. 10 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracldev/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracldev.baniya.com)(PORT=1521)))
Services Summary...
Service "DEV" has 1 instance(s).
Instance "DEV", status READY, has 1 handler(s) for this service...
Service "DEVXDB" has 1 instance(s).
Instance "DEV", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracldev etc]$
STATUS
------------
OPEN
SQL>
# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracldev.baniya.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.120 oracldev.baniya.com
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 12-JUL-2015 13:25:12
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracldev.baniya.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 12-JUL-2015 13:15:00
Uptime 0 days 0 hr. 10 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracldev/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracldev.baniya.com)(PORT=1521)))
Services Summary...
Service "DEV" has 1 instance(s).
Instance "DEV", status READY, has 1 handler(s) for this service...
Service "DEVXDB" has 1 instance(s).
Instance "DEV", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracldev etc]$
The database is up and mounted
QL> select status from v$instance;STATUS
------------
OPEN
SQL>
The host name and port on tnsname.ora
[oracle@oracldev admin]$ cat listener.ora# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora # Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracldev.baniya.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
Host Name and IP verified.
[oracle@oracldev ~]$ cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.120 oracldev.baniya.com
Pinging to 192.168.1.120
Everything is verified, the host and oracle database is up but still cannot connect to database using SQL Developer.
- Ping host IP 192.168.1.120 from your pc cmd. This test if the host where the database is installed is up or not. # verified,
- Echo $ORACLE_SID # verified the name of SID
- On sqlplus run ( select status from v$instance;) # verified the database is open and running
- LSNRCTL status # verified the listener is listening for the above SID
- Verify port 1521 is the listening port # verified the listening port
- Able to connect to database using the user credential via SQLPlus.
- service iptables stop
- service iptables status
How to open port 1521 on linux server?
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPTservice iptables save
open file /etc/sysconfig/iptables:
# vi /etc/sysconfig/iptables
and put the below line of code just above the RECJECT code
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
service iptables restart
Check if the rule of 1521 is active
iptables -L -n | grep 1521
The port 1521 is now open on the firewall. This resolved SQL Developer connection issue.
You should be connected by now if you are using a basic thin client connection. The FAT client connection may required some additional troubleshooting steps which we will discuss on next article.
Interested in working with me? I can be reached at pbaniya04[at]gmail.com for any questions, consulting opportunities or you may drop a line to say HELLO. Thank your again for visiting my blog and looking forward to serving you more.
Have a Database-ious Day!
Have a Database-ious Day!
No comments