Oracle connect via SQL Plus - oracle

I'm using Oracle for learning purposes and faced with problem when I'm trying to connect user in SQL-plus command line.
Error
What is wrong? I did the setup according to the oracle tutorial.
And I have no problem with connection in SQL Developer.

Ok, I'm finally resolve my problem. Thanks to #Umut TEKÄ°N.
In my first setup I edited wrong tnsnames.ora file which was located in another path.
After using tnsping pdborcl command, I saw that oracle is looking for the name of the container(pdborcl) in another folder path W:\oracle\home\homes\OraDB21Home4\network\admin\.
After adding this
PDBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdborcl)
)
)
into W:\oracle\home\homes\OraDB21Home4\network\admin\tnsnames.ora file I can connect without error.

Related

Can't login,ORA-12154: TNS:could not resolve the connect identifier specified

I'm trying to go to PL-SQL Developer, I enter the name of the database, which is on another computer. The result is the following error.
I must say right away that this database is registered in the TNS file, like other databases.
myDB1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ***IP-adress***)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = myDB1)
)
)
What is in the computer's TNS file is also in the client's file. On the host computer, the database works and starts, but not on the client. The database service has started. As I understand it, the client does not need to create a listener, the main thing is that there should be tnsnames.ora. I went through the names and myDBB1, myDBDB, myDataBase and myDB and through dots and spaces its IP address, but the error did not disappear. Other bases on the client computer work without problems.

Crystal Reports fails to find a listener (ORA-12541) when connecting to Oracle 11g Database

