Oracle Database Connection Running on Virtual Machine - oracle

I'm trying to connect to Oracle database hosted in a Linux Virtual Machine, using SQL Developer. Any leads on how to go about it?
I tried connecting using the IP address as HostName. But doesn't work.

In SQL Developer, create a new connection using the following
Connection Name:
Username: The username you use to log into the database
Password:
Hostname: The IP address of the virtual machine
Port: 1521
SID: The Oracle SID of the database you want to connect to

Status : Failure -Test failed: IO Error: The Network Adapter could not
establish the connection (CONNECTION_ID)
This error is almost always caused by a firewall. Make sure the local firewall on the database VM has opened the port 1521 for external connections. It can also sometimes be caused by anti-virus software on the client, preventing outgoing connections that haven't been whitelisted, but this is less common.

Related

What is the cause of this problem "IO Error: The Network Adapter could not establish the connection" on Sql Developer?

I make a connection for connect to the Database Server (other machine).
Then I found "An error was encountered performing the requested operation:
IO Error: The Network Adapter could not establish the connection
Vendor code 17002".
Please look the picture in URL below.
I tried to make a connection but can't access but my team can access it.
My friend used TNS connection type and I did everthing similar him but can't access. I tried to use JDBC thin for connect but can't also.
I had the old connection which I can connect but why I can't connect the new connection.
You're trying to connect to a machine on a network that SQL Developer is unable to reach.
For a TNS connection,
Look at the appropriate TNSNames entry (you will have a tnsnames.ora) file, and find the IP address or network name associated with the connection you're trying to establish -
And then start by trying to ping that resource.
In this case, i'm trying to talk to a database on MY machine, on port 1521. Yours should look quite different.
If you're using a basic connection, then you can look at the connection properties and see what machine/port you're trying to communicate with.
Ping
If you can't reach that machine from your machine, there's zero chance you can connect to a database there.
So, always start with a ping.
Once you see that you can get to that machine, if you're still getting that message, the next thing to think about is blocked ports, the listener defaults to port 1521, but you'll see that in the TNS descriptor as well.
It usually happens when a another process is running on the same port or there is an absence of listener.
Go to Run>services.msc>OracleXETNSListener>Start
Try to reconnect.. Even if the error still prevail then go to cmd
Use code:
npx kill-port <portnumber>
The port number by default is 1521, but you can check the port number in database properties.
It is possible, that your connection is forbidden by the firewall -
go to Control Panel\System and Security\Windows Defender Firewall - Advanced - Outbound Rules - Add a rule. (If you have some antivirus firewall, add rules there)
Create a temporary TCP rule for your port and another rule for UDP. Allow all nets and comps.
Check the telnet connection as cmd -> telnet ->
open remote.host.address PortNumber
If you can connect now, then the problem IS in firewall - edit your new rules, setting the hosts and nets exactly.
This error is because your sqldeveloper is not able to reach the database server's sql service.
One reason could be lsnrctl is down for some reason.
If you have access to machine where database is installed.
In Windows machine, follow: https://www.youtube.com/watch?v=r9pHqOfV2f0&ab_channel=TLinaTutorials
In Linux/macOS machine: Go to $ORACLE_HOME/bin and check status of lsnrctl
execute from $ORACLE_HOME/bin lsnrctl status, if it's down. Then restart it by lsnrctl start.
Check the details of connection in command output like SID, PORT, HOST etc. and try connecting again from sqldeveloper.

Local Oracle Client unable to ping/connect to AWS RDS

I have launched an AWS RDS with Oracle 11g (on port 1521).
Tried to connect using Oracle SQL developer. While testing the connection, getting the following error..
Error:
Status : Failure -Test failed: IO Error: An existing connection was forcibly closed by the remote host, connect lapse 0 ms., Authentication lapse 0 ms.
Explored various options and even opened up the windows outbound port from my local laptop to 1521 port. Nothing helped so far a week.
Found a solution..
Just launched another windows instance in AWS and modified security groups to make it secure access.
Security Group changes:
Opened the 1521 port of AWS RDS Oracle to the new windows instance
alone
Windows instance is restricted to only from office public IP.
This does not solve the real problem. However, this solves my purpose..
Thank you all..

