Service Commands

Use commands with the service keyword to add, modify, list the configuration of, enable, disable, start, stop, obtain the status of, relocate, and remove services.

srvctl add service

Adds services to a database and assigns them to instances.

Syntax

Use this command with one of the following syntax models.

Note:

The policy-managed database deployment option is desupported in Oracle AI Database 26ai.

To add a service to a database:

srvctl add service -db db_unique_name -service service_name_list [-true_cache_service true_cache_service_list]
   [-cardinality {UNIFORM | SINGLETON | DUPLEX} | -preferred "preferred_list"
    [-available "available_list"] [-tafpolicy {BASIC | NONE | PRECONNECT}] | [-cardinality {UNIFORM | SINGLETON}] ]
   [-netnum network_number] [-role "[PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]"]
   [-policy {AUTOMATIC | MANUAL}] [-notification {TRUE | FALSE}] [-dtp {TRUE | FALSE}]
   [-clbgoal {SHORT | LONG}] [-rlbgoal {NONE | SMART_CONN | SERVICE_TIME | THROUGHPUT}] [-resetstate {NONE | LEVEL1 | LOGIN}]
   [-failovertype {NONE|SESSION|SELECT|TRANSACTION|AUTO}] [-failovermethod {NONE | BASIC}] [-failoverretry failover_retries]
   [-failoverdelay failover_delay] [-failover_restore {NONE|LEVEL2|LEVEL1|AUTO}] -template_timeout template_timeout [-failback {YES | NO}]
   [-edition edition_name] [-pdb pdb_name] [-global {TRUE | FALSE}] [-maxlag max_lag_time]
   [-sql_translation_profile sql_translation_profile] [-commit_outcome {TRUE|FALSE}] [-retention retention_time]
   [-replay_init_time replay_initiation_time] [-session_state {DYNAMIC | AUTO}] [-importfile file_name]
   [-gsmflags gsm_flags] [-tablefamilyid table_family_id]
   [-drain_timeout timeout] [-stopoption {NONE|IMMEDIATE|TRANSACTIONAL}] [-css_critical {yes | no}]
   [-force] [-verbose]

To update the preferred and available lists of an existing service:

srvctl add service -db db_unique_name -service "service_name_list"
   -update {-preferred "preferred_list" | -available "available_list"} [-force]
   [-verbose]

Parameters

The following table lists and describes all the srvctl add service parameters and whether they can be used when adding a service to either an Oracle RAC database or non-cluster database.

Table: srvctl add service Command Parameters

ParameterDescription
-db db_unique_nameUnique name for the database.
-service service_name_list

The service_name.service_domain should be unique within the cluster unless you want to spread connections across multiple databases that offer the same service. If you do not specify the service domain as part of the service name (such as sales.example.com), then the DB_DOMAIN database attribute is appended to the service name. You can specify one service or several services in a comma-delimited list.

Note: The -service parameter has a 64 characters limit for its value. Therefore, the total length of the names of all services assigned to an instance cannot exceed 64 characters.

-true_cache_service true_cache_service_listSpecify this parameter to associate a primary service with the True Cache service.
-cardinality {UNIFORM | SINGLETON | DUPLEX}

The cardinality of the service, which can be one of the following:

  • UNIFORM - offered on all instances or PDBs in the database
  • SINGLETON - runs on only one instance or PDB at a time
  • DUPLEX - runs on two instances or PDBs at a time

Note: This parameter can be used only with Oracle RAC.

-preferred " preferred_list "

A comma-separated list of preferred instances on which the service runs.

The list of preferred instances must be mutually exclusive with the list of available instances.

Note: This parameter can be used only with Oracle RAC.

-available " available_list "

A comma-separated list of available instances, in priority order, to which the service fails over.

The list of available instances must be mutually exclusive with the list of preferred instances.

Note: This parameter can be used only with Oracle RAC.

-tafpolicy {BASIC|NONE}Transparent Application Failover (TAF) policy specification.
-netnum network_number

Use this parameter to determine on which network this service is offered. The service is configured to depend on VIPs from the specified network.

Notes:

  • If you omit this parameter, then the default is taken from the database configuration, which you specify using srvctl add database or srvctl modify database, with the -defaultnetwork parameter to specify the default network for that database's services.
  • This parameter can be used only with Oracle RAC and Oracle RAC One Node database configurations.
-role "[PRIMARY][,PHYSICAL_STANDBY] [,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]"

The service role. You can specify one or more roles in a comma-delimited list.

Use this option to indicate that the service should only be automatically started upon database open when the Oracle Data Guard database role matches one of the specified service roles.

Using SRVCTL to manually start a service is not affected by the service role.

Note: The -role parameter is only used at database startup and by the Oracle Data Guard Broker. All manual service startup must specify the name of the service to be started by the user.

-policy {AUTOMATIC | MANUAL}

Service management policy.

If AUTOMATIC (the default), then the service is automatically started upon restart of the database, either by a planned restart (with SRVCTL) or after a failure. Automatic restart is also subject to the service role, however (the -role parameter).

If MANUAL, then the service is never automatically restarted upon planned restart of the database (with SRVCTL). A MANUAL setting does not prevent Oracle Clusterware from monitoring the service when it is running and restarting it if a failure occurs.

Note: Using CRSCTL to stop and start the Oracle Clusterware restarts the service in the same way that a failure does.

-notification {TRUE | FALSE}Enable Fast Application Notification (FAN) for OCI connections.
-dtp {TRUE | FALSE}Indicates whether Distributed Transaction Processing should be enabled for this service. This service will be a preferred service on a single node in an administrator-managed database.
-clbgoal {SHORT | LONG}Connection Load Balancing Goal. Use a value of SHORT for this parameter for run-time load balancing, or if using an integrated connection pool. Use a value of LONG for this parameter for long running connections, such as batch jobs, that you want balanced by the number of sessions per node for the service.
-rlbgoal {NONE | SMART_CONN | SERVICE_TIME | THROUGHPUT}Runtime Load Balancing Goal (for the Load Balancing Advisory). Set this parameter to SMART_CONN to enable Smart Connection Rebalance. Set this parameter to SERVICE_TIME to balance connections by response time. Set this parameter to THROUGHPUT to balance connections by throughput.
-resetstate {NONE | LEVEL1 | LOGIN}

