First of all, I've Google'ed the Oracle error to death w/o any luck of getting any of the suggestions to work...
We have Oracle running on several servers and just got it installed on a new server. But when trying to run sqlplus as system user, we get the error:
Obviously the first thing I did was look in our tnsnames.ora to make sure the SERVICE_NAME parameter was in there properly:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
(FYI the server name is Borg. Oracle is running on Borg and I'm trying to connect to it locally. This is Oracle 11g Release 2 (126.96.36.199.0)).
And here is listener.ora
(ADDRESS = (PROTOCOL = TCP)(HOST = borg)(PORT = 1521))
(SERVER = DEDICATED)
(SERVICE_NAME = BORG)
Okay so clearly tnsnames.ora is NOT missing the SERVICE_NAME in CONNECT_DATA. It's there and it looks correct to me.
(ADDRESS = (PROTOCOL = TCP)(HOST = BORG)(PORT = 1521))
(SID_NAME = BORG)
(GLOBAL_DBNAME = BORG)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
ADR_BASE_LISTENER = /u01/app/oracle
When researching the error the suggested CAUSE is this:
and the suggested ACTION is this:
The listener was not configured with a default service and SERVICE_NAME was missing from the CONNECT_DATA received by the listener.
So let me take those solutions one a time:
Possible solutions are:
- Configure DEFAULT_SERVICE parameter in LISTENER.ORA with a valid service name. Reload the listener parameter file using reload . This should be done by the LISTENER administrator.
- If using a service name, Check that the connect descriptor corresponding to the service name in TNSNAMES.ORA has a SERVICE_NAME or SID component in the CONNECT_DATA.
1. I've looked all over the place, even in at the listener.ora in the SAMPLES directory and I don't see anywhere that shows the DEFAULT_SERVICE parameter and how it is used or where to place it in the listener.ora. Does anyone know anything about this? It's suggested to do this in a million places but no where does it say where EXACTLY to place this parameter.
2. As I've already said, my tnsnames.ora already has the SERVICE_NAME in the CONNECT_DATA.
So does anyone have any clues here?