This is an old revision of the document!
Overview
Database services (services) are logical abstractions for managing workloads in Oracle Database. Services divide workloads into mutually disjoint groupings. Furthermore, services in Oracle are a way to direct a traffic. In the past a user connected directly to the database, that was knows as 2 tier architecture. For a lot of reasons that is not the norm anymore. A part from the security risks that created, direct connections were also hard to organize and load-balance. Especially if you have multiple instances in terms of RAC or you need READ-ONLY operation which you can push to the Data Guard. Services in either are mostly used in conjuction with the Grid Infrastructure and are separated in two groups depending on your database configuration. As we know, Oracle RAC database can be either:
- Policy Managed
- Admin Managed
Therefore, you have different ways to create a service, depending on your configuration.
Policy Managed
Police Managed RAC database is divided into server pools. For example you can have the following configuration in which each database has multiple instances divided into server pools:
In that case, the syntax for adding a service is as follows:
Add Policy Managed Service
srvctl add service -db db_unique_name -service service_name [-eval] -serverpool server_pool [-cardinality {UNIFORM | SINGLETON}] [-edition edition_name] [-netnum network_number] [-role "[PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]" [-policy {AUTOMATIC (default) | MANUAL}] [-notification {TRUE | FALSE}] [-clbgoal {SHORT | LONG}] [-failovertype {NONE|SESSION|SELECT|TRANSACTION}] [-rlbgoal {NONE | SERVICE_TIME | THROUGHPUT}] [-dtp {TRUE | FALSE}] [-failovermethod {NONE | BASIC}] [-failoverretry failover_retries] [-failoverdelay failover_delay] [-pdb pluggable_database] [-sql_translation_profile sql_translation_profile] [-global {TRUE | FALSE}] [-maxlag max_lag_time] [-commit_outcome {TRUE|FALSE}] [-retention retention_time] [-replay_init_time replay_initiation_time] [-session_state {STATIC | DYNAMIC}] [-pqservice pq_service] [-pqpool pq_pool_list] [-force]
Let us break down each parameter here, except the obvious ones (db_unique_name, service_name, server_pool)
- cardinality - Uniform (run the server on ALL instances), Singleton (run it only on one instance at a time)
- edition - When an edition is specified for a service, all subsequent connections that specify the service use this edition as the initial session edition. However, if a session connection specifies a different edition, then the edition specified in the session connection is used for the initial session edition.
- netnum (RAC / RAC One node only) - Specifies over which network interface the service is provided
- role (used with Data Guard) - Specifies the condition for automatic starting of the service. If set to PRIMARY and the database role is PHYSICAL_STANDBY, the service WON'T start automatically.
- policy - Specified if the service will be authomatic started, of course depending on the “role” condition. But if set to Manual, the service will NEVER be automatically started.
- notification - Enables / Disables Fast Application Notifications (FAN) for OCI Connections.
- failovertype - Enables Application Continuity, if set to “TRANSACTION” and TAF (for OCI) if set to “SELECT” or “SESSION”.
- **NODE* If you set -failovertype to TRANSACTION, then you must set -commit_outcome to TRUE.
- clbgoal (Connection Load Balancing Goal) - Indicates to Oracle for what kind of connections this service will handle. Specify SHORT if you will do short transactions and LONG if you will use this service for BATCH jobs.
- rlbgoal (Runtime Load Balance Goal) - Used by the Load Balance advisor, set to SERVICE_TIME to balance connections by response time. Set THROUGHPUT to balance connections by throughput.
- failovermethod (Oracle RAC Only) - Specifies the TAF Failover method (backward Compatibility).