Specifies the session-state cleanup level for the service.

  • NONE: Does not clear session state between requests. NONE is the default value.
  • LEVEL1: Clears session state that cannot be reliably retained between requests.
  • LOGIN: Performs the LEVEL1 cleanup and restores session state to the state captured at the end of login.

Use RESET_STATE=LOGIN only with supported clients and connection-pooling configurations. For unsupported thin clients and DRCP session-pooled environments, use RESET_STATE=LEVEL1.

-failovertype {NONE | SESSION | SELECT | TRANSACTION | AUTO}

Set the failover type.

To enable Application Continuity for Java, set this parameter to TRANSACTION. To enable Transparent Application Continuity, set this parameter to AUTO.

To enable TAF for OCI, set this parameter to SELECT or SESSION.

Note: If you set -failovertype to TRANSACTION, then you must set -commit_outcome to TRUE.

-failovermethod {NONE | BASIC}

TAF failover method (for backward compatibility only).

If the failover type (-failovertype) is set to a value other than NONE, then you should choose BASIC for this parameter.

Note: This parameter can be used only with Oracle RAC.

-failoverretry failover_retriesFor Application Continuity and TAF, this parameter determines the number of attempts to connect after an incident.
-failoverdelay failover_delayFor Application Continuity and TAF, this parameter specifies the time delay (in seconds) between reconnect attempts per incident at failover.
-failover_restore {NONE|LEVEL2|LEVEL1|AUTO}

For Application Continuity, when you set the -failover_restore parameter, session states are restored before replaying. Use LEVEL2 for Application Continuity and AUTO for Transparent Application Continuity to restore session states using database templates.

Use LEVEL1 for Application Continuity or Transparent Application Continuity to restore session states using the earlier Oracle Database 19c modifiable parameter transport. Use wallets to allow restoring server-side session states transparently.

  • AUTO: Use this value to enable database templates for Transparent Application Continuity.
  • LEVEL1: Use this value to enable behavior of FAILOVER_RESTORE=AUTO with client based restore for Oracle Database 21c and earlier releases.
  • LEVEL2: Use this value to enable database templates for Transparent Application Continuity.

For OCI applications using TAF or Application Continuity, setting -failover_restore to LEVEL1 restores the current state. If the current state differs from the initial state, then a TAF callback is required. This restriction applies only to OCI.

-template_timeout template_timeout

Specify the time, in seconds, for template timeout. For Application Continuity, TEMPLATE_TIMEOUT parameter is used with FAILOVER_RESTORE values LEVEL2 and AUTO in Oracle AI Database 26ai. When a template expires, the session is not restored when FAILOVER_RESTORE is set to AUTO or LEVEL2.

You are recommended to set higher values so your pools are able to failover following the overnight maintenance. The default value is RETENTION (1 day).

If TEMPLATE_TIMEOUT is set to 0, then the template timeout is turned off.

-failback {YES | NO}If a service fails over to an available instance after the list of preferred instances was exhausted, then, if this parameter is set to YES , the service automatically fails back to a preferred instance when one becomes available.
-edition edition_name

The initial session edition of the service.

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.

SRVCTL does not validate the specified edition name. During connection, the connect user must have USE privilege on the specified edition. If the edition does not exist or if the connect user does not have USE privilege on the specified edition, then an error is raised.

-pdb pluggable_database

The name of the Pluggable Database (PDB).

You can specify a PDB property when you create or modify a service. The PDB property associates the service with the specified PDB. You can view the PDB property for a service by querying the ALL_SERVICES data dictionary view or, when using the SRVCTL utility, by running the srvctl config service command.

Note: Starting with Oracle Database 21c, before using the -pdb option with the srvctl add service command, you must have previously added the PDB resource to Oracle Clusterware using the srvctl add pdb command.

-global {TRUE | FALSE}

Indicates whether this is a Global Data Services service.

Note: This parameter can only be used with Global Data Services.

-maxlag maximum_lag_timeMaximum replication lag time in seconds for a global service. Must be a non-negative integer. The default value is ANY. You must also specify the -global option.
-sql_translation_profile profile_name

Use this parameter to specify a SQL translation profile for a service that you are adding after you have migrated applications from a non-Oracle database to an Oracle AI Database.

This parameter corresponds to the SQL translation profile parameter in the DBMS_SERVICE service attribute.

Notes:

  • Before using the SQL translation feature, you must migrate all server-side application objects and data to the Oracle AI Database.
  • Use the srvctl config service command to display the SQL translation profile.
-commit_outcome {TRUE | FALSE}Enable Transaction Guard; when set to TRUE, the commit outcome for a transaction is accessible after the transaction's session fails due to a recoverable outage.
-retention retention_timeIf -commit_outcome is set to TRUE, then this parameter determines the amount of time (in seconds) that the commit outcome is retained in the database.
-replay_init_time replay_initialization_timeFor Application Continuity, this parameter specifies the difference between the time, in seconds, of original processing of the first operation of a request and the time that the replay is ready to start after a successful reconnect. Application Continuity will not replay after the specified amount of time has passed. This parameter is intended to avoid the unintentional processing of a transaction when a system is recovered after a long period. The default is 5 minutes ( 300 ). The maximum value is 24 hours ( 86400 ). If the -failover_type parameter is not set to TRANSACTION, then you cannot use this parameter.
-session_state { DYNAMIC | AUTO}

For Application Continuity; this parameter describes how the non-transactional session state is changed by the application within a request. Examples of session state are NLS settings, optimizer preferences, event settings, PL/SQL global variables, and temporary tables. For Transparent Application Continuity, you can set session_state to AUTO. Session state is tracked automatically.

This parameter is considered only if -failovertype is set to AUTO or TRANSACTION for Application Continuity or AUTO for Transparent Application Continuity.

  • If failover_type is set to TRANSACTION, then Oracle recommends a value of DYNAMIC for session_state.
  • If failover_type is set to AUTO, then you can set session_state to AUTO.

Note: Use AUTO to enable Transparent Application Failover (TAF) style cursors with TAC.

  • If failover_type is set to any value other than TRANSACTION or AUTO, then the value of session_state is not set.

