Description
You can execute the ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE ... statement to perform maintenance on the SERVICE_NAME (service name) and control the creation, deletion, startup, and shutdown of the service.
Note
For more information about how to manage service names and perform primary/standby switchover operations through OCP, see Daily primary/standby tenant switchover.
Limitations and considerations
- The
SERVICE_NAMEfeature is not supported in theMETAorSYStenant. - OceanBase Cloud Platform (OCP) ensures that only one primary tenant can be created under the
SERVICE_NAMEin the clusters it manages. If you want to create a primary tenant under theSERVICE_NAME, you need to make sure that no primary tenant has been created under the sameSERVICE_NAMEin the clusters managed by OCP. - The
FAILOVERoperation automatically deletes allSERVICE_NAMEfrom the tenant. - A tenant can have only one
SERVICE_NAME. - Connections established through
SERVICE_NAMEdo not have privileges to perform O&M commands related to the primary/standby role ofSERVICE_NAME. Otherwise, anOB_OP_NOT_ALLOWerror is returned.
Privilege requirements
The user who executes this statement must have the ALTER SYSTEM privilege. For more information about privileges in OceanBase Database, see Privilege types in MySQL mode and Privilege types in Oracle mode.
Syntax
ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE service_name [tenant = 'tenant_name'];
Parameter explanation
Parameter |
Description |
|---|---|
| CREATE | Creates a service. After the service is created, it is automatically started. |
| DELETE | Deletes a service. Before you delete a service, make sure that it has been stopped. |
| START | Starts the service. After the service is started, you can establish a session or allow requests through this SERVICE_NAME. |
| STOP | Stops the service. After the service is stopped, no session is started or established by using the SERVICE_NAME. |
| service_name | The name of the service. |
| tenant_name | Optional. The name of the tenant to operate on. If you do not specify the tenant name, the default tenant name is the current tenant name.
NoticeThe |
Example
Create a service named service_mysql001 for the mysql001 tenant.
ALTER SYSTEM CREATE SERVICE service_mysql001 TENANT = 'mysql001';
References
For more information about the
SERVICE_NAMEand its status of a tenant, query the DBA_OB_SERVICES or oceanbase.CDB_OB_SERVICES view.For more information about the execution of O&M commands related to a specific
SERVICE_NAME, query the DBA_OB_TENANT_EVENT_HISTORY or oceanbase.CDB_OB_TENANT_EVENT_HISTORY view, specifyingMODULEasSERVICE NAME.For more information about the
SERVICE_NAMEO&M command, see Create a service.For more information about how to connect to a tenant using
SERVICE_NAME, see Connect to an OceanBase tenant (MySQL mode) or Connect to an OceanBase tenant (Oracle mode).