Error Locating Server/Instance Specified using SQLNCLI10.1

following scenario with a firewall inbetween this PCs:
Client PC
IP 10.10.140.100
Subnet 255.255.0.0
Gateway: 10.10.0.254
Server PC
IP 10.40.140.100
Subnet 255.255.0.0
Gateway: 10.140.255.254
The communication itself is already working (ping, using a WebClient) so don't worry too much about that.
I'm facing a connection problem connecting to a named instance (in this case "WINCC") from the Client PC to the Server PC(SQL Server 2008 R2) using the following connection string in the application (Database name is correct, have checked that!):
strserver = "10.40.140.100"
strConnectionString = "Provider=SQLNCLI10.1;Integrated Security=SSPI; Persist Security Info=False;Initial Catalog=" & Database & ";Data Source=" & strServer & "\WINCC"
Circumstances:
Microsoft SQL Server 2008 Native Client is installed on the Client PC
The windows user used on the Client PC is existing on the Server PC and part of the necessary User Group (in this case SIMATIC HMI Group because of WinCC)
I have looked up the dynamic port used by the sql server which is 49181 and the port was opened in the firewall of the network
This has worked in every other network environment till now but something is still somehow blocking the access in the network
The script is crashing with the following error:
"SQL Server Network Interfaces: Error locating Server/Instance Specified [xFFFFFFFF]" when attempting to establish the connection to the database (.Open command).
I'm 99% sure it has to do something with a port not opened. I have seen several times that the UDP Port 1434 of the Sql Browser service has to be open for . Is this also relevant when using the SQL NAtive Client Provider? Or should I try to name the port specifically in the connection string? (Like "10.40.140.100,49181/WINCC"?)
Any comment is appreciated, thanks!
Best regards,
CMSPaul
Using a Dynamic port can often cause issues. If you have an App server connecting to the SQL server inside your network I would suggest using a Static IP on the SQL server and then route it through the firewall as defined. Also as you said I would define the TCP/IP port in your connection string.
This would be set up in SQL Server Configuration manager under SQL Server Network Configuration. Select Protocols for . Right click TCP/IP and select the IP Address tab. Make sure all TCP Dynamic Ports are set to 0. Under IPALL, set the TCP Port to the static IP address. Once that is done, you will need to restart the SQL server service.

why do I have problems connecting remotely to oracle?

I'm trying to connect to oracle database on the following ip 192.168.1.1 port 1521
The firewall is off
but I'm still unable to connect i get the following error while using oracle sql developer: "the network adapter could not establish the connection"
The port 1521 is opened since i could connect to it on localhost
any help?
The port 1521 is opened since i could connect to it on localhost
Unless you've configured your listener with multiple addresses, it will only be listening on one, and since you can connect with localhost then it's (only) using that one. You can verify that with lsnrctl status which will show either localhost or 127.0.0.1, but not the external IP address 192.168.1.1.
You need to reconfigure your listener to use 192.168.1.1 instead of, or as well as, localhost before you'll be able to connect to it from anywhere else.

How can I run Oracle XE on localhost only?

Is there a way that I can configure a XE installation on Windows to only use ports on the localhost interface and not the external interfaces? I'd like to run it for development without having anyone else be able to connect to my instance.
I tried modifying the listener.ora and tnsnames.ora file, changing the 'HOST =' entries to localhost. My hosts file has the following line in it:
127.0.0.1 localhost
When I've done this, and restarted the services, apex stops working (it doesn't listen on port 8080) and I'm unable to connect to the database using JDBC. I get the following error with JDBC:
Exception in thread "main" java.sql.SQLException: Listener refused the connection
with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect
descriptor
The Connection descriptor used by the client was:
localhost:1521:XE
I should note that both apex and JDBC work fine if I change the 'HOST = entries back to my machines hostname and restart the services.
There are two parts for this (because there are two 'technologies' serving different ports).
Firstly the listener for database port 1521. You use a SQLNET.ORA setting (tcp.invited_nodes) as a soft firewall, so the listener will ignore other nodes.
Secondly, for the 8080 PL/SQL gateway you need to use DBMS_XDB.SETLISTENERLOCALACCESS as described here

Resources