If non-transactional values change after the request starts, then set this parameter to either DYNAMIC or AUTO. Most applications should use DYNAMIC or AUTO mode.

-importfile file_nameRe-create the resources using the resource attributes specified in the file.
-gsmflags gsm_flagsSet locality and region failover values for a global service. You must also specify the -global option.
-tablefamilyid table_family_idSet table family ID for a service. See "Shared Table Family" for more information.
-drain_timeout timeout

Specify the time, in seconds, allowed for resource draining to be completed. Accepted values are an empty string (""), 0, or any positive integer. The default value is an empty string, which means that this parameter is not set. If it is set to 0, then draining occurs, immediately.

The draining period is intended for planned maintenance operations. During the draining period, all current client requests are processed, but new requests are not accepted. When set on the service this value is used when the command line value is not set.

Note: If the -drain_timeout value is not specified, then the maximum configured drain timeout of all the running services of the database on the specified nodes is used.

-stopoption {NONE|IMMEDIATE|TRANSACTIONAL}

Specify the default method of stopping the service. When set on the service, this value is used if you do not include the -stopoption parameter in other SRVCTL commands. If you do not provide a value, then the default option NONE is used.

  • IMMEDIATE permits sessions to drain before the service is stopped. Sessions that do not drain are terminated when the time limit specified by -drain_timeout is reached.
  • If you specify TRANSACTIONAL, then sessions are terminated as soon as they commit. The service is stopped when the time limit specified by -drain_timeout is reached and any remaining sessions are terminated.
  • If you specify NONE, then no sessions are terminated.
-css_critical {yes | no}You can add weight to a service by setting this parameter to YES. In the event of a node failure within the cluster, Oracle Clusterware will evict the node with the least amount of weight, ensuring that critical services remain available.
-update {-preferred new_preferred_instance | -available new_available_instance }Add a new preferred or available instance to the service configuration. -preferred specifies the name of the instance to add to the list of preferred instances for the service. -available specifies the name of the instance to add to the list of available instances for the service.
-forceForce the add operation even though a listener is not configured for a network.
-verboseDisplay verbose output.

Usage Notes

This command does not accept placement parameters for Oracle RAC One Node databases.

Examples

Use the following examples to create your services:

Basic Service

$ srvctl add service -db mydb -service MYSERVICE -preferred inst1 -available inst2
-pdb mypdb -notification TRUE -drain_timeout 300 -stopoption IMMEDIATE -role PRIMARY

Transparent Application Continuity Service

$ srvctl add service -db mydb -service TACSERVICE -pdb mypdb -preferred inst1 -available inst2
-failover_restore AUTO -commit_outcome TRUE -failovertype AUTO -replay_init_time 600 -retention 86400
-notification TRUE -drain_timeout 300 -stopoption IMMEDIATE -role PRIMARY

Application Continuity Service

$ srvctl add service -db mydb -service ACSERVICE -pdb mypdb -preferred inst1 -available inst2
-failover_restore LEVEL1 -commit_outcome TRUE -failovertype TRANSACTION -session_state dynamic
-replay_init_time 600 -retention 86400 -notification TRUE -drain_timeout 300 -stopoption IMMEDIATE -role PRIMARY

TAF Select Plus Service

$ srvctl add service -db mydb -service TAFSERVICE -pdb mypdb -preferred inst1 -available inst2
-failover_restore LEVEL1 -commit_outcome TRUE -failovertype SELECT -notification TRUE -drain_timeout 300
-stopoption TRANSACTIONAL -role PRIMARY

Service Attribute Validation Matrix

The following table describes service attribute dependency for FAILOVER_TYPE and COMMIT_OUTCOME driver attributes.

Table: Service Attribute Dependency Validation

Parent AttributeValueDependent AttributeValid Value
failover_typeAUTOfailover_restoreAUTO | LEVEL1
failover_typeAUTOsession_state_consistencyAUTO
failover_typeAUTOcommit_outcomeTRUE
failover_typeTRANSACTIONfailover_restoreLEVEL1 | NONE | LEVEL2
failover_typeTRANSACTIONsession_state_consistencyDYNAMIC
failover_typeTRANSACTIONcommit_outcomeTRUE
failover_typeSELECTfailover_restoreLEVEL1 | NONE
failover_typeSELECTfailover_methodBASIC | NONE
failover_typeSELECTcommit_outcomeTRUE | FALSE
failover_typeSESSIONfailover_restoreNONE
failover_typeSESSIONfailover_methodBASIC | NONE
failover_typeSESSIONcommit_outcomeFALSE
failover_typeNONEfailover_restoreNONE
failover_typeNONEfailover_methodNONE
failover_typeNONEcommit_outcomeFALSE | TRUE
commit_outcomeFALSEcommit_outcome_fastpathFALSE
commit_outcomeTRUEcommit_outcome_fastpathTRUE | FALSE

Related Topics

srvctl config service

Displays the configuration for a service.

Syntax

srvctl config service {-db db_unique_name [-service service_name | -pdb pdb_name [-brief]]
   | [-db db_unique_name]} [-exportfile file_name] [-verbose]

Parameters

Table: srvctl config service Command Parameters

ParameterDescription
-db db_unique_nameUnique name for the database.
-service service_name

Optionally, you can specify the name of a service.

If you do not use this parameter, then SRVCTL displays the configuration information for all services configured for the database.

-pdb pdb_nameName of the PDB for which you want to show configured services.
-exportfile file_nameSpecify the output file to which the resource configuration will be exported in JSON format for backup or resource re-creation purposes.
-verboseDisplays verbose output.

Usage Notes

The srvctl config service command shows exactly the string value you specified for the edition using the srvctl add | modify service commands. If you specified the edition in upper case, then srvctl config service displays upper case. If it is surrounded by double quotation marks (""), then the command displays the double quotation marks. Otherwise, the command displays an empty string.

Examples

This command returns information similar to the following for a database:

$ srvctl config service -db crm -service webapps
Service name: webapps
Service is enabled
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: crm_1
Available instances:
Edition: "my Edition"

Service configuration for administrator-managed Oracle RAC One Node databases displays the one instance as preferred.

srvctl disable service

Disables a service.

