Connecting from Host-SQLDeveloper to Virtualbox VM Oracle Database [duplicate] - oracle

I'm in real need of a help here. I setup a Oracle Database server on a VirtualBox VM and until yesterday everything seemed to work just fine. Today when I initiated the database to keep working, and turned on SQLDeveloper in my local machine (Client machine) it threw me this error:
Erro de ES: The Network Adapter could not establish the connection
My VirtualBox VM network setting is configure to bridged adapter. And I was able to connect just fine and today, out of nothing this error started occurring.
I did some research but none of them worked for me. Tried to follow this guy solution:
Oracle SQL Developer: Failure - Test failed: The Network Adapter could not establish the connection?
And didn't work as well. I'm gonna share my lsnrctl status and my file here so you can take a look.
First this is how I start my setup:
1. lsnrctl start to start the listener. Resulting in:
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 24-AUG-2020 10:40:56
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 24-AUG-2020 10:40:56
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
2. sqlplus / as sysdba to start sqlplus shell and then startup to start the database instance, which gives:
ORACLE instance started.
Total System Global Area 2550136832 bytes
Fixed Size 8623928 bytes
Variable Size 671090888 bytes
Database Buffers 1862270976 bytes
Redo Buffers 8151040 bytes
Database mounted.
Database opened.
Then my lsnrctl status gives:
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 24-AUG-2020 10:46:34
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 24-AUG-2020 10:40:56
Uptime 0 days 0 hr. 5 min. 38 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=dbserver)(PORT=5500))(Security=(I removed the path for security))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
My listener.ora:
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
My tnsnames.ora:
GNU nano 2.9.8 tnsnames.ora Modified
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
When I try to connect in the database through the SQLDeveloper installed inside the Virtual Machine (That is the server side) it works ok, but when I try to connect from the SQLDeveloper on the local machine (Client side) i throws the error.
Every post I saw, told me to look on the listener status, but that is not the problem, I think.
I'd appreciate any help guys. And thank you very much, any additional information I`m here to answer. =D
EDIT: forgot to mention that I'm using version 12c of the Oracle Databse
EDIT: Here is how I'm trying to connect to the DB:
EDIT: When I ping the host for the DB I get this:
[oracle#dbserver admin]$ ping dbserver
PING dbserver(dbserver (fe80::f8dd:c03c:920c:5442%enp0s3)) 56 data bytes
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=1 ttl=64 time=0.075 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=2 ttl=64 time=0.053 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=3 ttl=64 time=0.051 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=4 ttl=64 time=0.072 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=5 ttl=64 time=0.049 ms
^C
--- dbserver ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 131ms
rtt min/avg/max/mdev = 0.049/0.060/0.075/0.011 ms

I used to fight with VM networking settings such that my host could 'see' my vm, and vice versa.
I stopped worrying about this once i learned about port forwards.
You can simply tell VirtualBox to take traffic from your local port, say 1521, and forward that to the VM, say also 1521.
So when connecting to the VM from my host in SQL Developer, I can go to localhost:1521, and have my connection traffic go to the Oracle Listener on my Linux VBox image, listening on port 1521
Click on Port Forwarding
Add an entry for TCP 1521 and 1521
Then, in SQL Developer you can simply do this to connect to your DB on the VM

I'm glad you got it working, but as an alternative, let me say that I'm not a big fan of port forwarding for this issue, nor am I a fan of using the bridged adapter. I've created scores of VMs under VBox, both on Windows and on Ubuntu hosts. In every case I create HOSTONLY adapter, and configure it with a fixed IP address. I then add an entry for the vm in the host's 'hosts' file. See more detail at https://edstevensdba.wordpress.com/2012/12/15/configure-the-virtualbox-network-2/

Related

Can not connect ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

I want to connect my PLSQL developer tools into database but fail to connect due to error below.
ORA-12514: TNS: listener does not currently know of service requested in connect descriptor
Check configuration below. How to configure to make it works?
SQL> select value from v$parameter where name='service_names';
VALUE
orcl
SQL> select instance from v$thread;
INSTANCE
orcl
SQL> select host_name,instance_name,version from v$instance;
HOST_NAME
INSTANCE_NAME VERSION
ex-cs-b
orcl 11.2.0.1.0
SQL> select global_name from global_name;
GLOBAL_NAME
ORCL
SQL>
lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-OCT-2017 16:49:51
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 23-OCT-2017 16:49:40
Uptime 0 days 0 hr. 0 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /app/oracle/diag/tnslsnr/ex-cs-b/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ex-cs-b)(PORT=1521)))
The listener supports no services
The command completed successfully
lsnrctl services
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 23-OCT-2017 16:58:18
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
more tnsnames.ora
# tnsnames.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_1/network
/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ex-cs-b)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
more listener.ora
# listener.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_1/network
/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = ex-cs-b)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /app/oracle
Your database hasn't been registered with the listener. lsnrctl status returned "The listener supports no services" and your listener.ora file doesn't have a SID_LIST.
Connect to your database instance as a SYSDBA and run:
ALTER SYSTEM SET LOCAL_LISTENER='';
If that doesn't resolve your problem then you mostly likely have several listeners and you'll need to follow the registration process for the listener that you want.
All of this complexity is to allow an operating system to run multiple listeners, which can be useful.
Do note that depending on how you started your instance, you may need to specify SCOPE on the ALTER SYSTEM command or your configuration will disappear on restart of the instance.

