Error in Toad - ora 12154 - oracle

I am trying to make a connection using Toad to a database (xe10 free edition) and it givea me a error:
ORA-12154
I tried changing the sqlnetORA to:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
and still the same error.

1st check to make sure you can ping the database, if yes move to next step if not resolve firewall/network issues.
2nd check to see if you can connect via SQL*plus. If you can connect with SQL+ then your TNS is fine and Toad seems to be the issue, if you cannot then there is an issue with your TNS file.
Be sure to try and connect directly using the following method:
In Toad click "Session" > "New Connection"
There are 3 options TNS, Direct, LDAP (Shown as Tabs) . Select "Direct"
User: sys
Password : <passwd>
Host: 127.0.0.1
Port: 1521
Service Name: XE
Connect as: SYSDBA
If you are unable to connect via SQL+ or Toad then fix your .tns, I have attached a few helpful links below which should help resolve your problem.
http://www.dba-oracle.com/t_ora_12154_tns_resolve_service_name.htm
http://www.orafaq.com/wiki/Tnsnames.ora

try to comment the following line in sqlnet.ora
#names.default_domain = world
otherwise, Oracle will append .world to your host string

Often, it's a typographical error in your connexion string or in your tnsnames.ora file. More information here : 11g/ORA-12154.

Related

I am able to connect to Oracle Db using Toad but connection using sqlplus is not working. Getting TNS timeout error

I am able to connect to Oracle DB using Toad with Datasource name and username/password. Oracle client 12 as Oracle driver. oracle database path is set properly in the environment variables. sqlnet.ora, listener.ora and tnsnames.ora is present in ORACLE\ORANT\NETWORK\ADMIN folder and configured properly. I tried to query using Sqlplus in cmd prompt using following command:
connect User/pass#dw-prod.server.int:1527/pdw1s_servicename
I am getting ORA-12170: TNS Connect timeout error. Please help.
In SQL*Plus, just need to connect using the TNS alias.
connect user/password#tns_alias
If your password contains specific characters like # or ! probably you are getting the error for this

"ORA-12154:TNS:could not resolve the connect identifier specified" on Mac in SQL Developer

Connecting through Oracle SQL Developer(version 18.2.0.183) using wallet files(cwallet.sso and ewallet.p12) we are getting the following error “ORA-12154:TNS:could not resolve the connect identifier specified “when we test the connection via Advanced connection type in SQL Developer. We are using “jdbc:oracle:oci:/#NAME”. We are able to connect using SQLPLUS using “sqlplus /#NAME”. This is on a Mac(High Sierra) with the Instant Client Version 12.2.0.1.0.
https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
We have the TNSNAMES.ora and SQLNET.ora files configured and the wallet is set and working fine with SQLPLUS.
Is there anything we should look at to troubleshoot this further? Or any workarounds you might suggest?
Thanks,
Tom
Same advice I gave on the OTN forums -
make sure SQL Developer is reading the TNSNAMES file you think it is.
show tns
connect hr/oracle#orcl -- execute in a sqlworksheet with F5
TNS Lookup locations
--------------------
1. USER Home dir
C:\Users\jdsmith
Location used:
-------------
C:\Users\jdsmith
Available TNS Entries
---------------------
LISTENER_ORCL12C
ORCL
ORCL12C
Connected.
Connection created by CONNECT script command disconnected
If that fails, try EZCONNECT syntax
connect hr/oracle#server:port/SID
Also, there is a TNS connection type you can use. If OCI is enabled in preferences, your connection will be 'thick' and use sqlnet and tnsnames ora files.

How to connect SQLPlus with tnsnames.ora

