Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Stephen.

Asked: April 24, 2012 - 11:34 pm UTC

Last updated: May 07, 2012 - 2:52 pm UTC

Version: 11.2

Viewed 1000+ times

You Asked

Dear Tom,
I was reading Administrator's guide documentation and there are frequent references to "database services" but what exactly is database service is not clear. I am a developer who is also interested in learning Administration. I have come across terms such as listener service and also in tnsnames.ora I think I have seen service name but I thought it is enough just to have hostname,SID and port number in tnsnames.ora file to connect to remote databases.

It will be really helpful if you clearly explain what exactly is a database service.

Thanks for your support to oracle community...

Regards,
Stephen

and Tom said...

A service is an alternative way to specify how you want to connect to a database. You could specify the oracle home/sid in the tns connect string, but that is rather inflexible.


A single instance can register itself with a listener as supporting multiple services. An instance could have a REPORTING service and an OLTP service configured for example. You could use the resource manager to give 20% of the cpu to the REPORTING service and 60% of the cpu to the OLTP service (saving 20% for everything else). If you just used an Oracle home/sid you wouldn't be able to do that.

Additionally - many instances can register themselves using the same service name - in real application clusters for example. We can do load balancing and dynamic allocation/reallocate of resources using that capability.

http://docs.oracle.com/cd/E11882_01/network.112/e10836/concepts.htm#CIACABHJ


I would recommend using services in general, the only exception would be when you need to remotely start up an instance - then you need to use static registration (oracle home/sid) so we know exactly which instance you want to create.

Rating

  (6 ratings)

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

Comments

@Stephen

Sokrates, April 25, 2012 - 2:07 pm UTC

there is a very valuable paper of Jeremy Schneider which covers most of the aspects of Oracle Services on
http://www.ardentperf.com/pub/services-schneider07.pdf
Tom Kyte
April 25, 2012 - 2:52 pm UTC

excellent, that looks very nice, thanks for the reference!

How much usage and value is out there

Dana, April 25, 2012 - 4:25 pm UTC

I'm curious how many organizations are using services, and how extensively. To me it seems to be an ideal method for tuning, diagnostics, accounting, and costing in addition to the RAC benefits. But I seldom see or hear much about it. Any experiences to share out there?

Tom Kyte
April 25, 2012 - 5:34 pm UTC

almost everyone that uses RAC uses services.

As resource management becomes more and more important (consolidation sort of demands you start using it) it'll become more mandatory.

Check out that lengthly paper Sokrates pointed to - the benefits are there.

No need to configure listener.ora files anymore either - that is nice.

Looking for more...

Dana, April 25, 2012 - 7:03 pm UTC

I don't disagree. I am looking at services more as a means of creating "virtual" databases in any instance, not just for RAC. For instance, as the paper I think mentioned, developers/apps would connect to a service name and never really know what the database might be. I think that would be extremely useful in a organization where there are single databases per version. Schemas/apps could migrate to a new version easily. That is the angle I think would provide value, along with being able to see various distinct services in AWR's, etc. In our organization it is many, many instances per host with OS workload management to "segregate" and "cage" instances. I would see services as a viable alternative, and would like to hear if it is being used in that context.

Thanks....

Stephen D, April 25, 2012 - 11:51 pm UTC

Dear Tom & Socrates,
Thank you very much for the information.

Regards,
Stephen

A reader, May 07, 2012 - 9:01 am UTC

Tom,
You point out that connections via services as opposed to SIDs are the way to go. We have felt the same here, and were planning on using services in our new RAC environment (we have been running single instance databases until now). However, we have run into an issue we can't seem to resolve.
We have a number of COTS products that build JDBC connections to the database on the fly. That is, the user enters into a window a server name, a port and a SID, and the COTS product builds the JDBC connection on the fly in the format SERVER_NAME:PORT:SID. However, for services, this doesn't work. Instead, the JDBC connection needs to be in the format SERVER_NAME:PORT/SERVICE (where server_name could also be the cluster name). The COTS product is not designed for services and therefore doesn't have an option to enter service instead of a SID. And there is no way to trick the COTS product to replace that last ':' with a '/'.

If we were dealing with an in-house developed application, this would be ok -- we'd fix it. But to get COTS vendors to make changes is not always easy.

We've done some research to see if there is some parameter that we could change on the cluster side to accept the ':' instead of the '/', but we can't seem to find anything. This is preventing us from implementing services.

Do you have any thoughts or suggestions?

Jan
Tom Kyte
May 07, 2012 - 10:43 am UTC

It is not on the server side where that URL gets processed - it is in the client jdbc code. It needs to parse that to figure out how to connect.

I'm sorry - I don't see how to correct this without touching the client.

why not writing your own jdbc driver ?

Sokrates, May 07, 2012 - 2:22 pm UTC

A reader, why do you not write your own jdbc-driver ?
All you have to do is implement the six methods listed on
http://docs.oracle.com/javase/6/docs/api/java/sql/Driver.html
All beside

Connection connect(String url, Properties info)

you implement by delegating them to "the real" jdbc-driver ( the one you use now).

Before your Driver delegates
connect,
it changes SERVER_NAME:PORT:ABC in url into SERVER_NAME:PORT/ABC

Wouldn't that be a simple option ?
Tom Kyte
May 07, 2012 - 2:52 pm UTC

That is an interesting idea - something to look into.