Disabling an entire service affects all of the instances, disabling each one. If the entire service is already disabled, then running this command on the entire service returns an error. This means that you cannot always use the entire set of service operations to manipulate the service indicators for each instance.

Syntax

srvctl disable service -db db_unique_name -services "service_name_list"
   [-instance instance_name]

Parameters

Table: srvctl disable service Command Parameters

ParameterDescription
-db db_unique_nameSpecify a unique name for the database for which you want to disable the service.
-services " service_name_list "Specify a comma-delimited list of service names enclosed in double quotation marks ( "" ), or a single service name, that you want to disable.
-instance instance_name

Optionally, you can specify the name of the instance for which you want to disable the service.

Notes:

  • Use this parameter with administrator-managed databases.
  • You can only use this parameter with Oracle Clusterware and Oracle RAC.

Examples

The following example globally disables two services for the CRM database:

$ srvctl disable service -db crm -service "crm,marketing"

The following example disables a service for the CRM database that is running on the CRM1 instance, resulting in the service still being available for the database, but on one less instance:

$ srvctl disable service -db crm -service crm -instance crm1

srvctl enable service

Enables a service for Oracle Clusterware.

Enabling an entire service also affects the enabling of the service over all of the instances by enabling the service on each one. If the entire service is already enabled, then running this command does not affect all of the instances and enable them but, instead, returns an error. Therefore, you cannot always use the entire set of service operations to manipulate the service indicators for each instance.

Syntax

srvctl enable service -db db_unique_name -service "service_name_list"
   [-instance instance_name | -node node_name]

Parameters

Table: srvctl enable service Command Parameters

ParameterDescription
-db db_unique_nameSpecify a unique name for the database for which you want to enable the service.
-service " service_name_list "Specify a single service name or a comma-delimited list of service names enclosed in double quotation marks ( "" ) that you want to enable.
-instance instance_name

Optionally, you can use this parameter to specify the name of the database instance where you want the service to run.

Notes:

  • Use this parameter for administrator-managed databases.
  • You can only use this parameter with Oracle Clusterware and Oracle RAC.

Examples

The following example globally enables a service:

$ srvctl enable service -db crm -service crm

The following example enables a service to use a preferred instance:

$srvctl enable service -db crm -service crm -instance crm1

srvctl modify service

Modifies a service configuration.

Note:

The policy-managed database deployment option is desupported in Oracle AI Database 26ai.

This command supports some online modifications to the service, such as:

  • Moving a service member from one instance to another
  • Performing online changes to service attributes from DBMS_SERVICE (for example, failover delay, runtime load balancing goal, and so on)
  • Adding a new preferred or available instance
  • Removing preferred or available instances for a service

Caution:

Oracle recommends that you limit configuration changes to the minimum requirement and that you not perform other service operations while the online service modification is in progress.

Syntax and Parameters

Use one of the following forms of the srvctl modify service command, depending on the task you want to perform, with the specified syntax:

To move a service from one instance to another:

srvctl modify service -db db_unique_name -service service_name
  -oldinst old_instance_name -newinst new_instance_name [-force]

Note:

This form of the command is only available with Oracle Clusterware.

Table: srvctl modify service Parameters for Moving a Service

ParameterDescription
-db db_unique_nameSpecify the unique name for the database.
-service service_nameSpecify a service name. If you do not specify a service name, then SRVCTL moves all services.
-oldinst old_instance_nameSpecify the name of the instance from which you want to move the service.
-newinst new_instance_nameSpecify the name of the instance to which you want to move the service.
-forceForce the modify operation, stopping the service on some nodes, as necessary.

To change an available instance to a preferred instance for a service:

srvctl modify service -db db_unique_name -service service_name
  -available avail_inst_name [-failback {YES|NO}] -toprefer [-force]

Note:

This form of the command is only available with Oracle Clusterware and does not accept placement parameters for Oracle RAC One Node databases. This command also does not move or otherwise disconnect the service but only modifies the service attributes.

Table: srvctl modify service Parameters for Changing to a Preferred Instance

ParameterDescription
-db db_unique_nameSpecify the unique name for the database.
-service service_nameSpecify the name of the service you want to modify.
-available available_inst_nameSpecify the name of the available instance you want to change.
-failback {YES|NO}If a service fails over to an available instance after the list of preferred instances was exhausted, then, if this parameter is set to YES , then the service automatically fails back to a preferred instance when one becomes available.
-topreferSpecify this parameter to change the instance status to preferred.
-forceForce the modify operation. For planned operations, the user experience is best if using an Oracle Connection Pool with FAN. The FAN planned event causes the Oracle pool to drain the requests with no interruption to the users.

To change the available and preferred status for multiple instances:

srvctl modify service -db db_unique_name -service service_name
  -modifyconfig -preferred "preferred_list" [-available "available_list"]
  [-force]

Note:

This form of the command is only available with Oracle Clusterware and does not accept placement parameters for Oracle RAC One Node databases. This command also does not move or otherwise disconnect the service but only modifies the service attributes.

Table: srvctl modify service Parameters for Changing Status of Multiple Instances

ParameterDescription
-db db_unique_nameSpecify the unique name for the database.
-service service_nameSpecify the name of the service you want to modify.
-modifyconfigThis parameter directs SRVCTL to use only the instances named for this service (unnamed instances already assigned to the service are removed).
-preferred " preferred_instance_list "Specify a comma-delimited list of preferred instances enclosed within double quotation marks ("").
-available " available_instance_list "Specify a comma-delimited list of available instances enclosed within double quotation marks ("").
-forceForce the modify operation. For planned operations, the user experience is best if using an Oracle Connection Pool with FAN. The FAN planned event causes the connection pool to drain the requests with no interruption to the users.

To modify other service attributes or to modify a service for Oracle Clusterware:

