SSRS: Oracle TNS:listener error? - oracle

I have a SSRS report which is using Business Object Provider. The dll has a connection with Oracle server. Whenever i run the report i keep on getting this error message:
"Oracle.DataAccess.Client.OracleException ORA-12514: TNS:listener does not currently know of service requested in connect descriptor "
Anyone knows why?

It sounds like you installed the oracle client but have not yet set up your TNS listeners.
There should be a file called "tnsnames.ora" and inside that file you need to add a new listener. If it's a windows install there might also be a network configuration GUI.

A general tnsnames.ora entry would look like this if you choose to go that way:
DBAlias =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xxx)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = YourDBServiceName))
)
Your tnsnames.ora file typically resides in the ORACLE_HOME/network/admin directory.
Technically speaking, you're not "creating a listener", rather, you're defining an alias for an Oracle client network connect string, which will refer to a listener somewhere.
Alternatively, you can specify an EZConnect string, if you don't want to/can't mess with tnsnames.ora entries:
"Data Source=//yourserver:1521/yourDB;User ID=theUser;Password=thePW"
You will need an entry in the sqlnet.ora file to the effect of:
NAMES.DIRECTORY_PATH = (TNSNAMES, EZCONNECT)

Related

Why does Managed ODP.Net demand SERVICE_NAME?

I am migrating a .Net 4.6.2 application from using Microsoft's System.Data.OracleClient to Oracle's own managed ODP.Net (Nuget package, version 12.2.11)for connecting to an Oracle database. I have the Oracle client installed (11gR2) and apart from changing references, using clauses, type names etc the code is pretty much the same. However, whilst my pre-migrate code connects quite happily, the post-migrate will not connect. Instead it throws an OracleException
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA.
The tnsnames.ora file is the same, and the application's connection string is the same, and I have never before needed to specify a service name.
TnsNames.ora:
ORACLEDBSERVER2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = OracleDBServer2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = orcdb10g)
(SERVER = DEDICATED)
)
Connection string:
USER ID=MATTESTNHADMIN;PASSWORD=XXXXX;DATA SOURCE=oracledbserver2
Why is it now demanding a SERVICE NAME? Even if I add a clause to the CONNECT_DATA part (SERVICE_NAME = orcdb10g) I get the same error.
I assume your program does not find the tnsnames.ora file. Unlike the old drivers the ODP.NET managed driver does not read TNS_ADMIN value from the Registy.
See this answer https://stackoverflow.com/a/28283924/3027266 to see how ODP.NET managed driver is looking for tnsnames.ora file.
Note, when you use ODP.NET managed driver then you don't have to install any further Oracle client.

Oracle database 12c networking between client and server machine using TNS

I followed the instructions in the link: https://m.youtube.com/watch?v=ONGz9czAikE
And got to the point of testing a Local Net Name Configuration(8:30) when i got to the point of preforming the test it seems like the window is stuck, same thing happens when i try to connect to the server db with Sql developer there i get a socket timeout error after waiting few minutes.
I'm trying to avoid downloading the oracle client software because of a company long security verification protocol.
What am i missing? Any help will be appreciated.
From here:
Oracle 12c server cannot be accessed from remote computer using the .Net provider
Try using an external IP instead of hostname like so:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.30.50.90)(PORT = 1521))
)
)

How to connect Oracle 11G database using SQL developer from another computer in a LAN connection

I am very new in database and learning Oracle 11G. So, I do not have deep knowledge on it.
I have several computers in my lab connected via LAN. Oracle 11G is installed in computer-A(192.18.100.115). Now I want to use the database from other computers in my Lab via SQL Developer that is installed into all Computers.
Would you please explain
What I need to do in Computer-A for granting access from other Computers?
What I need to do in other computers for getting access from computer-A?
I will be grateful if any one gives me a proper solution.
What I need to do in Computer-A for granting access from other Computers?
You need to make sure the LISTENER is up and running to accept remote connection requests. Listener.ora is a SQL*Net configuration file used to configure Oracle Database Listeners. You will usually find that in ORACLE_HOME\NETWORK\ADMIN directory.
For example,
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0)
(SID_NAME = ORCL)
)
)
As you mentioned your host 192.18.100.115, you need to put it in the hostname.
What I need to do in other computers for getting access from computer-A?
You just need to install Oracle database client. If you only want to connect to the remote DB server, you could install only Instant client.
If you are using SQL Developer, then you could use:
Basic connection type
Or,
TNS connection type
In basic connection type, you need to provide all the connection details in the connection properties itself. For using TNS connection type, you need to configure the tnsnames.ora file present in ORACLE_HOME\NETWORK\ADMIN directory.

Can't create Database Link to remote DB in Oracle-DB

