3

I am reading about Oracle and I am confused with the two names: service_name and database name. Do they both refer to the database name used while creating a database with the CREATE DATABASE xxxxxx command?

Can the service name be different from the database name? If yes, how do we map the service name to the database name on the server? Because as a client, we use the service name to connect to the database, how does the server map the service name to the database name?

0

2 Answers 2

6

SERVICE_NAMES specifies one or more names by which clients can connect to the instance. The instance registers its service names with the listener. When a client requests a service, the listener determines which instances offer the requested service and routes the client to the appropriate instance.

You can specify multiple service names in order to distinguish among different users of the same database. For example:

SERVICE_NAMES = sales.acme.com, widgetsales.acme.com

You can also use service names to identify a single service that is available from two different databases through the use of replication.

If you do not qualify the names in this parameter with a domain, Oracle qualifies them with the value of the DB_DOMAIN parameter. If DB_DOMAIN is not specified, then no domain will be applied to the non-qualified SERVICE_NAMES values.

DATABASE NAME is the name of the physical database structure. It is stored at the controlfile and datafile header. It is used to identify all physical structures that belong to the same database. It can be defined at install time. It is originally defined by the static instance parameter database_name, and it cannot be changed, and the only way to change it is by means of rebuilding the controlfile and resetting the log sequence.

To conclude, you can have a common name for both of them. However, you might need different service names to distinguish among different users of the same database.

2
  • Can each service be configured to access few tables only ? and be provided access rights to only certain accounsts ? How is multiple service name for a single database useful ? Please help me understand
    – Chandan
    Sep 9, 2014 at 5:55
  • You can use roles to allow access to certain tables, then grant the appropriate role or roles to specific users. The service name is mostly used for resource management. Jan 25, 2018 at 21:31
0

Database name is the database you have created on Database server and it running on service side. by default when database created, a service with the database name will be created. for example:

when you create database orcl, there will be service named with orcl created by default. when you connect to the database, you will use service name.

You can create several services in Oracle RAC besides default database service to specify different workload. Says HR service, ERP service, back office service. Those services in RAC are for different application to connect to, while in Database side, it is all part of the database.

HTH.

2
  • Thanks Ricky . But Where do we map the service name to the database name ? How does oracle link the service name to the appropriate database to execute queries ?
    – Chandan
    Sep 9, 2014 at 5:49
  • it's only one database, so no concept of link service name to appropriate database. database -> service is a 1-> N mapping, which mean only database resides there and you can create difference service to logic mapping to difference schema for example.
    – Ricky Zhu
    Mar 1, 2016 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.