srvctl modify service -db db_unique_name -service service_name
 [-true_cache_service true_cache_service_list]
 [-cardinality {UNIFORM|SINGLETON|DUPLEX}] [-tafpolicy {BASIC|NONE}]
 [-role "[PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]"]
 [-policy {AUTOMATIC|MANUAL}] [-notification {TRUE|FALSE}] [-dtp {TRUE|FALSE}]
 [-clbgoal {SHORT|LONG}] [-rlbgoal {NONE | SMART_CONN | SERVICE_TIME | THROUGHPUT}]
 [-resetstate {NONE | LEVEL1 | LOGIN}] [-failovertype {NONE|SESSION|SELECT|TRANSACTION|AUTO}]
 [-failoverretry failover_retries] [-failoverdelay failover_delay]
 [-failover_restore [NONE|LEVEL2|LEVEL1|AUTO]] [-template_timeout template_timeout] [-failback {YES|NO}]
 [-edition edition_name] [-pdb pluggable_database]
 [-sql_translation_profile profile_name] [-commit_outcome {TRUE|FALSE}]
 [-retention retention_time] [-replay_init_time replay_initiation_time]
 [-session_state {DYNAMIC|AUTO}] [-maxlag max_lag_time]
 [-gsmflags gsm_flags] [-tablefamilyid table_family_id]
 [-drain_timeout timeout] [-stopoption {NONE|IMMEDIATE|TRANSACTIONAL}]
 [-global_override] [-css_critical {YES | NO}] -hubsvc <hub_service>]} [-verbose] [-force]

Table: srvctl modify service Parameters

ParameterDescription
-db db_unique_nameThe unique name for the database.
-service service_nameThe name of the service you want to modify.
-true_cache_service true_cache_service_listSpecify this parameter to associate a primary service with the True Cache service.
-cardinality {UNIFORM|SINGLETON|DUPLEX}

The cardinality of the service, which can be one of the following:

  • UNIFORM - offered on all instances or PDBs in the database
  • SINGLETON - runs on only one instance or PDB at a time
  • DUPLEX - runs on two instances or PDBs at a time

Note: This parameter can be used only with Oracle RAC.

-tafpolicy {BASIC|NONE}Transparent Application Failover (TAF) policy specification.
-role "[PRIMARY][,PHYSICAL_STANDBY] [,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]"

The database modes for which the service should be started automatically. You can specify one or more roles in a comma-delimited list.

Note: The -role parameter is only used at database startup and by the Oracle Data Guard Broker. All manual service startup must specify the name of the service to be started by the user.

-policy {AUTOMATIC|MANUAL}

The service management policy.

If AUTOMATIC (the default), then the service is automatically started upon restart of the database, either by a planned restart (with SRVCTL) or after a failure. Automatic restart is also subject to the service role, however (the -role parameter).

If MANUAL, then the service is never automatically restarted upon planned restart of the database (with SRVCTL). A MANUAL setting does not prevent Oracle Clusterware from monitoring the service when it is running and restarting it if a failure occurs.

-notification {TRUE|FALSE}Use TRUE to enable Fast Application Notification (FAN) for Oracle Call Interface (OCI) connections.
-dtp {TRUE|FALSE}

Use TRUE to enable Distributed Transaction Processing for this service. This ensures that the service is offered at exactly one instance at a time for XA affinity.

Note: This parameter can be used only with Oracle RAC.

-clbgoal {SHORT|LONG}Connection Load Balancing Goal. Set to SHORT if using runtime load balancing, or set to LONG for long running connections, such as batch jobs, that you want balanced by the number of sessions per node for the service.
-rlbgoal {NONE | SMART_CONN | SERVICE_TIME | THROUGHPUT}Runtime Load Balancing Goal (for the Load Balancing Advisory). Set this parameter to SMART_CONN to enable Smart Connection Rebalance. Set this parameter to SERVICE_TIME to balance connections by response time. Set this parameter to THROUGHPUT to balance connections by throughput.
-resetstate {NONE | LEVEL1 | LOGIN}

Specifies the session-state cleanup level for the service.

  • NONE: Does not clear session state between requests. NONE is the default value.
  • LEVEL1: Clears session state that cannot be reliably retained between requests.
  • LOGIN: Performs the LEVEL1 cleanup and restores session state to the state captured at the end of login.

Use RESET_STATE=LOGIN only with supported clients and connection-pooling configurations. For unsupported thin clients and DRCP session-pooled environments, use RESET_STATE=LEVEL1.

-failovertype {NONE|SESSION|SELECT|TRANSACTION|AUTO}

Use this parameter to set the failover type.

To enable Application Continuity, set this parameter to TRANSACTION. To enable Transparent Application Continuity, set this parameter to AUTO.

To enable TAF, set this parameter to SELECT or SESSION.

-template_timeout template_timeout

Specify the time, in seconds, for template timeout. For Application Continuity, TEMPLATE_TIMEOUT parameter is used with FAILOVER_RESTORE values LEVEL2 and AUTO in Oracle AI Database 26ai. When a template expires, the session is not restored when FAILOVER_RESTORE is set to AUTO or LEVEL2.

If TEMPLATE_TIMEOUT is set to 0, then the template timeout is turned off.

-failoverretry failover_retriesFor Application Continuity and TAF, specify the number of attempts to connect after an incident.
-failoverdelay failover_delayFor Application Continuity and TAF, specify the time delay (in seconds) between reconnect attempts per incident at failover.
-failover_restore {NONE|LEVEL2|LEVEL1|AUTO}

For Application Continuity, when you set the -failover_restore parameter, session states are restored before replaying. Use LEVEL2 for ODP.NET and Java with Application Continuity to restore the initial state.

Set this parameter to LEVEL1 or AUTO to enable Transparent Application Continuity to restore session states.

  • AUTO: Use this value to enable database templates for Application Continuity.
  • LEVEL1: Use this value to enable behavior of FAILOVER_RESTORE=AUTO with client based restore for Oracle Database 21c and earlier releases.

For OCI applications using TAF or Application Continuity, setting -failover_restore to LEVEL1 restores the current state. If the current state differs from the initial state, then a TAF callback is required. This restriction applies only to OCI.

-failback {YES | NO}If a service fails over to an available instance after the list of preferred instances was exhausted, then, if this parameter is set to YES , the service automatically fails back to a preferred instance when one becomes available.
-edition edition_name

The initial session edition of the service.

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.

SRVCTL does not validate the specified edition name. During connection, the connect user must have USE privilege on the specified edition. If the edition does not exist or if the connect user does not have USE privilege on the specified edition, then an error is raised.

-pdb pluggable_database

The name of a Pluggable Database (PDB).