We have a CRM system in our company, which uses an Oracle 11g database. It is developed by a third party vendor.
We do not have access to the server which runs the CRM system. But nevertheless, we have working DBA login data available to us (SYS user). It consists of:
server IP: 172.1.2.3
port: 1521
SID: abc
user: sys
password: *
We can use this to access the DB with Oracle SQL Developer 3.1 (Connections >> Properties)
Now parts of the data must be copied out of the CRM-database into an other Oracle database, which resides on another server.
To my understanding, I'd need to create a database link in my target database. I tried something like this:
CREATE PUBLIC DATABASE LINK xxx CONNECT TO sys IDENTIFIED BY ***** USING 'MYTNSENTRY'
My tnsnames.ora is as follows:
MYTNSENTRY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.1.2.3)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = abc)
)
)
.... and my listener.ora look like this:
MYLISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=172.1.2.3)(PORT=1521))
))
SID_LIST_MYLISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=MYTNSENTRY)
(ORACLE_HOME=C:\somepath) # path to Oracle home of target DB
(PROGRAM=extproc)))
Is PROGRAM=extproc the right choice? There are a couple of other programs to pick. I couldn't even start the listener with lsnrctl because it could not "verify the user" or something. Ironically, the listener-setup and database link to a MS SQL server work smoothly.
Now despite lacking some vital information about the CRM DB system, one can still connect to the DB in SQL Developer. Shouldn't it also be possible to make a connection between two Oracle DBs? Please help me with the setup and the creation of the database link.
----- EDIT: --------
Alex Poole's hint helped me get it to work. I used
show parameters service_names;
to get the full service name. It has the form abc.def, with def being the domain. Thusly, I added the domain name to the TNS alias in tnsnames.ora:
MYTNSENTRY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.1.2.3)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = abc.def)
)
)
The connection can be tested with tnsping MYTNSENTRY on the command prompt of the target DB server. The tnsnames.ora is local. However, I deleted all changes to the "local" listener.ora, since the listener indeed resides on the CRM server.
The SQL command is mostly unchanged, but now the connection works:
CREATE PUBLIC DATABASE LINK xxx CONNECT TO some_user IDENTIFIED BY ***** USING 'MYTNSENTRY'
You've said the SID is abc, but in your tnsnames.ora you've got the SERVICE_NAME in the CONNECT_DATA section. They are not always the same thing - see this question, or this Ask Tom entry. You haven't actually said what error you're getting, but just changing that to SID = might make a difference.
The listener.ora, and indeed the listener, are on the server that hosts the CRM database, not on the one that hosts your 'target' database. As you can connect from SQL Developer that is apparently already configured. The tnsnames.ora does need to be local.
But if you do know the service_name for the CRM database you can skip that and use the EZCONNECT syntax to define everything in the link:
CREATE PUBLIC DATABASE LINK xxx
CONNECT TO non-sys IDENTIFIED BY *****
USING '//172.1.2.3:1521/service_name';
Check your SQL Developer configuration to see if that is already using the service name, rather than SID, and if not you'll need to discover it. If you had access to the CRM server you could use lsnrctl to find the service names that are registered, but as you don't seem to you will need to connect to the database and run show parameters service_names or select value from v$parameter where name = 'service_names';.
You need more privileges to create a public link than a private one, and public is potentially less secure as it exposes your CRM database to anyone on your target one. So I'd only make it public if really needed, and either way connect to a read-only account if you're able to create one.
Also note that if your target database has global_names set to true the database link name has to match the remote service name.
Not only should you NOT connect as SYS unless necessary, you CANNOT connect as SYS over a database link.

Unreliable Oracle connection (intermittent error "Connect failed because target host or object does not exist")

We recently changed physical DB's, new servers, new locations, same database schema and data and since the change over, whenever we try to connect directly to the DB in our own desktop type applications about half of the time we get this error:
SQL*Loader-704: Internal error: ulconnect: OCIServerAttach[0]
ORA-12545: Connect failed because target host or object does not exist
The rest of the time, it connects right away without any issues. Our applications that establish connections via JDBC don't seem to have any issues but we do when going through something that does a tnsnames.ora lookup (or that's my hunch at least). TNSPING works 100% but using an oracle executable like SQLLDDR fails at least 50% of the time. Here's an anonymized snppet of our TSNNAMES file and a TNSPING output:
DB_CONNECTION =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 1.2.3.4)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = MY.URL.COM)
)
)
And the TNSPING:
C:\>TNSPING DB_CONNECTION
TNS Ping Utility for 32-bit Windows: Version 9.2.0.1.0
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\oracle\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 1.2.3.4)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = MY.URL.COM)))
OK (200 msec)
I have the SID of the DB, which is what the JDBC connections rely on but adding it to the tnsnames.ora doesn't improve the odds of making a connection. I don't know enough about how the tnsnames file is being used by Oracle to intelligently resolve this issue. What can I try?
Edit
The new DB's may be two load balanced databases which may be part of the problem.
We recently had a similar issue with our application. The application would sometimes connect to the Oracle RAC and sometimes it would complain with ORA-12545.
In short the issue was that the server had a real name while we were using virtual IP addresses in TNSNAMES.ORA. Once we added the mapping of the server name to IP address via system32\drivers\etc\hosts file everything started to work properly.
I have written a bit more in my blog
<shameless advert>http://dcarapic.blogspot.com/2009/04/intermittent-ora-12545-error.html</shameless advert>
Ah, gotta love the intermittent problems :)
(In the following I have had to replace the underscore character as I don't know the escape char for this wiki language)
Are you always using the same OS user to connect and to do the tnsping?
Check for environment variables TNS[underscore]ADMIN pointing to different tnsnames.ora locations. Do a scan of the client for duplicate tnsnames.ora; either in locations pointed to by $TNS[underscore]ADMIN or in different $ORACLE[underscore]HOMES (e.g. if you have 2 Oracle client installs).
Likewise check that you are using the same $ORACLE[underscore]HOME and $PATH environment variables for all connection attempts and tnsping. (E.g. always the same OS user or each user has the same values)
I see that the tnsping output reports version 9.2 so this is not likely, but in 11g the DB registers with the listener which can take a minute or so. (maybe also true with 10g). Attempts to connect prior to this will not find the target.
Another unlikely possibility - is a service with the same service name still advertised on the old host server? Remove it if at all possible.
After that I would start to look at the network itself. Is a ping of the server always successful and quick? If you're using the hostname rather than IP in the tnsnames.ora, does the hostname reliably resolve to the correct IP (nslookup). Is there a local firewall and if so is it behaving?
Regards
Karl
If you are using Oracle 10g, you may use an Easy Connect handler instead:
//servername/instancename
,
//1.2.3.4/my.url.com
in your case.
It's immune to lots of TNSNAMES issues.

Resources