I want to connect with my Oracle database without installing Oracle Client.
I downloaded:
"Instant Client Package - Basic" and
"Instant Client Package - SQL*Plus"
Then I created folder on C:\Oracle\instantclient, where I extracted all packages.
I have been set system environment like:
Path - C:\Oracle\instantclient
NSL_LANG - with properly key
ORACLE_HOME - C:\Oracle\instantclient
ORACLE_SID - C:\Oracle\instantclient
TNS_ADMIN - C:\Oracle\instantclient
Then I created tnsnames.ora file with configuration in C:\Oracle\instantclient
and when I puted a command to cmd:
sqlplus user/password #HOST
I have a message like:
ERROR:
ORA-12560: TNS:protocol adapter error
but when I tried like:
sqlplus user/password#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=address to host)(Port=1521))(CONNECT_DATA=(SID=address to SID)))
everything works properly. Why SQL have a problem with recognize tnsnames.ora file?
Your command should be:
sqlplus user/password#HOST
with no space between the password and #HOST part.
With the space it treats the #HOST as a script to execute once you've logged in, and it tries to connect locally, which produced that TNS error. (As you don't log in the HOST isn't ever evaluated to establish if it exists, so it's effectively noise at this point).
C:\>sqlplus -l -s x/y #HOST
ERROR:
ORA-12560: TNS:protocol adapter error
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
With the space removed it looks for HOST as a TNS alias:
C:\>sqlplus -l -s x/y#HOST
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
For me that still gets an error since I don't have HOST in my tnsnames.ora, but it's a different error and you can see it's at least trying to use it as a TNS alias. If you have it defined properly it will be able to connect to your database.
NEVER edit $ORACLE_HOME/network/admin/tnsname.ora manually, use "netmr" to create Local Name.
Don't know why it's same but do not work.
This commando works fine for me:
sqlplus /nolog
connect username/password#hostname:port/SERVICENAME

How can I solve "Got minus one from a read call" in oracle sql developer?

When I run the sql developer and set the all data,click the connect but i get this error:
Status : Failure -Test failed: IO Error: Got minus one from a read call
I am beginner in Oracle. How can I solve that error?
I use 64-bit Windows7 and oracle 12c.
In my case the error is connected to a problem about the client's (SQL Developer) ojdbc8 driver and the Oracle 19.3 docker container. The solution for me was to set a system property on the client -- you can do it within the JDBC connection string):
jdbc:oracle:thin:#tcp://host:port/service?oracle.net.disableOob=true
This is the thread that lead me to the answer.
The cause of the error is described here:
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=357910144923387
You can also solve this problem by dissabling OOB on server side in the sqlnet.ora:
DISABLE_OOB=ON
Another workaround is to use the ojdbc7 driver.
Hope this helps some of us.
From your inputs in the dialog, you are using port 5500. That port is what is used for EM Express. It answers to HTTPs traffic only. So in this case the -1 error message means the protocol negotiation failed. SQLDEV is trying to talk SQL*NET to something listening for HTTPs.
The port you are looking for is 1521 if it wasn't altered. If it was check the $ORACLE_HOME/network/admin/listener.ora for the proper port number.
You need set "tcp.validnode_checking = no" or comment this parameter in sqlnet.ora file then restart listener on db server and test again.
Try it.
I got the same issue but following steps worked for me, it seems Gaurav also has shared it already:
1.Go to the folder where you have installed the database (Like: F:\app)
2.Here you will be able to see many folders, go to product\11.2.0("your databse version")\dbhome_1\NETWORK\ADMIN
3.find listener.ora file and open as text file
4.Check for the port number in that file
5.Now provide that port number while doing connection in sql developer.
Seems you have enabled ACL on the listener.
You can follow these steps to avoid the error:
1. Go to directory $ORACLE_HOME/network/admin
2. Modify sqlnet.ora file with following parameter:
tcp.validnode_checking = no
3. If you don't want to disable this, you can put the machine names as follows:
tcp.invited_nodes=(machine1, machine2)
3. Bounce the listener.
Hope that helps
Ensure the DB is up and running and you can connect locally AS SYSDBA to the database using Oracle binaries owner (usually oracle:oinstall Unix / Linux user). If it does not work, probably you encounter a different problem.
Check privileges of an Oracle file on Unix / Linux host where database is running:
cd $ORACLE_HOME/bin
ls -ltr oracle
-rwxr-xr-x 1 oracle oinstall 136803483 Mar 16 20:32 oracle
Change permissions as below:
chmod 6751 oracle
ls -ltr oracle
-rwsr-s--x 1 oracle oinstall 136803483 Mar 16 20:32 oracle
Most of the answers out there for this problem point to using the wrong PORT number in your connection options, or similar. In my case, after a couple hours of searching, the reason showed to be something else.
Mind which user you are using when starting Oracle listener. You should do it with the oracle user, not as root. Otherwise you end up with listener files being created as e.g. user deamon group root instead of user oracle group dba. This in turn leads to:
TNS-12555: TNS:permission denied
TNS-12560: TNS:protocol adapter error
TNS-00525: Insufficient privilege for operation
Linux Error: 1: Operation not permitted
To check whether this is the case, go to
/var/tmp/.oracle
and list all files (ls -la). If you find out some of the s#* files being created by a root-group user, stop the listener (lsnrctl stop), delete the above files as root and restart the listener as oracle user.
Unfortunately sqldeveloper doesn't show the full stack-trace when reading "Got minus one from a read call". I could find the problem thanks to switching to SQL-Squirrel.
In my case, I was given wrong host and port. I typed "tnsping yourServiceName" in command line in window 10. It returns a different host and port, then I used the correct one in sql developer and it worked.
In my case, it happened when I was using Docker with Oracle 19C.
The workaround is to find the listener.ora file, change 'PORT' and restart the container, ORACLE DB, listener.
It is presumed to be an error that occurred when the host tried to access TCP because it was already LISENT (HOST) by another process.
(When accessing Docker, consider that in most cases, you are accessing localhost.)
I changed the port to 1523, and all the problems were solved.
Try to do what the link , or check listener directory permission, or use command /dbhome/bin/relink all
Try
Connection name: HR_ORCL
Username: HR ,
Password: hr ,
Connection type : local,
Role: SYSDBA
Click on connect.
It will work.
Actually, It is not database specific issue. it is related to port value generated by database during your installation. To overcome on this issue, please follow below.
Go to the folder where you have installed the database (Like: F:\app)
Here you will be able to see many folders, go to product\11.2.0("your databse version")\dbhome_1\NETWORK\ADMIN
find listener.ora file and open as text file
Check for the port number in that file
Now provide that port number while doing connection in sql developer.
Hope it will resolve your issue.