Note: You can specify a PDB property when you create or modify a service. The PDB property associates the service with the specified PDB. You can view the PDB property for a service by querying the ALL_SERVICES data dictionary view or, when using the SRVCTL utility, by running the srvctl config service command.

When create or modify a service with the specified PDB, SRVCTL does not check if the PDB exists. Before running this command, you must ensure that the PDB exists.

-sql_translation_profile profile_name

Use this parameter to specify a SQL translation profile for a service that you are modifying after you have migrated applications from a non-Oracle database to an Oracle AI Database.

If you want to set the SQL translation profile to a NULL value, then you must enter an empty string after the -p flag.

Note: Before using the SQL translation feature, you must migrate all server-side application objects and data to the Oracle AI Database.

-commit_outcome {TRUE|FALSE}Enable Transaction Guard; when set to TRUE, the commit outcome for a transaction is accessible after the transaction's session fails due to a recoverable outage.
-retention retention_timeFor Transaction Guard (with the -commit_outcome parameter set to TRUE ); this parameter determines the amount of time (in seconds) that the commit outcome is retained in the database.
-replay_init_time replay_initiation_timeFor Application Continuity; this parameter specifies the time, in seconds, from when the original request started. Application Continuity will not replay after the specified amount of time has passed. This attribute avoids the unintentional replay of a request when a system is recovered after a long period. The default value is 300 (5 minutes).
-session_state {DYNAMIC|AUTO}

For Application Continuity; this parameter describes how the non-transactional session state is changed by the application within a request. Examples of session state are NLS settings, optimizer preferences, event settings, PL/SQL global variables, and temporary tables. For Transparent Application Continuity, you can set session_state to AUTO. Session state is tracked automatically.

This parameter is considered only if -failovertype is set to AUTO or TRANSACTION for Application Continuity or AUTO for Transparent Application Continuity.

  • If failover_type is set to TRANSACTION, then Oracle recommends a value of DYNAMIC for session_state.
  • If failover_type is set to AUTO, then you can set session_state to AUTO.

Note: Use AUTO to enable Transparent Application Failover (TAF) style cursors with TAC.

  • If failover_type is set to any value other than TRANSACTION or AUTO, then the value of session_state is not set.

Oracle recommends a value of AUTO or DYNAMIC for most applications. If you are unsure which value to use, or if you can customize the application, then use DYNAMIC.

-maxlag maximum_lag_timeMaximum replication lag time in seconds for a global service. Must be a non-negative integer. The default value is ANY. You must also specify the -global option.
-gsmflags gsm_flagsSet locality and region failover values for a global service. You must also specify the -global option.
-tablefamilyid table_family_idSet table family ID for a service. See Sharded Table Family for more information.
-drain_timeout timeout

Specify the time, in seconds, allowed for resource draining to be completed. Accepted values are an empty string (""), 0, or any positive integer. The default value is an empty string, which means that this parameter is not set. If it is set to 0, then draining occurs, immediately.

The draining period is intended for planned maintenance operations. During the draining period, all current client requests are processed, but new requests are not accepted. When set on the service this value is used when the command line value is not set.

Note: If the -drain_timeout value is not specified, then the maximum configured drain timeout of all the running services of the database on the specified nodes is used.

-stopoption {NONE|IMMEDIATE|TRANSACTIONAL}

Specify the method of stopping the service. If this attribute was previously set for the service, then that value is used as the default value if you do not include the -stopoption parameter in your command. Otherwise, the default is NONE.

  • IMMEDIATE permits sessions to drain before the service is stopped. Sessions that do not drain are terminated when the time limit specified by -drain_timeout is reached.
  • If you specify TRANSACTIONAL, then sessions are terminated as soon as they commit. The service is stopped when the time limit specified by -drain_timeout is reached and any remaining sessions are terminated.
  • If you specify NONE, then no sessions are terminated.

Note: You must use the -stopoption parameter with the -force parameter.

-global_override

Override value to modify the global service attributes.

Use this parameter with the -role, -policy, -notification, -failovertype, -failovermethod, -failoverdelay, -failoverretry and -edition parameters.

-css_critical {yes | no}You can add weight to a service by setting this parameter to YES. In the event of a node failure within the cluster, Oracle Clusterware will evict the node with the least amount of weight, ensuring that critical services remain available.
-verboseDisplay verbose output.
-forceForce the modify operation, stopping the service on some nodes as necessary.

Usage Notes

  • When performing online changes to service attributes (for example, failover delay, Runtime Load Balancing Goal, and so on), the changes take effect only when the service is next (re)started.
  • When a service configuration is modified so that a new preferred or available instance is added, the running state of the existing service is not affected. However, the newly added instances will not automatically provide the service, until a srvctl start service command is issued.
  • When there are available instances for the service, and the service configuration is modified so that a preferred or available instance is removed, the running state of the service may change unpredictably:
  • The service is stopped and then removed on some instances according to the new service configuration.
  • The service may be running on some instances that are being removed from the service configuration.
  • These services will be relocated to the next free instance in the new service configuration.

Because of these considerations, when the online service is being modified, users may experience a brief service outage on some instances even if the instances are not being removed. Or users may experience a brief service outage on instances that are being removed from the service.

Examples

An example of moving a service member from one instance to another is:

$ srvctl modify service -db crm -service crm -oldinst crm1 -newinst crm2

An example of changing an available instance to a preferred instance is:

$ srvctl modify service -db crm -service crm -available crm1 -toprefer

The following command exchanges a preferred and available instance:

$ srvctl modify service -db crm -service crm -modifyconfig -preferred "crm1" \
-available "crm2"

Related Topics

srvctl predict service

Predicts the consequences of service failure.

Syntax

srvctl predict service -db db_unique_name -service service_name [-verbose]

Parameters

Table: srvctl predict service Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name for the database on which the service operates that you want to check.
-service service_nameSpecify a single service name or a comma-delimited list of service names enclosed in double quotation marks ( "" ) that you want to check.
-verboseOptionally, you can use this parameter to display detailed output.

srvctl relocate service

Temporarily relocates the specified service names from one specified instance to another specified instance.

This command works on only one source instance and one target instance at a time, relocating a service or all services from a single source instance to a single target instance.

Syntax

To relocate a service from one instance to another instance or from one node to another node:

