Cannot login to my db - oracle

I want to login to my db but an exception occur which appears in the image bellow
If there's no way to login how can I restore the data??
EDIT: check the configuration of my user

What is configured in tnsnames.ora.
Check if the server IP is properly entered and the port is also 1521
Check if oracle is configured as a service or SID.
instead of localhost use machine name or IP

You might want to check your listener.ora file as well.

Can you do a lsnrctl status to see what port the listener is running on and what services/sids are registered . I believe you are trying to run the db on your workstation. you might want to check the services.

Related

Check to make sure the host is up or that the database listener is running on that host

i have a problem when i try to install Oracle Interprise Manager Cloud Control 12c
I checked it is open enter image description here
What should i do now
Check the network listener with "lsnrctl status" from the command line and make sure it is running (it will have its own service on Windows), and that the database has registered
a service name with it.
If the listener is up and running correctly, make sure there is no system firewall blocking access to port 1521.
Try using the IP address of the host instead of the hostname, or switch to "localhost" if everything is running on the same system.

What does Oracles 'alter system set local_listener' do exactly

Why I am curious:
I have always had issues when installing an Oracle Express Database. As in I have never had it work right the first time round. The next time I boot my computer after installing Oracle Express I consistently receive the common error:
TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
I have managed to fix this issue using various methods however I have learned that the best method that works for me these days is to Reconfigure the Listener using SQL Plus. When the Listener fails SQL Plus is the only way I can connect to the OracleXE Server and after searching the Internet I'm not alone here.
The DDL that fixes this error - run from SQL Plus:
alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))' scope=both;
The Question:
Why does re-configuring the Listener work? What does it do? I monitored my listener.ora file along with my TNSNames.ora file and they remain the same before and after I run the above code. So what did it do?
I read this entire Oracle LISTENER Documentation and I did not come out of it enlightened. Can anyone enlighten me?
Why does re-configuring the Listener work?
You are not reconfiguring the listener. That's why you don't see the listener configuration file change. You are changing the database configuration. The spfile is updated because the command you used had scope=both, which means the change is applied immediately - in memory - and written to that file, so it persists on database restart.
From the docs:
LOCAL_LISTENER specifies a network name that resolves to an address or address list of Oracle Net local listeners (that is, listeners that run on the same system as this instance).
and the default is:
(ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1521)) where hostname is the network name of the local host.
See also the alter system REGISTER clause:
Specify REGISTER to instruct the PMON background process to register the instance with the listeners immediately. If you do not specify this clause, then registration of the instance does not occur until the next time PMON executes the discovery routine. As a result, clients may not be able to access the services for as long as 60 seconds after the listener is started.
So what this means is that when the database starts, and then periodically, it tries to register its service name(s) with the listener; and it gets the info about the listener from the local_listener parameter. (There's also a remote_listener for data guard, not relevant here.)
Because the default is hostname the PC name is used directly in that parameter, and that will often resolve to the PCs LAN IP address (which can change each reboot to add to the confusion, if the IP is assigned by DHCP), which could be stored instead. If you're lucky the hostname will resolve to the same as localhost, but that isn't the case for you.
So... the database looks up its init parameter, and as a result tries to register with a listener at say 192.168.1.2. But the listener has started on localhost so it is listening on 127.0.0.1. The DB fails to register its service name, as it can't reach a listener; though that is only apparent if you look in the alert log. If you run lsnrctl services it won't show anything.
When you change the init parameter you are telling the DB to try to register against a listener on localhost instead - and as that is where it is actually listening, registration now works, and the listener recognises the service name on subsequent connection attempts. (Your question refers to the error message about SID, which is different, and not solved by your change.) Running lsnrctl services will now show the service name too. But that is a runtime, dynamic thing via the registration - not a change to the permanent configuration of the listener.
It's possible to have the listener listen on more than one address. The main thing is that the listener.ora, tnsnames.ora (if you use TNS aliases) and init parameter use consistent host names or IP addresses, so they are all resolving to and referring to the same thing, whether that is localhost (only reachable from that PC), or a LAN address (reachable across the nwtwork) or both.
You can also have an entry in the tnsnames.ora for the listener itself, rather than just for DBs. You can then use that TNS alias as the local_listener target, instead of spelling put the address and port, possibly making it easier to change later if needed.

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.

tnsconnect shows operation timeout

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.

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