tnsconnect shows operation timeout - oracle

Here is my use case:
We are using virtual machine. Couple of days ago I have created new Oracle database. I cloned this machine and it got different IP address.
Today I wanted to connect to the database using SQLPlus but I go connection timeout. I have tried tnsping command and here is the output of that command:
C:\Users\Administrator>tnsping clm
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 09-JAN-2
014 08:36:31
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTO
COL=TCP)(HOST=9.142.60.187)(PORT=1521)))
TNS-12535: TNS:operation timed out
What is weird, that the current database address is different than 9.142.60.187. sqlnet.ora also does not contain any interesting data:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
?
ADR_BASE = C:\app\Administrator\product\11.2.0\dbhome_1\log
How can I make my connection to sqlplus available?
What is interesting, I am able to connect to the database using jdbc driver and it works fine.

Your sqlnet.ora is configured to first try to use TNSNAMES (tnsnames.ora in your TNS_ADMIN directed folder as defined in registry, environment variable or taken from default location) to resolve clm to a path through your network mapping SQL*Net to TCP/IP and possibly others.
From your tnsping that seems not to resolve. Therefore, SQL*Net tries the second one: EZCONNECT. See Oracle docs on that one.
Probably you are using somewhere an EZCONNECT connection string like user/pwd#//9.142.60.187 without service name and port. Or my knowledge of EZCONNECT is too simple; somehow it seems to translate clm into //9.142.60.187. That might be explained by the answer to the following question: Do you have a hostname clm in DNS or hosts file mapping to 9.142.60.187?
I do not recommend using EZCONNECT, I always like to have tnsnames.ora hard coded, specifying everything needed. EZCONNECT can work nonetheless.
Can you include IP address of clone in your sample?
Can you include outcome of ping clm and nslookup clm in your sample?

Change the ip address in (HOST=9.142.60.187) to the current ip address of server. May be in the JDBC driver you are using host name instead of ip address and that's why it is working. You can also try giving host name in (HOST=9.142.60.187), e.g if host name is ora_server then change it to (HOST=ora_server)

Since tnsping clm is using EZConnect, your tnsnames.ora does not have an connection alias called CLM, but clm is being resolved as a host name to 9.142.60.187. It's using port 1521 by default as it has no instructions to use a specific port. The connection to that address, or at least that port, is then timing out - it might not exist, it might route somewhere unreachable, or it might be blocked by a firewall.
ping clm should show the same address, and will probably also time out. That host may exist in your hosts file, or is being resolved by DNS, possible with a default domain appended, which ping would also show. If it is the name of your old server, you might need to update your hosts file, which might magically make it start working.
If your database is actually called CLM then you can create an entry in your tnsnames.ora that points to the correct IP address for your listener, which your JDBC connection is already using. Or you can use the EZConnect format as your connect string; something like sqlplus user/password#//<your IP>:1521/<your service name>. You can use lsnrctl services to check the IP address, port and service name if you aren't sure.
If you're on the same host as the database then you don't need to do either; presumably you're currently trying sqlplus user/password#clm, but if ORACLE_SID is set you can just do sqlplus user/password and it will not trouble the listener.

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.

How to fetch data from oracle data base from another computer

I am trying to execute one simple desktop application in my system that is built upon java swing.
This application fetches the data from the oracle database which is present in computer A.
I did the development in computer A and built its jar and kept the jar in another system.
I have started all the services of oracle and created an ad hoc network between the two systems, but I am not able to execute the application from another computer. I googled a lot and did the mentioned changes. Still I am getting the same error of TNS listener.
IOException: The network adapter could not establish the connection.
finally I thought to put my code here. please look at the below code:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection =
DriverManager.getConnection("jdbc:oracle:thin:#//xxx.xxx.xxx.xxx:1521/XE"
,"system"
,"system" );
Please help me on this.
I have also tried modifying the tnsnames.ora file but was not helpful. can anybody please help me on this.
Check the listener.ora file - what is the IP address the service is binding to, i.e. what is the IP address specified in this file? If 127.0.0.1, that will explain why it works on Computer A but not B.
If this is the case you should fist stop teh listener service, backup the listener.ora, edit listener.ora, changing the IP address to the appropriate one for Computer A (accessible from Computer B), restart the listener, and retry.
Use tnsping to test the connection works, if you don't have TNS ping you can try "Telnet hostname port" (e.g. telnet computer-A 1521) and if it returns blank screen and flashing cursor on top left then the service is up.

What is the oracle database 12c IP Address