srvctl relocate service -db db_unique_name [-service service_name | -pdb pluggable_database]
  {-oldinst old_inst_name [-newinst new_inst_name] | -currentnode current_node [-targetnode target_node]}
  [-drain_timeout timeout] [-wait {YES | NO}] [-pq] [-force [-noreplay]] [-stopoption stop_option]] [-eval] [-verbose]

Parameters

Table: srvctl relocate service Command Parameters

ParameterDescription
-db db_unique_nameThe unique name for the database on which the service currently runs.
-service service_nameThe name of the service you want to relocate. If you do not specify any services, then all services that can be relocated, are relocated. Those that cannot be relocated remain in place.
-pdb pluggable_databaseThe name of the Pluggable Database in which the service you want to relocate is currently running.
-oldinst old_inst_nameThe name of the instance from which you are relocating the service.
-newinst new_inst_name

The name of the instance to which you are relocating the service. This parameter is optional. If you do not specify an instance, then Oracle Clusterware chooses a new one.

The policy-managed database deployment option is desupported in Oracle AI Database 26ai.

-currentnode source_nodeName of the node where the service is currently running.
-targetnode target_node

Name of node where the service is to be relocated. If you do not specify a target node, then Oracle Clusterware chooses a new location.

The policy-managed database deployment option is desupported in Oracle AI Database 26ai.

-drain_timeout timeout

Specify the time, in seconds, allowed for resource draining to be completed. Accepted values are an empty string (""), 0, or any positive integer. The default value is an empty string, which means that this parameter is not set. If it is set to 0, then draining occurs, immediately.

The draining period is intended for planned maintenance operations. During the draining period, all current client requests are processed, but new requests are not accepted. When set on the service this value is used when the command line value is not set.

Note: If the -drain_timeout value is not specified, then the maximum configured drain timeout of all the running services of the database on the specified nodes is used.

-wait YES | NOChoose YES to wait until service draining is completed on the node from which you are relocating the service.
-stopoption option

Specify the method of stopping the service. If this attribute was previously set for the service, then that value is used as the default value if you do not include the -stopoption parameter in your command. Otherwise, the default is NONE.

  • IMMEDIATE permits sessions to drain before the service is stopped. Sessions that do not drain are terminated when the time limit specified by -drain_timeout is reached.
  • If you specify TRANSACTIONAL, then sessions are terminated as soon as they commit. The service is stopped when the time limit specified by -drain_timeout is reached and any remaining sessions are terminated.
  • If you specify NONE, then no sessions are terminated.

Note: You must use the -stopoption parameter with the -force parameter.

-pqPerforms the action on a parallel query service.
-force [-noreplay]

Disconnect all sessions during stop or relocate service operations.

Optionally, you can specify the -noreplay parameter if you do not want Application Continuity to replay in-flight transactions after a session is terminated during relocate service operations.

-evalUse this parameter to hypothetically evaluate the impact of the command on the system.
-verboseVerbose output.

Example

To temporarily relocate a named service member for the crm service from the database instance crm1 to the database instance crm3:

$ srvctl relocate service -db crm -service crm -oldinst crm1 -newinst crm3

Related Topics

srvctl remove service

Removes the service from Oracle Clusterware management.

Syntax

srvctl remove service -db db_unique_name {-service service_name |
   -pdb pdb_name}[-global_override] [-force]

Parameters

Table: srvctl remove service Command Parameters

ParameterDescription
-db db_unique_nameThe unique name of the database or Container Database (CDB).
-service service_nameThe name of the service you want to remove. You must specify either the service name or the Pluggable Database (PDB) name.
-pdb pdb_nameThe name of the PDB that offers the service. You must specify either the service name or the PDB name.
-global_overrideIndicates you are modifying global services. SRVCTL ignores this parameter for a non-global service.
-forceIgnore any dependencies when removing the service.

Usage Notes

If you use the -pdb option with this command, then SRVCTL removes all service resources for the specified PDB, but does not remove the PDB resource. If you specify the PDB service name using the -service option, then you do not have to also include the -pdb option because the PDB service name is unique within the Container Database (CDB).

Examples

This following example removes the sales service from all instances of the clustered database named crm:

$ srvctl remove service -db crm -service sales

The following example removes the services from the crmeast PDB:

$ srvctl remove service -db crm -pdb crmeast

srvctl start service

Starts a service or multiple services on a database, Pluggable Database (PDB) , or instance.

Syntax

srvctl start service { -node node_list | -db db_unique_name [-node node_list | -instance instance_name]
  [-service "service_name_list" | -pdb pluggable_database] [-global_override] [-startoption start_options] [-eval]}
  [-role | -all] [-verbose]

Parameters

ParameterDescription
-db db_unique_nameSpecify a unique name for the database.
-service " service_list "

Specify a service name or a comma-delimited list of service names enclosed in double quotation marks ("").

If you do not include this parameter, then SRVCTL starts all of the services for the specified database.

Note: All manual service startup must specify the name of the service to be started by the user.

-roleStart services for the local database role.
-pdb pluggable_databaseSpecify the name of a Pluggable Database. Optionally, you can specify either the name of a node or the name of an instance to restrict the starting of services to that particular object on the Pluggable Database.
-instance instance_nameSpecify the name of an instance where the services reside that you want to start. Use this parameter for administrator-managed databases.
-global_overrideOverride value to operate on a global service. Use this parameter only with global services; this parameter is ignored if specified for a non-global service.
-startoption start_options

Specify startup options used when service startup requires starting a database instance. Options include OPEN, MOUNT, and NOMOUNT.

Note: For multi-word startup options, such as read only and read write, separate the words with a space and enclose in double quotation marks (""). For example, "read only".

-roleStart services for the local database role.
-verboseDisplay verbose output.

Usage Notes

  • The srvctl start service command will fail if you attempt to start a service that is already running.
  • The srvctl start service command will fail if you attempt to start a service on an instance, if that service is already running on its maximum number of instances, that is, its number of preferred instances.
  • The srvctl start service without the -role parameter or a list of services, will start all the services configured for the database, regardless of the actual database role.
  • You can move a service or change the status of a service on an instance with the srvctl modify service and srvctl relocate service commands.

Examples

The following example starts all services on a specific database:

$ srvctl start service -db myDB

