Administering Services
Learn how to create and administer services, and perform other service-related tasks using Oracle Enterprise Manager and the SRVCTL utility.
Note:
You can also use the DBMS_SERVICE package to create or modify services and service attributes, but SRVCTL will override any settings made using this package. Oracle does not recommend using the DBMS_SERVICE package with services used either by an Oracle Real Application Clusters (Oracle RAC) database, or with Oracle Restart, or when Oracle Clusterware is managing a single-instance database.
Overview of Service Administration
When you create and administer services, you are dividing the work that your database performs into manageable units.
The goal of using services is to achieve optimal utilization of your database infrastructure. You can create and deploy services based on business requirements. Oracle AI Database can measure the performance for each service. Using the DBMS_MONITOR package, you can define both the application modules within a service and the individual actions for a module and monitor thresholds for these actions, enabling you to manage workloads to deliver capacity on demand.
When you create new services for your database, you should define the automatic workload management characteristics for each service, as described in "Service Characteristics".
In addition to creating services, you can:
- Delete a service. You can delete services that you created. However, you cannot delete or modify the properties of the default database service that Oracle AI Database created.
- Check the status of a service. A service can be assigned different roles among the available instances. In a complex database with many services, you may not remember the details of every service. Therefore, you may have to check the status on an instance or service basis. For example, you may have to know the status of a service for a particular instance before you make modifications to that instance or to the Oracle home from which it runs.
- Start or stop a service for a database or an instance. A service must be started before it can be used for client connections to that instance. If you shut down your database, for example, by running the SRVCTL command
srvctl stop database -dbdb_unique_namewheredb_unique_nameis the name of the database you want to stop, then Oracle AI Database stops all services for that database. Depending on the service management policy, you may have to manually restart the services when you start the database. Both thesrvctl stop databaseandsrvctl stop servicecommands accept the-forceoption to forcibly disconnect connections. To drain sessions for planned outages do not use the-forceoption. - Map a service to a consumer group. You can map services to Resource Manager Consumer groups to limit the amount of resources that services can use in an instance. You must create the consumer group and then map the service to the consumer group.
- Enable or disable a service for a database or an instance. By default, Oracle Clusterware attempts to restart a service automatically after failures. You can prevent this behavior by disabling a service. Disabling a service is useful when you must perform database or instance maintenance, such as when you are performing an upgrade and you want to prevent connection requests from succeeding.
- Relocate a service to a different instance. You can move a service from one instance to another instance to re-balance workloads, for example, after adding or deleting cluster nodes.
Note:
When you use services, do not set a value for the SERVICE_NAMES parameter; Oracle AI Database controls the setting for this parameter for the services that you create and for the default database service. The service features that this chapter describes are not directly related to the features that Oracle AI Database provides when you set SERVICE_NAMES. In addition, setting a value for this parameter may override some benefits of using services.
Service status information must be obtained from SRVCTL or from the service-related database views, such as dba_services.
If you specify a service using the DISPATCHERS initialization parameter, it overrides any service in the SERVICE_NAMES parameter, and cannot be managed. (For example, stopping the service with a SRVCTL command does not stop users connecting with the service.)
Related Topics
Administering Services with Oracle Enterprise Manager
The Cluster Managed Database Services page is the main page for beginning all tasks related to services.
Access this page, as follows:
- In Oracle Enterprise Manager, go to the Cluster Database Home page.
- From the Availability menu, select Cluster Managed Database Services to display the Cluster Managed Database Services page.
- Enter or confirm the credentials for the Oracle RAC database and host operating system and click Continue to display the Cluster Managed Database Services page.
From the Cluster Managed Database Services page you can drill down to perform the following tasks:
- View a list of services for the cluster
- View the instances on which each service is currently running
- View the status for each service
- Create or edit a service
- Start or stop a service
- Enable or disable a service
- Perform instance-level tasks for a service
- Delete a service
Note:
You must have SYSDBA credentials to access a cluster database. Cluster Managed Database Services does not permit you to connect as anything other than SYSDBA.
See also
Oracle Enterprise Manager online help for more information about administering services with Oracle Enterprise Manager
Administering Services with SRVCTL
Learn how to use SRVCTL to perform service administration on an Oracle Real Application Clusters (Oracle RAC) database.
Note:
When you create a service using SRVCTL, you must start the service with a separate SRVCTL command. However, you may later have to manually stop or restart the service. You may also have to disable the service to prevent automatic restarts, to manually relocate the service, or to obtain status information about the service.
Creating Services with SRVCTL
To create a service with SRVCTL, use the srvctl add service command on the command line.
Related Topics
Creating Services for Application Continuity and Transaction Guard
To configure services for Application Continuity, when you create a service using SRVCTL, set the -failovertype parameter to TRANSACTION and -commit_outcome to TRUE.
When using Application Continuity and Transaction Guard with your applications, you must configure a service. This section describes how to configure these application services depending on the functionality you plan to implement.
Creating Services for Application Continuity
Additionally, you can set values for these other service parameters for Application Continuity and load balancing:
-replay_init_time: Specifies how long, in seconds, you allow replay to start. Oracle recommends that you choose a value based on how long you will allow replay to be initiated. The default value is 300 seconds.-retention: Specifies the time (in seconds) that the commit outcome information is stored in the database. The default value is 86400 (1 day).-session_state: After a COMMIT has run, if the state was changed in that transaction, then it is not possible to replay the transaction to reestablish that state if the session is lost. When configuring Application Continuity, the applications are categorized depending on whether it is correct to continue past a COMMIT operation within a request.- Dynamic: (default) A session has a dynamic state if the session state changes are not fully encapsulated by the initialization, and cannot be fully captured in a callback at failover. Once the first transaction in a request commits, failover is internally disabled until the next request begins. This is the default mode that almost all applications should use for requests.
- AUTO: Use session state
AUTOso that the session state is managed as the application evolves. Session stateAUTOis available with TAC. When using TAC, both the client visible and server visible session states must match for a successful failover or session migration. When there is unrestorable session state at the beginning of a request, TAC does not enable as the state cannot be proven at the beginning of the request. Use ACCHK and the protection statistics to detect unrestorable session state at the beginning of request. UseRESET_STATEto clean session state automatically by Oracle AI Database between requests. -failoverretry: Number of connection retries for each connection attempt; recommended value is 30.-failoverdelay: Delay in seconds between each connection attempt; recommended value is 10.-notification: FAN is highly recommended-set this value toTRUEto enable FAN for OCI and ODP.Net clients.-clbgoal: For connection load balancing, useLONGwhen using run-time load balancing.-rlbgoal: For run-time load balancing, set toSERVICE_TIME.
You can use SRVCTL to modify an existing service for Application Continuity, similar to the following command, where racdb is the name of your Oracle RAC database, and app1 is the name of the service you are modifying:
$ srvctl modify service -db racdb -service app1 -clbgoal LONG
-rlbgoal SERVICE_TIME -failoverretry 30 -failoverdelay 10
-failovertype TRANSACTION -commit_outcome TRUE -replay_init_time 1800
-retention 86400 -notification TRUE
Creating Services for Transaction Guard
To enable Transaction Guard, but not Application Continuity, create the service using SRVCTL and set only -commit_outcome TRUE.
You can use SRVCTL to modify an existing service to enable Transaction Guard, similar to the following command, where racdb is the name of your Oracle RAC database, and app2 is the name of the service you are modifying:
$ srvctl modify service -db racdb -service app2 -commit_outcome TRUE
-retention 86400 -notification TRUE
In the preceding example, the -retention parameter specifies how long, in seconds, to maintain the history. Additionally the -notification parameter is set to TRUE, enabling FAN events.
To use Transaction Guard, a DBA must grant permission, as follows:
GRANT EXECUTE ON DBMS_APP_CONT;
Related Topics
Starting and Stopping Services with SRVCTL
To start or stop a service on Oracle Real Application Clusters (Oracle RAC), use the SRVCTL syntax described here.
For applications to connect using a server, the service must be started. If you stop a service, then it is temporarily unavailable, but is still subject to automatic restart and failover.
To start a service, enter the following SRVCTL syntax at the command line:
$ srvctl start service -db db_unique_name [-service service_name_list]
[-instance inst_name] [-startoption start_options]
To stop a service, enter the following SRVCTL syntax at the command line:
$ srvctl stop service -db db_unique_name -service service_name_list
[-instance inst_name] [-stopoption stop_options]
Enabling and Disabling Services with SRVCTL
To enable or disable a service on Oracle Real Application Clusters (Oracle RAC), use the SRVCTL syntax described here.
If you disable a service, then Oracle Clusterware does not consider the service for automatic startup, failover, or restart. You might disable a service when performing application maintenance, to ensure the service is not accidentally restarted by Oracle Clusterware until your maintenance operations are complete. To make the service available for normal operation again, you enable the service.
To enable services, use the following SRVCTL syntax from the command line:
$ srvctl enable service -db db_unique_name -service service_name_list
[-instance inst_name]
To disable services, use the following SRVCTL syntax from the command line:
$ srvctl disable service -db db_unique_name -service service_name_list
[-instance inst_name]
Relocating Services with SRVCTL
To relocate a service on Oracle Real Application Clusters (Oracle RAC), use the SRVCTL syntax described here.
to relocate a service, you run the srvctl relocate service command from the command line. For example, you can use this command when a service has failed over to an available instance, but you want to move it back to the preferred instance after that instance is restarted.
In the following example, the srvctl relocate service command relocates the crm service from instance apps1 to instance apps3:
$ srvctl relocate service -db apps -service crm -oldinst apps1 -newinst apps3
In the following example, the srvctl relocate service command relocates the crm service from node1 to node3 using node syntax:
$ srvctl relocate service -db apps -service crm -currentnode node1
-targetnode node3
Obtaining the Status of Services with SRVCTL
to obtain the status of a service on Oracle Real Application Clusters (Oracle RAC), run the srvctl status service command from the command line.
In the following example, the srvctl status service command returns the status of the services that are running on the apps database:
$ srvctl status service -db apps
Service erp is running on nodes: apps02,apps03
Service hr is running on nodes: apps02,apps03
Service sales is running on nodes: apps01,apps04
Obtaining the Configuration of Services with SRVCTL
To obtain the high availability configuration of a service on Oracle Real Application Clusters (Oracle RAC), run the srvctl config service command from the command line.
In the following example, the srvctl config service command returns the configuration of the erp service that is running on the apps database:
$ srvctl config service -db apps -service erp
Service name: erp
Service is enabled
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: true
Global: false
Commit Outcome: true
Failover type: TRANSACTION
Failover method: NONE
TAF failover retries: 30
TAF failover delay: 10
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: SERVICE_TIME
TAF policy specification: NONE
Edition:
Pluggable database name:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 1800 seconds
Session State Consistency: AUTO
Preferred instances: apps
Available instances: