Able to connect through CMD but not to Oracle SQL developer to Oracle DB - oracle

So I got connected to Oracle 11g in cmd as follows
However, when I type the same username and password in Oracle SQL Developer, it does not work. And I have uname and pwd, what goes in the connection name?
This what I got, when i entered a connection name and My uname and PWD
Oracle SQL Developer

Just give any string in your connection name, that is used for identify different connection in sql developer.
Like,
Connection name : Connection_1
username : system
password : yourpass
If you want to create another connection to another database or another schema then you have to give another name and by login you can directly access that particular schema.
Hope it will help.

I think the issue might be that SQL Developer uses a different tnsnames.ora file. The file can be set under:
Tools>Preferences>Database>Advanced
Choose the correct tnsnames directory there.
Depending on your developer version, you might also want to set the Oracle Client folder.
After that in your connection dialog choose TNS instead of BASIC. And pick the tnsalias name from the list from the file.
Let me know if that works.

I also faced the same issue and after trying series of steps came to this conclusion.
1)Make sure to follow the blog to install the DB and check the validation steps too :
https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/Windows_DB_Install_OBE/Installing_Oracle_Db12c_Windows.html
This blog makes sure that you are able to connect to SQL via CMD.
2) If you still face issue while connecting to SQL developer for the same configuration,check : Advanced system settings-->Environment variables-->system variables--> PATH
Make sure you have entry for the DB here.
Environment variable for DB
3) If above step is a success,check the tnsnames.ora and listener.ora files present in the location : dbhome_1\network\admin
These files should have a valid entry for the localhost and SID/service name.
Thanks,
Sandeep

Related

Oracle JDBC-URL with LDAP to OLE DB connect string - how?

I've got a JDBC-URL like such to connect to an Oracle 12c database:
jdbc:oracle:thin:#ldap://oraldap:389/thisdb,cn=OracleContext,dc=world
As can be seen, connection happens through LDAP.
Now I want to connect to same database via "Oracle Provider for OLE DB". Question is, what should I enter as data source here? Tried "ldap://oraldap:389/thisdb,cn=OracleContext,dc=world" - but this naturally didn't work. As far as I understand, I could enter a TNS-string like (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)))- but I didn't gather how to represent the ldap-part.
What's the way to do this?
Ok, solved - I needed to have the tns-configuration files from Oracle. So namely it is the files ldap.ora, sqlnet.ora and tnsnames.ora which I put into a specific folder plus creating the environment variable TNS_ADMIN. For connecting through OLE_DB I enter the database name as data source - and it works!

How to see all connector identifiers?

I'm following environment setup guide for my project and there is .bat file with following commands:
sqlplus system/oracle#demo12c #keystorecreate.sql
I'm getting the following error after running the file:
ORA-12154: TNS:could not resolve the connect identifier specified
How to see all connection identifiers to see which one I can use?
demo12c is alias of the database you're connecting to. You should find its entry in the TNSNAMES.ORA file. I don't have 12c version, but - in prior versions - it is (by default) located in the \network\admin directory. For example, for 11gXE, it is something like this:
C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
I presume Oracle didn't change that, so - have a look.
It appears that you won't find demo12c in there. Review the steps described in the environment setup you mentioned; it should mention it, somewhere.
By the way, have you already installed the database? No problem if all of you use the same copy of the database, while each of you has his/her own schema to work with (schema = user and all its objects; it is identified by its name ("username") and a password - the first two parameters you used in the connect string).

ORA-02019: connection description for remote database not found