I just Installed Oracle Database 12c. At the end of the installation it gave me Information about my connection. SID, IP, etc. I restarted the computer run all these services (some of them already running):
OracleJobSchedulerORCL
OracleOraDB12Home1MTSRecoveryService
OracleOraDB12Home1TNSListener
OracleRemExecServiceV2
OracleServiceORCL
OracleVssWriterORCL
But I think I forgot the IP and port of my database since I tried to access the database using a webbrowser and it doesn't work (I tried https://10.10.10.10:5500/em). I don't know If the problem is really the IP:Port that I may have forgotten or if I forgot to run service. I am pretty sure the IP address look like https://10.10.x.x:xxxx/em but I don't I am not certain. Is there a way to recover the IP address and port of the database?
EDIT: I've installed it on Windows 8 x64 JP. with
In Environment Variable
with ORACLE_HOSTNAME = 10.10.10.10
ORACLE_UNQNAME = orcl
And in the host file (in System32/Drivers/etc/)
127.0.0.1 localhost
10.10.10.10 wopr.orcl wopr
Per documentation, format for accessing enterprise manager in your browser
http://hostname:portnumber/em
Once you sure that default port number is kept as default HTTP port number is 5500 then you can get your system hostname. Port numbers are recorded in $ORACLE_HOME/install/portlist.ini file.
If running windows then just run the command hostname which will give you the hostname of your machine. Then run like
http://My_hostname:5500/em
Or use the command ipconfig to see your IPV4 address and use that address
http://X.X.X.X:5500/em
Or you as well use localhost
http://localhost:5500/em
or 127.0.0.1 (loop back address) like
http://127.0.0.1:5500/em
See here for more information
Well, if you installed it on your local machine, you can always access it using localhost, so try https://localhost:5500/em.
The default port number for Enterprise Manager is indeed 5500.

Oracle Connection String for RAC Environment?

I have got an ORACLE RAC Environment access .The details are
Database Name: orcl
Service Name: orcl
IP Address: 192.168.1.1 and 192.168.1.2
SQL> host srvctl status database -d orcl
Instance orcl1 is running on node orclnode1
Instance orcl2 is running on node orclnode2
My concern is my connection, which is being established using
(DESCRIPTION=(ADDRESS=
(PROTOCOL=TCP)(HOST=192.168.1.1) (PORT=1521)
)(CONNECT_DATA=(SID=orcl1)))
But the provider wants it to be connected via the orcl service name .
I don`t have any other info related to this. Am I connecting correctly or I need hostname or IP address for orcl service name.
Your connection string is referencing one instance on one server/node. You should be using the common service name instead, and identifying all the servers it is available on.
The equivalent for you would be something like this (line breaks just for clarity here):
(DESCRIPTION=(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.2)(PORT=1521))
)(CONNECT_DATA=(SERVICE_NAME=orcl)))
As long as it is resolvable, it shouldn't matter whether you use the DNS names or the IP addresses for the HOST parameters.
You may also need the LOAD_BALANCE or FAILOVER parameters; see the docs.

How do I change the IP address on Oracle 10g

What steps do I need to take to change an IP address for Oracle 10g? I cannot connect to the database after going from a dhcp address to a static IP and a reboot.
If the server's IP address changed, these are the first things I would look at:
The TNSNAMES.ORA file on the client -- does it have the IP address hardcoded? If so, change it. Does it use the machine name? If so, does the machine name resolve to the correct IP address on your client machine?
The LISTENER.ORA file on the server -- does it explicitly specify the old IP address as its listening address?
More info please. Do you mean that you have changed the ip address of the host that the database is on and now you have to connect to it from a different macine, or are you having trouble starting the database after the ip change?
... and what error message do you receive?
Most obvious files to check are:
$ORACLE_HOME/network/admin/tnsnames.ora
$ORACLE_HOME/network/admin/listener.ora
Other than that we'd need more info...
I presume you mean the Oracle 10g DB and not the Oracle 10g Application Server?
Does the database start ok?
Is there anything in the database alert log?
Are the error(s) connecting from a client or the server?
What error message(s) do you get?
Can you ping the machine on it's new address (by both name + IP address) From both client + server?
Does a TNSPING work?
Can you connect using SQL*Plus on the server?
What other tool(s) have you tried connecting with?
Update after comment
Please can you post...
Your old ip address (if you know it)
Your new ip address
Your FQDN (e.g. machine.domain.com)
The output of "ipconfig/all" (or equivalent)
Your listener.ora file
The output of "$ORACLE_HOME/bin/lsnrctl start"
The output of "$ORACLE_HOME/bin/lsnrctl status"
Check that LOCAL_LISTENER is not defined (or defined correctly) in the database - it may not be registering correctly because of an incorrect entry here. Also try 'ALTER SYSTEM REGISTER' to attempt to register with the listener (rather than waiting up to 3 minutes for an auto-register). Examine the listener.log to see the instance registered (service_update * ) and 'lsnrctl status' to see if it is there.
Did you change the hostname in DNS? Can you ping the hostname from another machine?

Resources