Allow me to preface this post by saying I am aware this is a common error code to have and having it appear in Crystal Reports as it tries to connect to an Oracle database, even specifically CR08 connecting to 11gR2 is very well documented on the internet.
I have been troubleshooting on my own for days now and have tried (and list in the post) almost everything, which is why I have decided to create a new post for my case.
I have no education relating to computer technologies and have very little experience with SQL or Oracle, making it sometimes frustrating to read documentation which assumes knowledge of jargon, as I'm constantly googling what things mean. All of my knowledge on the subject is due to the troubleshooting of this issue.
Set-up
Windows 7 Professional SP1, 64-bit installation
Oracle 11g Release 2 Express Edition Database, 32-bit installation
Oracle 11g Release 2 Client, 32-bit installation
Crystal Reports 2008. 32-bit installation (Evaluation Edition, it is licensed on production environment but not here, this should not cause my problem)
PATH system variable points to:
C:\oraclexe\product\11.2.0\client_1\bin;
C:\oraclexe\app\oracle\product\11.2.0\server\bin
TNS_ADMIN system variable points to:
C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
TNS_NAMES system variable points to:
C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
C:\oraclexe is the Oracle Home
What am I trying to do?/The Problem
I need Crystal Reports to successfully connect to an Oracle Database hosted on the same computer. After I have made the connection I can continue my normal scope of work.
I am attempting to connect to the database by following the path of Database > Database Expert > Create New Connection > OLE DB (ADO) > Microsoft OLE DB Provider for Oracle.
I then enter the Service as "xe", the user ID as "system", and the password as "password" (I will write as if that is the system user's password for the rest of this post, it is a randomly generated alphanumeric string). I am returned with an error:ORA-12154.
After some troubleshooting I was able to clear this error, and instead was thrown error:ORA-12541 I explain how I got to here below.
Troubleshooting I've done
Solving ORA-12154:
My first idea was to check that tnsnames.ora actually exists and is configured correctly. Mine is in directory:
"C:\oraclexe\product\11.2.0\client_1\NETWORK\ADMIN" along with listener.ora, sqlnet.ora and 3 other files that use the file extension .bak and seem to be based off sqlnet.or and listener.ora, I do not touch these.
My tnsnames.ora is as follows:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = IEAS-KEAGAN)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
system_xe =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
The top 3 are there by default, I added the last one.
Next came checking my sqlnet.ora and listener.ora files, here they are respectively:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Originally this had no NAMES.DIRECTORY_PATH, I added it.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
This has not been modified since installation, except to change HOST variable from "IEAS-KEAGAN" to "127.0.0.1", 5th line from the bottom.
At this point I began to lost hope, and based on a comment from another user on another post here I decided to next search my disk for ALL instances of tnsnames.ora
I found a "TNSNAMES.ora" in my client_1\NETWORK\ADMIN directory as well, and updated it to match the server's TNSNAMES.ora. This contained no entries before this point, just comments from the installation.
Solving ORA-12541:
This created a different error that appeared at the exact spot as ORA-12154 did, but it now gave the error ORA-12541, TNS:no listener.
This is bizarre as I can execute "tnsping system_xe" in the CMD with no problems (I was also able to do this when ORA-12154 was the thrown error code).
I decided to run "lsnrctl stat" from Documents and Settings>Keaga (my user) and was returned with these results. Obviously these results indicate that my issue is with the "listener".
So, I began somewhere familiar and decided to search for all instances of LISTENER.ora on my C:\ as I did with the tnsnames before.
There are 2 listener.ora file's, the one for my server installation which I quoted already above, and another one located in my client_1\NETWORK\ADMIN directory which contains the contents:
# listener.ora Network Configuration File: C:\oraclexe\product\11.2.0\client_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\oraclexe
After some more searching, I was able to find an old post where someone solves this error by changing "127.0.0.1" to "localhost" when setting the HOST parameter in his listener.ora and tnsnames.ora files. After doing this to both the files in my client and server installations, I tried connected again and was presented with another error at the same step, ORA-12514:
Solving ORA-12514/ORA-12505:
In another old Stack Overflow post, Brad Rippe talks about having this same issue and the fix for him was to make sure "SERVICE_NAME", found in tnsnames.ora, is a valid name in the database. I decided to try this first.
However when I tried to open SQL Developer I also received an ORA-12514 when attempting to connect. "tnsping system_xe" still work's okay, however.
After some frustrating trouble shooting I made it past this step, by adding to the SID_LIST to make a new entry for "xe", SQLPlus is now able to connect to the database, however SQL Developer now throws ORA-12505 when attempting to connect, and Crystal Reports throws ORA-12514 when attempting to connect.
To fix my issue of the listener (Specifically the one Crystal Reports was using) I edited the listener.ora files for both my client and server (note they are on the same machine) to call the host "localhost" instead of "127.0.0.1".
This fixed my issue and brought another issue to my attention which I described in my last edit under "Solving ORA-12514/ORA-12505:". I am currently troubleshooting this issue.

Oracle listener not responding with its IP Address

I come here today after spending two days trying figure out what happened to my oracle server. Here is the situation:
I am running windows server 2016 on a EC2 instance (Amazon AWS). This server is something like a server to test my application running with Oracle, so I basically have my ASP.Net application running on IIS and a Oracle database.
Sometimes I need to connect remotely to this server in order to debug my application with Visual Studio. Therefore, I have oracle client instaled in my machine in order to do this remote connection.
Everything was working just fine until a few weeks ago. Suddenly something happened and I couln't connect remotely anymore. After trying for hours, I decided terminate de EC2 instance and install everything again.
I did that, and now I am facing kind of the same issue. I will post a print screen here, and right after I'll tell what I have tested so far.
Here is the content of the sqlnet.ora file:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
Here is the content of the listener.ora file:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\Administrator\virtual\product\12.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\virtual\product\12.2.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ipaddress)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
Here is the content of the tsnames.ora file:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ipaddress)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xe)
)
)
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = ipaddress)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
My observations:
I don't think this is a firewall issue since the print screen above shows a test inside the server.
I am getting this error "ORA 12 541 TNS: no listener" when I try to connect to Oracle from my machine.
If I try TELNET on port 23 the server responds, but it does not if I try Telnet on 1521 (tried it with the firewall down)
I have configured already the security group on Amazon AWS to accept all trafic
The application running in this same server is still able to connect to Oracle, so I guess I can't say the listener is down.
I ran the command "lsnrctl status" to see if the listener is running:
This is when I run the command "lsnrctl start":
It seems like the problem was not related to any of that things I mentioned.
I openend "Services (services.msc)" and figure there was a Oracle dbconsole service down. I tried to start it, but another error came up. The error was about a folder that Oracle was looking for. Oracle was looking for a folder that was named with the ipaddress plus the service name, something like "/192.168.0.1_XE/"
. However, I checked the path to get to this folder, and I had "/localhost_XE/".
Therefore, to solve this, I simply created a new folder, copied the files from the localhost folder, and pasted in this new one that was named with the IP Address. After that I was able to start the service and everything went back to normal.
The was another thing I did, but I'm not sure if that also helped with the issue. I changed the ipaddress in the "listener.ora" file to "0.0.0.0"