I have created a db link AM_ADMIN through SQL Developer:
I am trying to check if it is a valid database link. When I test it from the SQL Developer wizard it is successful. But when I use the below command:
SELECT * FROM dual#AM_ADMIN
I'm getting the error:
ORA-02019: connection description for remote database not found
How can I rectify this error?
According to your screenshot you created the database link as AM_ADMIN.INT.xxx. You are calling it without the domain, just as #AM_ADMIN. Unless you have a sqlnet.ora which defines names.default_domain with the same domain value (and have SQL Developer configured to recognise that), you will need to fully-quality the link name when you use it:
SELECT * FROM dual#AM_ADMIN.INT.xxx
This error will occur when a database link is not made PUBLIC, and the user who created the link is different to the user attempting to use the link. For example, creating the link as the SYS user and then trying to use the link as the AM_ADMIN user.
In this instance either make the link PUBLIC (which all users can then access), or grant the AM_ADMIN user the privileges to create a database link.
I had the same problem and I found out that it was a stupid error caused by (Description = (... HOST = !...). When you create Database Link in USING clause, you should:
use the keyword HOST if you are using the IP address
use keyword HOSTNAME if you are using the name
I just wanted to share it because I lost half a day trying to figure that out and I couldn't find any information about it...

Oracle XE 11g (windows 8) I can't connect to the Database (idle instance)

Hi I have problem with idle instance
When I trying:
sqlplus / as sysdba
I get result: Connected to an idle instance.
And when I try startup I get:
ORA-01078: failure in processing system parameters
ORA-01565 error in identifying file 'C:\oraclexe\app\oracle\product\11.2.0\server\dbs/spfileXE.ora
ORA-27041: unable to open file
ORA-04002: unable to open file
O/S-Error: (OS 2) File not found;
My system is Windows 8. Do you any idea how to solve it?
SOLUTION:
I have to startup using command:
startup pfile='<path to file>/init.ora'
and change all paths in init.ora where was
<ORACLE_BASE>
Thx for help
I've got that pain too.
To install Oracle XE you should login as local admin - NOT domain account.
This https://community.oracle.com/thread/2361291 made me happy :)
I just had the same problem.
You just have to start the setup to install the database as administrator.
After this and a reboot everything works fine.
I highly recommend reading the Oracle® Database 2 Day DBA manual, or hire a dba.
You are missing the init{ORACLE_SID}.ora, the parameter file which contains things like database name, controlfile locations. the init{ORACLE_SID}.ora is a text file that is edited with a regular text editor. This file can be converted to a spfile{ORACLE_SID}.ora that can be edited using a database instance. This is also a dynamic parameter file meaning that when you change parameters in an instance, the parameters can also be recorded in the spfile for later reuse.
For now add the db_name and control_files. Make sure that the contol_files parameter points to an existing controlfile[s]. If there are no existing control_file[s], just trash the initXE.ora, spfileXE.ora and start dbca, the Database Configuration Assistant and using that create a new database.

Oracle ORA-12154: TNS: Could not resolve service name Error?

I am a SQL Server user .
I am on a project that is using oracle (which I rarely use)
I need to create an ODBC connection so I can access the some data via MS Access
I have a application on my machine called oraHome90. It seems to allow a configuration of something called a listener in a “net configuration utility”, I think that a “Local Net Service Name Configuration” needs to also be done. The IT support gave me this information to set up the ODBC connection . I have tried every combination that I can think of. I can get past a test that successfully passes a test to “login“ to the oracle server database. When I try to create the ODBC connection I get the following error: ORA-12154: TNS: Could not resolve service name.
Assuming that I want to start from scratch and the following information is supposed to allow for me to connect to the database….. Any suggestions or comment ? Note: ultimately the project will have a website .ASP page query the data, but I have to first prove that I can see the data using the ODBC connection via MS Access
Service name: SERVICENAME
HOST = HOST.XYZi.com
User Id: MYUSERID
Password: MYPASSWORD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'Oracle Connection
Dim ocst
Dim oconn
ocst = "Provider=OraOLEDB.Oracle;" & _
"Data Source=DATASOURCE;" & _
"User ID=CHIJXL;" & _
"Password=password;"
set oconn = CreateObject("ADODB.Connection")
from http://ora-12154.ora-code.com
ORA-12154: TNS:could not resolve the connect identifier specified
Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
Action:
If you are using local naming (TNSNAMES.ORA file):
Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)
Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.
Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.
Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.
If you are using directory naming:
Verify that "LDAP" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
Verify that the LDAP directory server is up and that it is accessible.
Verify that the net service name or database name used as the connect identifier is configured in the directory.
Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier
If you are using easy connect naming:
Verify that "EZCONNECT" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
Make sure the host, port and service name specified are correct.
Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.
Going on the assumption you're using TNSNAMES naming, here's a couple of things to do:
Create/modify the tnsnames.ora file in the network/admin subdirectory associated with OraHome90 to include an entry for your oracle database:
> SERVICENAME_alias =
> (DESCRIPTION =
> (ADDRESS = (PROTOCOL = TCP)(HOST = HOST.XYZi.com)(PORT = 1521))
> (CONNECT_DATA = (SERVICE_NAME = SERVICENAME))
This is assuming you're using the standard Oracle port of 1521. Note that servicename_alias can be any name you want to use on the local system. You may also find that you need to specify (SID = SERVICENAME) instead of (SERVICENAME=SERVICENAME).
Execute tnsping servicename_alias to verify connectivity. Get this working before going any further. This will tell you if you're past the 12154 error.
Assuming a good connection, create an ODBC DSN using the control panel, specifying the ODBC driver for Oracle of your choice (generally there's a Microsoft ODBC driver at least, and it should work adequately as a proof of concept). I'll assume the name you gave of DATASOURCE. Use the servicename_alias as the Server name in the ODBC configuration.
At this point you should be able to connect to your database via Access. I am not a VB programmer, but I know you should be able to go to File->Get External Data->Link Tables and connect to your ODBC source. I would assume your code would work as well.
In reference to #7 in this MSDN POST , adding a registry entry worked for me. I had Vs2010, et oracle 11.0 installed.
Check for the registry key “TNS_ADMIN” at HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE. If it exists then make sure it has
the right value as “Dir:\app\product\11.1.0\client_1\network\admin”.
If you don’t see the key then create the key and set appropriate value
as below. Regedit->HKEY_LOCAL_MACHINE->Software->Oracle->RightClick
NEW->StringValue and name it TNS_ADMIN and give the value
“X:\app\product\11.1.0\client_1\network\admin”
I struggled to resolve this problem for hours until I found an Environment variable called TNS_ADMIN set in My Computer => Properties => Advanced => Environment Variables => look in System variables for an entry called TNS_ADMIN.
TNS_ADMIN is added to change the default path for Tnsnames.ora entry.
This is useful when its used in a network environment where a generic tnsnames.ora entry can be setup for all the network computers.
To look at the default path of tnsnames.ora add the default path in TNS_ADMIN.
#Warren and #DCookie have covered the solution, one thing to emphasise is the use of tnsping. You can use this to prove your TNSNames is correct before attempting to connect.
Once you have set up tnsnames correctly you could use ODBC or try TOra which will use your native oracle connection. TOra or something similar (TOAD, SQL*Plus etc) will prove invaluable in debugging and improving your SQL.
Last but not least when you eventually connect with ASP.net remember that you can use the Oracle data connection libraries. See Oracle.com for a host of resources.
If there is a space in the beginning of the tns name define in file tnsnames.ora, then some of the the connectors like odbc may give this error. Remove space character in the beginning.
It has nothing to do with a space embedded in the folder structure.
I had the same problem. But when I created an environmental variable (defined both at the system- and user-level) called TNS_HOME and made it to point to the folder where TNSNAMES.ORA existed, the problem was resolved. Voila!
venki
Arrhhh!! I RAN INTO THIS AGAIN!!!
Just install ToadForOracle in C:\ or any directory without parenthesis in the path.
In my case its because I was on a x64 PC and still using the old Oracle 9i with the 32bit drivers!
I am using SQL Reporting Services with an Oracle Database. The problem is the brackets in the path to Visual Studio (BIDS). Oracle doesn't like apps that start in a path with brackets:
RDBMS 10g XE problem with parenthesis in path
So I made a BAT file to open Visual Studio with Progra~2 as the short path name for "Program Files (x86)".
Here is the contents of the BAT file:
rem Progra~2 is short path name for "Program Files (x86)" and works around an Oracle client bug that doesn't like the ()'s in the path
start /B "C:\Progra~2\Microsoft Visual Studio 9.0\Common7\IDE" "C:\Progra~2\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
I name this BAT file StartBIDS.BAT and put it in the directory:
"C:\Program Files\Microsoft SQL Server\Start BIDS.bat"
Then I make a short cut to the BAT file on my Desktop and also my Start Menu and change the ShortCuts icon. This allows me to open TOAD, Visual Studio, BIDS and etc apps that I use to work with Oracle.
Update:
Alternatively make a Junction:
mklink /J "C:\Program Files (x86)\" "C:\Program Files x86\"
Then remove the brackets in the shortcut:
I experienced this problem too. I discovered the problem is because Oracle DB does not like the space in C:program files (x86)\Toad...... so I created a new directory named C:App\Toad then reinstalled in it to connect Toad to Oracle. It worked.
This was mentioned in a comment to another answer, but I wanted to move it to an actual answer since this was also the problem in my case and I would have upvoted it if it had been an answer.
I'm on Linux and the tnsnames.ora file was not set to readable by everyone. After making it readable connecting via tns locally worked.
$ chmod +r tnsnames.ora
I had a same problem and the same error was showing up. my TNSNAMES:ORA file was also good to go but apparently there was a problem due to firewall blocking the access. SO a good tip would be to make sure that firewall is not blocking the access to the datasource.
I fixed this problem using this steps.
First of all, this error occured , if you didn't install same directory or drive.
But the answer is here.
Login windows as a Adminstrator.
Go to Control Panel.
System Properties and click Enviroment
Find the OS variable and change name as a "TNS_ADMIN"
And change the value as a "tnsnames's directory address"
Restart the system.
Congrulations.
I have resolved this issue by removing sqlnet.ora from the C:\oracle\ora92\network\ADMIN path
Make sure TNSNAMES.ORA file exists in the right directory
Make sure PATH environment variable is having entry for oracle
Make sure no syntax issues in the TNSNAMES.ORA
Try removing sqlnet.ora file
Hours of problems SOLVED. I had installed the Beta Entity Framework for Oracle and in in visual studio 2010 MVC 3 project I was referencing under the tab .NET the Oracle.DataAccess ... This kept giving me the "Oracle ORA-12154: TNS: Could not..." error. I finally just browsed to the previous Oracle install under c:\Oracle\product.... using the old 10.2.0.100 version of the dll. Finally it works now. Hope it helps someone else.
I just spend an hour on this, I'm new to Oracle so i was thoroughly confused..
the situation:
just installed visual studio 2012 Oracle developer tools. When i did this I lost the items in my drop down which contained my TNS entries in TOAD. I was getting this error from Visual studio AND TOAD!! WTH! so i added the environmental Variable TNS_ADMIN under "ALL USERS" with the path to my .ora file (which i now worked fine because it worked until I broke it). Toad picked up that change. Still Visual Studio wouldn't give me any love... still getting same error. THEN, i added the environmental Variable TO MY USER VARIABLES.. VIOLA!!
ENSURE THE ENVIRONMENTAL VARIABLES ARE SET FOR THE SYSTEM AND THE USER
Only restart the SID services. For example you SID name = orcl then all the services which related to orcl should be restart then you problem will be solved
We resolved our issues by re-installing the Oracle Database Client. Somehow the installation wasn't successful on 1 of the workstations (even though there was no logging), however when comparing size/files/folders of the Oracle directory to a working client workstation, there was a significant amount of files that were missing. Once we performed a clean install, everything worked perfectly.
In my case, the error are because I have 2 Oracle clients, It's the solution:
Oracle ORA-12154 error on local IIS, but not with Visual Studio Development Server
We also had the similar issue. What we found out that we had provided multiple aliases for our connection string in tnsnames.ora, something like:
svc01, svc02=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxx)(port=50))(CONNECT_DATA=(SERVER=DEDICATED)(service_name=yyyysvc.world)))
so when creating a connection using ODBC, when we selected the value for TNS service name, the auto populate was showing 'svc01,' (please note the extra comma there). As soon as we removed the comma, it started working for us.
If you have a 32bit DSN and a 64bit DSN with same names, Windows will automatically choose the 64bit one and If your application is 32bit it shows this error. Just watch out for that.
I had this problem because of a typo in the filename tsnames.ora instead of tnsnames.ora
This error message can be very confusing and the solution can be surprisingly primitive.
In my case: Oracle stored procedure sends recordset to MS Excel via "Provider=OraOLEDB.Oracle;Data Source= ...etc" .
The problem was a number of decimal numbers in the Oracle data column sent to Excel 2010.
When I used Oracle SQL query ROUND(grosssales_eur,2) AS grosssales_eur, it worked fine.

Resources