Andy
Andy

Reputation: 13

Can't connect to oracledb

I'm running into the following error when I try to connect to an OracleDB 12c RHEL instance running in AWS from Oracle SQL Developer.

Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection

I can't telnet to the port either, but it sounds like the port is open and just doesn't haven anything listening.

$ telnet 10.20.10.215 1521
Trying 10.20.10.215...
telnet: connect to address 10.20.10.215: Connection refused

I've been looking through other answers and it seems like everybody's is very specific to their specific situation, so I decided to make a new question. Another asker was told to list the output of the following commands, so I've done that so to try to assist in diagnosis.

[oracle@ip-10-20-10-215 ec2-user]$ lsnrctl stop

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 09-JUL-2018 19:46:21

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora)(PORT=1521)))
The command completed successfully
[oracle@ip-10-20-10-215 ec2-user]$ lsnrctl start

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 09-JUL-2018 19:46:25

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /ora01/app/oracle/product/12.1.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /ora01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Log messages written to /ora01/app/oracle/diag/tnslsnr/ip-10-20-10-215/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                09-JUL-2018 19:46:25
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /ora01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File         /ora01/app/oracle/diag/tnslsnr/ip-10-20-10-215/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@ip-10-20-10-215 ec2-user]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 09-JUL-2018 19:46:27

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                09-JUL-2018 19:46:25
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /ora01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
Listener Log File         /ora01/app/oracle/diag/tnslsnr/ip-10-20-10-215/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@ip-10-20-10-215 ec2-user]$ lsnrctl service

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 09-JUL-2018 19:46:31

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@ip-10-20-10-215 ec2-user]$ set
BASH=/bin/bash
BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:histappend:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="2" [2]="46" [3]="2" [4]="release" [5]="x86_64-redhat-linux-gnu")
BASH_VERSION='4.2.46(2)-release'
CLASSPATH=ORACLE_HOME/jlib:ORACLE_HOME/rdbms/jlib
COLUMNS=99
DIRSTACK=()
EUID=54321
GROUPS=()
HISTFILE=/home/oracle/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/home/oracle
HOSTNAME=ip-10-20-10-215.us-gov-west-1.compute.internal
HOSTTYPE=x86_64
IFS=$' \t\n'
LANG=en_US.UTF-8
LD_LIBRARY_PATH=/ora01/app/oracle/product/12.1.0/db_1/lib:
LESSOPEN='||/usr/bin/lesspipe.sh %s'
LINES=27
LOGNAME=oracle
LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:'
MACHTYPE=x86_64-redhat-linux-gnu
MAIL=/var/spool/mail/ec2-user
MAILCHECK=60
OPTERR=1
OPTIND=1
ORACLE_BASE=/ora01/app/oracle
ORACLE_HOME=/ora01/app/oracle/product/12.1.0/db_1
ORACLE_HOSTNAME=ora
ORACLE_SID=ORA12C
ORACLE_UNQNAME=ORA12C
OSTYPE=linux-gnu
PATH=/ora01/app/oracle/product/12.1.0/db_1/bin:/sbin:/bin:/usr/sbin:/usr/bin
PIPESTATUS=([0]="0")
PPID=11863
PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
PS1='[\u@\h \W]\$ '
PS2='> '
PS4='+ '
PWD=/home/ec2-user
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SUDO_COMMAND='/bin/su oracle'
SUDO_GID=1000
SUDO_UID=1000
SUDO_USER=ec2-user
TERM=xterm
TMP=/tmp
UID=54321
USER=oracle
USERNAME=root
XDG_SESSION_ID=42
_=service
colors=/home/oracle/.dircolors
[oracle@ip-10-20-10-215 ec2-user]$

Upvotes: 1

Views: 1841

Answers (1)

Alex Poole
Alex Poole

Reputation: 191235

Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Your listener is (only) listening on localhost, 127.0.0.1.

You are trying to connect to 10.20.10.215, and as you suspect nothing is listenening on port 1521 on that address. (You can use netstat to check which pirts and addresses are actually listening for connections across the OS.)

If SQL developer is running within the same RHEL server then you can just change the connection settings to connect to 127.0.0.1.

Otherwise you can change the listener to listen on the 10.20.10.215 address instead (or as well); or (depending on how you reach it) set up some kind of tunnelled or NAT'd access.

Upvotes: 1

Related Questions