Purpose
The ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE ... statement is used to maintain SERVICE_NAME (service name) and control operations such as the creation, deletion, start, and stop of SERVICE_NAME.
Note
To manage service names and perform primary-standby tenant switching via OCP, see Daily primary-standby tenant switching.
Limitations and considerations
- The
METAandSYStenants do not support theSERVICE_NAMEfeature. - OceanBase Cloud Platform (OCP) ensures that within its managed clusters, only one primary tenant can exist under a single
SERVICE_NAME. Users must ensure this when settingSERVICE_NAMEthrough the CLI. - The
FAILOVERoperation automatically deletes allSERVICE_NAMEentries under the tenant. - A tenant can have at most one
SERVICE_NAME. - Connections established through
SERVICE_NAMEcannot execute maintenance commands related toSERVICE_NAMEor tenant primary-standby role conversion. Otherwise, anOB_OP_NOT_ALLOWerror will be returned.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase Database privileges, see Privilege classification in MySQL-compatible mode and Privilege classification in Oracle-compatible mode.
Syntax
ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE service_name [tenant = 'tenant_name'];
Parameters
Parameter |
Description |
|---|---|
| CREATE | Creates a service. After the service is created, it is automatically started. |
| DELETE | Deletes a service. Before deleting a service, it must be stopped. |
| START | Starts a service. After the service is started, you can establish a session or allow requests using this SERVICE_NAME. |
| STOP | Stops a service. After the service is stopped, no sessions can be established using this SERVICE_NAME, and no new sessions can be created. |
| service_name | Specifies the service name. |
| tenant_name | Optional. Specifies the tenant to operate on. If not specified, the current tenant is used as the default.
NoticeThe |
Examples
Create a service named service_mysql001 for the tenant mysql001.
ALTER SYSTEM CREATE SERVICE service_mysql001 TENANT = 'mysql001';
References
To query the
SERVICE_NAMEand its status of a tenant, see DBA_OB_SERVICES or oceanbase.CDB_OB_SERVICES.To query the execution status of maintenance commands related to
SERVICE_NAME, see DBA_OB_TENANT_EVENT_HISTORY or oceanbase.CDB_OB_TENANT_EVENT_HISTORY.For more information about
SERVICE_NAMEmaintenance commands, see Create a service.For more information about connecting to a tenant using
SERVICE_NAME, see Connect to an OceanBase tenant by using OBClient (MySQL-compatible mode) or Connect to an OceanBase tenant by using OBClient (Oracle-compatible mode).