Oracle sql*plus and form build

For a homework, I have to work on SQL*Plus and Form builder. I installed on a vm oracle 11g and dev suites 10g. Everything is a fresh install, but I can't find a way to connect on SQL*Plus not Form builder.
Both are asking for a host string which I'm not sure I have right. My tnsnames.ora looks like this :
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CKRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECTION_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.localdomain)
)
)
I also unlocked the user scott/tiger. I tried to connect with SYSTEM/<password> where <password> I gave on installation and scott/tiger with host string: ORCL, orcl.localdomain or nothing, but it keeps giving me error
ORA-12560 protocol adapter error (no hostring)
or
ORA-12154 could not resolve the connect identifier specified (with not empty hostring).
Forms Builder uses tnsnames.ora found in it's directory, not the one present in the database server's directory.
Ensure the tnsnames.ora contents in Forms builder's folder (present in \network\admin folder of your Forms builder installation path) is the same as the tnsnames.ora present in the \network\admin folder of your database installation path.
You can also force a path to TNS_ADMIN variable and places tnsnames.ora to that path mentioned in TNS_ADMIN so that the tnsnames.ora present in this path is picked
Which SQL*Plus client are you using?
afaik - Oracle stopped distributing the SQL*Plus client and now distribute something called SQL*Plus Instant Client.
If you are using the latter then the correct format of the connect string is as follows:
sqlplus hr/your_password#//mymachine.mydomain:port/MYDB
For anything else - also check your registry for your TNS_ADMIN entry.
This should be populated with the path to you tnsnames.ora

Create a Oracle ODBC DSN with Widows. Entering the port number

I have the following entry in my c:\Oracle\product\11.1.0\network\ADMIN\TNSNAMES.ORA file.
enter code herepvtest.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxx.xxx.xxx)(PORT = 1521))
)
(CONNECT_DATA =
(SID = pvtest)
(SERVER = DEDICATED)
)
)
I could connect successfully using TOAD. Now when I try creating a new ODBC DSN it doesn't allow me to do so. How do I specify the port number in TNS Service Name?
enter code hereGet the following error : ---------------------------
Testing Connection
Unable to connect
SQLState=S1000
[Oracle][ODBC][Ora]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
OK
When you say you could connect with TOAD, can you do so now that the ODBC connection fails? if you can connect with any tool on your client PC than obviously the listener at the other end knows of the service so you have to suspect your end. Probably one client tool is trying to reach PVTEST at a diffrerent location than the other.
If one client tool can connect and the other cannot, first of I would confirm that both clients are using the same tnsnames.ora file. Search your client and see if there are other tnsnames.ora files which would imply other ORACLE_HOMES (Google that if you don't know what it is).
From a command line do a TNSPING and see if it reaches the host. It will also tell about the connection details.
In TOAD check the connection details and ensure it is using a tnsnames connection and if so which tnsnames.
Check if your client has the environment variable TNS_ADMIN set.
I have this kind of block with Oracle XE:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.acme.org)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
If you compare that with yours definition, not that there is "SERVICE_NAME" parameter.

Resources