Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
14.6k views
in SQL Server Reporting Services by 12 12 19

In SSRS, I got this error "ORA-12504: TNS: listener was not given the SERVICE_NAME in CONNECT_DATA" when I tried to create a new Data Source in Report Builder to connect to Oracle Database.

SSRS ORA-12504 TNS listener was not given the SERVICE_NAME in CONNECT_DATA

I have installed and configured the Oracle Data Access and followd all instructions at

But I am still facing the same error "ORA-12504: TNS: listener was not given the SERVICE_NAME in CONNECT_DATA"! 


1 Answer

1 like 0 dislike
by 159 189 376
selected by
 
Best answer

This error "ORA-12504: TNS: listener was not given the SERVICE_NAME in CONNECT_DATA" usually occurs if the Connection properties are not structured correctly in the tnsnames.ora configuration file.

The tnsnames.ora file is a configuration file that contains network service names mapped to connect descriptors for the local naming method, or net service names mapped to listener protocol addresses.

In the tnsnames.ora file, you have to make sure that Connection Alias is structured as the following:

Alias=
   (DESCRIPTION =
      (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ServerIP) (PORT = 1521))
     )
      (CONNECT_DATA =
      (SERVICE_NAME =ServiceName)
    )
  )

tnsnames.ora file struture

The tnsnames.ora file has the following sections:

  • DESCRIPTION contains the connect descriptor,
  • ADDRESS contains the protocol address, and
  • CONNECT_DATA contains the database service identification information, it defines the service to which to connect, such as SERVICE_NAME.

Also, you have to set the following three parameters correctly as the following:

  • Alias: the server hostname or any meaning name as you prefer.
  • HOST: the Oracle DB Server IP or Oracle Server HostName.
  • SERVICE_NAME: Oracle Database Service.

Learn more about tnsnames.ora paramters at Local Naming Parameters in the tnsnames.ora File

So, in your case, you may get this error "ORA-12504: TNS: listener was not given the SERVICE_NAME in CONNECT_DATA" because of the tnsnames.ora file is not structured properly as shown above and the (SERVICE_NAME =ServiceName) does not exist inside the CONNECT_DATA.

So just make sure that you have configured the tnsnames.ora file properly as mentioned at

Note: after changing the tnsnames.ora configuration file, you may need to close and reopen the Report Builder again.

If you don’t ask, the answer is always NO!
...