connecting to database on ec2 Virtual Machine from sql developer

I am using Oracle SQL Developer 4 to connect to databases . We are running an Oracle 11g on Amazon EC2 Virtual Machine (not RDS) and I can’t connect remotely. inside the Virtual Machine as local host it work fine.
how can I set up my Virtual Machine to be able to connect remotely via sql developer to database installed on that Virtual Machine.
I encountered the same problem today and here is my configuration.
The Oracle 11g is installed on a RHEL EC2 instance and the SQL developer is installed on a Windows 2008 R2 Server instance.
We need to do these three things to fix the problem:
1) In the security group of the Amazon instances, add the inbound rules to allow connections to the Linux server. Notice that the Source IP address has to be the AWS private IP in the format of 172.31.0.0/16 instead of the public IP of 52.76.0.0/16.
2) Add the entry as below to your tnsnames.ora file:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ec2-52-76-XX-XX.us-west-2.compute.amazonaws.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.us-west-2.compute.internal)
)
)
3) On the RHEL instance, only the ports of 22 (SSH) and 5904 (TightVNC) are opened now. We need to use the following command from ec2-user account to punch a hole in the firewall to open the port of 1521 which is used by Oracle database service.
sudo iptables -I INPUT -p tcp --dport 1521 -j ACCEPT

ORA-12637: Packet receive failed

