Skip to Main Content
  • Questions
  • How to register a "service" with a listener without using local_listener

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, John.

Asked: July 08, 2016 - 6:03 pm UTC

Last updated: July 11, 2016 - 12:51 am UTC

Version: 11.2

Viewed 50K+ times! This question is

You Asked

Hello

I create a service like so:

exec dbms_service.create_service('MYSERVICE','MYSERVICE');
exec dbms_service.start_service('MYSERVICE');

Then, I add the service in the listener.ora sid_list parameter like so:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = oem)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = MYSERVICE)
)
(SID_DESC =
(GLOBAL_DBNAME = Oracle8)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = ORCL)
)
)

Then I start the listener:

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1527)))
Services Summary...
Service "Oracle8" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "oem" has 1 instance(s).
Instance "MYSERVICE", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

Then, I add the entry in tnsnames:
test =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1527))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = MYSERVICE)
)
)

Finally, I get the error:

[oracle@localhost ~]$ sqlplus jcantu/jcantu@test

SQL*Plus: Release 11.2.0.4.0 Production on Fri Jul 8 11:02:30 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.

ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor


Is it possible to add a service statically to the listener.ora?

Please advise,

Thanks,

John

and Connor said...

You dont need to change the listener.ora. After you create/start the service, the database will register that service with the listener (and will do so periodically). Or you can issue "alter system register".

In particular, the SID name is *not* related to the service.

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, July 10, 2016 - 12:47 pm UTC

Hi Connor

In my organization, tripwire security software had deemed that using local listener to auto register to be A security violation lol sigh.

So I have to manually register service with listener. Is that possible?

John
Connor McDonald
July 11, 2016 - 12:51 am UTC

I think you're going to be out of luck there.


listener.ora wrong

Marc, December 12, 2016 - 4:32 pm UTC

Hi ,

the listener.ora contains :
(GLOBAL_DBNAME = oem)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = MYSERVICE)

I think GLOBAL_DBNAME should be = MYSERVICE
and SID_NAME should be = oem

best regards ,
Marc

More to Explore

DBMS_SERVICE

More on PL/SQL routine DBMS_SERVICE here