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)
)
)
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.