The following examples start a list of services (optionally restricted to a parallel query services in the latter example) regardless of the Pluggable Database on which they may reside:

$ srvctl start service -db myDB -service "myServ01,myServ02"
$ srvctl start service -db myDB -service "myServ01,myServ02" -pq

The following examples start all services on a given Pluggable Database, optionally restricted to a single node or a single instance in the latter two examples, repectively:

$ srvctl start service -db myDB -pdb myPDB1
$ srvctl start service -db myDB -pdb myPDB1 -node myRACNode01
$ srvctl start service -db myDB -pdb myPDB1 -instance myDB01

The following example starts all services, for a given database, on a given instance (for all Pluggable Databases):

$ srvctl start service -db myDB -instance myDB01

The following example start all services for a given database on a given node (for all Pluggable Databases):

$ srvctl start service -db myDB -node myRACNode01

The following examples start a list of services on a given node or given instance:

$ srvctl start service -db myDB -service "myService01,myService02" -node myRACNode01
$ srvctl start service -db myDB -service "myService01,myService02" -instance myDB01

srvctl status service

Displays the status of a service.

For Oracle RAC One Node databases, if there is an online database relocation in process, then this command displays the source and destination nodes and the status of the relocation, whether it is active or failed.

Syntax

srvctl status service {-db db_unique_name [-service "service_name_list" | -pdb pdb_name]
  | [-db db_unique_name]} [-force] [-verbose]

Parameters

Optionally, you can use this parameter to include disabled applications.

Table: srvctl status service Command Parameters

ParameterDescription
-db db_unique_nameSpecify the unique name of the database on which the service operates for which you want to check the status.
-pdb pdb_nameSpecify the name of the PDB on which the service operates for which you want to check the status.
-service " service_name_list "

Optionally, you can specify a comma-delimited list of service names for which you want to check status.

If you do not use this parameter, then SRVCTL lists the status of all services for the specified database.

-forceOptionally, you can use this parameter to include disabled applications.
-verboseOptionally, you can use this parameter to display detailed output.

srvctl stop service

Stops one or more services globally across the cluster database, or on the specified instance.

Syntax

To stop services for a particular node in the cluster:

srvctl stop service -node node_list [-stopoption IMMEDIATE|TRANSACTIONAL|NONE]
   [-drain_timeout timeout] [-wait {YES | NO}] [-force] [-noreplay] [-global_override] [-verbose]

To stop services for a database:

srvctl stop service -db db_unique_name [-pdb pluggable_database |
   -service "service_list" [-eval]] [-node node_list | -instance instance_name] [-relocate]
   [-stopoption IMMEDIATE|TRANSACTIONAL|NONE] [-drain_timeout timeout] [-wait {YES | NO}] [-force] [-noreplay]
   [-global_override] [-verbose]

Parameters

Note:

The policy-managed database deployment option is desupported in Oracle AI Database 26ai.

Table: srvctl stop service Command Parameters

ParameterDescription
-node node_listOptionally, you can specify a comma-separated list of node names. Use this parameter without the -db parameter to stop all services on the specified nodes. If you use the -db parameter, then only the services on the specified nodes for that database are stopped.
-db db_unique_nameSpecify a unique name for the database.
-pdb pluggable_databaseAlternatively, use this parameter to stop services running on a specific Pluggable Database.
-service " service_list "

Specify a particular service or a comma-delimited list of service names enclosed in double quotation marks ("") you want to stop.

If you do not provide a service name list, then SRVCTL stops all services on the database or on a specific instance.

-instance instance_nameOptionally, you can specify the name of the instance for which you want to stop services.
-evalUse this parameter to hypothetically evaluate the impact of the command on the system.
-stopoption IMMEDIATE|TRANSACTIONAL|NONE

Specify the method of stopping the service. If this attribute was previously set for the service, then that value is used as the default value if you do not include the -stopoption parameter in your command. Otherwise, the default is NONE.

  • IMMEDIATE permits sessions to drain before the service is stopped. Sessions that do not drain are terminated when the time limit specified by -drain_timeout is reached.
  • If you specify TRANSACTIONAL, then sessions are terminated as soon as they commit. The service is stopped when the time limit specified by -drain_timeout is reached and any remaining sessions are terminated.
  • If you specify NONE, then no sessions are terminated.

Note: You must use the -stopoption parameter with the -force parameter.

-drain_timeout timeout

Specify the time, in seconds, allowed for resource draining to be completed. Accepted values are an empty string (""), 0, or any positive integer. The default value is an empty string, which means that this parameter is not set. If it is set to 0, then draining occurs, immediately.

The draining period is intended for planned maintenance operations. During the draining period, all current client requests are processed, but new requests are not accepted. When set on the service this value is used when the command line value is not set.

Note: If the -drain_timeout value is not specified, then the maximum configured drain timeout of all the running services of the database on the specified nodes is used.

-wait {YES | NO}Choose YES to wait until service draining is completed on the node to stop the service.
-force [-noreplay]

Force SRVCTL to stop the service; this causes SRVCTL to disconnect all of the sessions using the stop option you specify (IMMEDIATE or TRANSACTIONAL), requiring the sessions using the service to reconnect and then connect to another instance.

Notes:

  • If you do not specify the -force parameter, then sessions already connected to this service stay connected, but new sessions cannot be established to the service.
  • Optionally, you can specify the -noreplay parameter if you do not want Application Continuity to replay in-flight transactions after a session is terminated.

    The -noreplay parameter is not limited to use with -force. However, if you do not want to replay in-flight transactions after you force the service to stop, then -force requires -noreplay.

-global_overrideOverride value to operate on a global service. SRVCTL ignores this parameter if the service is not a global service.
-verboseUse this parameter to display verbose output.

Examples

The following example command stops services running on the crmeast PDB in the crm database on instance crm1 using the IMMEDIATE method, allowing 60 seconds for services to transfer to another node:

$ srvctl stop service -db crm -pdb crmeast -instance crm1 -drain_timeout 60 -force
- stopoption immediate -verbose

The following example command stops all services running on the node node1 that are managed by Oracle Clusterware using the default stop option specified for each service and waiting until all sessions have drained from that node.

$ srvctl stop service -node node1 -wait yes