How to find Oracle database connection details

I am new to Oracle DB and have created a new Oracle 12c database. I am creating a new connection through SQLDeveloper and where can I get the connection details? HostName? Port? SID?
I tried connecting using default details given in documentation but got the below error
Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor>
You really need to give more info if you need help :)
What Server are you using? Linux? Windows?
Post your oratab file (/etc/oratab)
Post your TNS file ($ORACLE_HOME/network/admin/tnsnames.ora)
Post your Listener file ($ORACLE_HOME/network/admin/listener.ora)
Assuming you're using Linux :D
You need to look at the file "/etc/oratab" if you're on Linux.
This will contain your SID.
Your TNS (located in $ORACLE_HOME/network/admin/) should contain the TNS Entry with SID as per your oratab file.
This is an example entry you will find in the oratab file:
orcl:/opt/oracle/product/10.2.0/db_1:Y
The let hand side "orcl" is your SID, and you will use this for your SID in the Oracle TNS.
If you find that your TNS is configured correctly, then the error message you provided may also indicate that your Database was not registered to the Listener.
You may connect to the sql database as follows:
Set your Oracle Environment
$ . oraenv
Prompts for SID: Enter the value "orcl" (if this is your SID?)
now login:
$ sqlplus / as sysdba
This will log you into oracle as a sysdba.
Execute the follwing:
SQL> Alter System Register;
You should notice a confirmation message that the system is altered.
now exit SQLplus, and try again
SQL> exit
On Windows ISTR, to get the SID, look at the running processes and you should see something called "oracleXXX.exe" or similar. The XXX will be your SID.
You should also see a "TNS" or "Listener" process, probably with the same "XXX".
To get the port number, (usually 1521-1526), find the folder where Oracle was installed to "the "Oracle Home") and in there go to the "network\admin" folder. You should see a "listener.ora" file in there, and if you view this is notepad you should be able to figure out what the port is set to.
This file should also tell you what host/network address the listener is attaching to - you use this IP as the "Hostname" in you connection. Sometimes (again I'm a bit cloudy with Oracle on Windows) the listener.ora might be named listnereXXX.ora, with XXX matching the value you will have seen in SID the checks above.
Obviously if you are new to Oracle, do not amend these files.
If you have netstat/wireshark or similar you can see what the port is attached to the TNS/Listener process.
If you have installed it on same machine on which you are running sql-developer then
host: 127.0.0.1
port: 1521
username and password same as you put while installing oracle datatabse.
keep sid blank

Resources