After setting up oracle server, I found I can connect to the oracle by using
sqlplus64 user/pass#//192.168.23.14/testsid
in server 192.168.23.15
but I can not sqlplus on 172.26.142.33 (my local pc address)
I check the port, actually I can
telnet 192.168.23.14 1521
Here, I list my server information:
OS: Ubuntu 14.04LTS
[oracle#2404f0da2a14 ~]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 18-JAN-2015 06:25:06
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 18-JAN-2015 04:48:59
Uptime 0 days 1 hr. 36 min. 6 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/2404f0da2a14/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "testsid" has 1 instance(s).
Instance "testsid", status READY, has 1 handler(s) for this service...
Service "testsidXDB" has 1 instance(s).
Instance "testsid", status READY, has 1 handler(s) for this service...
The command completed successfully
I also checked sqlnet.ora
# sqlnet.ora Network Configuration File: /opt/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
It seems there is no restriction.
What's the possible problem? Thank you.

Oracle sql developer can acess from loalhost but not ip address

Here i have installed
widows server 2008 64
orale 11g r2 64
now i want to access this from the ip address that i have set to my server not
working i can't access trough the ip address....
when i use on my application .....local host it can get connected but
when i add the ip for example 10.0.0.2 it's not connecting
now simply also on local when i write the ip address it's not connecting
but with localhost works fine.....
so even i have used listener.
after running
C:\>lsnrctl status
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 10-NOV-2013 02:28
:36
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Produ
ction
Start Date 10-NOV-2013 02:18:36
Uptime 0 days 0 hr. 10 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app\Administrator\product\11.2.0\dbhome_1\network\a
dmin\listener.ora
Listener Log File c:\app\administrator\diag\tnslsnr\WIN-3ALDRUD96NE\list
ener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "pat_live" has 1 instance(s).
Instance "patlive", status READY, has 1 handler(s) for this service...
Service "pat_test" has 1 instance(s).
Instance "pattest", status READY, has 1 handler(s) for this service...
Service "patliveXDB" has 1 instance(s).
Instance "patlive", status READY, has 1 handler(s) for this service...
Service "pattestXDB" has 1 instance(s).
Instance "pattest", status READY, has 1 handler(s) for this service...
The command completed successfully
C:\>
regards
Yeah, this happens when your hostname settings are detected incorrectly. Log in to the server where the database runs, and run:
lsnrctl status
You will most likely see that the listener listens on localhost/127.0.0.1, and not on the address which is reachable from the network.
Locate the listener.ora file (the lsnrctl status command displays the full path to it), edit it, e.g:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.0.2)(PORT = 1521))
)
)
Then restart the listener.
lsnrctl stop
lsnrctl start
Or use the "Services" management console in Windows to restart the listener service.
Context:
LSNRCTL for 64-bit Windows: Version 12.1.0.2.0
Steps:
lsnrctl stop
Change listener host from localhost to specific server IP
Sample path: C:\app\root\product\12.1.0\dbhome_1\NETWORK\ADMIN\listener.ora
lsnrctl start
for check: lsnrctl status
Check that the IP address and port of the server machine is correct and that you can ping it from the other machine. If it is correct and you can ping it, you need to reconfigure the firewall that is preventing you connecting on that port. It could be a firewall on the server itself, or somewhere else on your network.

Oracle database listner.ora configuration is not read during listener startup

I have configured following two configuration files of oracle database.
/opt/oracle/11.2.0/network/admin/listener.ora to have following values
ADR_BASE_LISTENER = /opt/oracle
LISTENER_JIPDB =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1530))
)
)
SID_LIST_LSNR_JIPDB =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = DWJP02T)
(ORACLE_HOME = /opt/oracle/11.2.0)
(SID_NAME = DWJP02T)
)
)
and I have configured /opt/oracle/11.2.0/network/admin/tnsnames.ora
file to have following values
LISTENER_JIPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain )(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DWJP02T)
)
)
My question is when i try to start the oracle listner by typing following command,
it is opening the DWJP02T SID instance in 1521 port, i don't know how it is getting this port or from where it is reading this port, I have configured to it to read 1530 on the .ora files.
this is the output i get when i start the listner
[ora112#localhost ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 26-DEC-2012 22:48:16
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /opt/oracle/11.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /opt/oracle/11.2.0/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 26-DEC-2012 22:48:16
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/11.2.0/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
Please help me to understand why it is opening database on different port than what i have configred it to start. I restarted the database and the server to see if it will read values from the listner.ora file, but still no luck.
Try these steps to furnish the request:
Stop the Oracle listener using the following command:
lsnrctl stop
Change the port number in the Oracle listener.ora file. For example, from the default port 1522 to 1521.
Change the port number in the tnsnames.ora file as in the following example, where host_name is your host name and server_name is your server name.
Restart the Oracle listener using the following command:
lsnrctl start
Change the port to which the database is listening:
sqlplus / as sysdba
> alter system set LOCAL_LISTENER="(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522))";
> alter system register;

Resources