Description
The ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE ... statement is used to maintain a SERVICE_NAME by controlling its creation, deletion, start, and stop operations.
Note
Manage service names and perform primary/standby switchover operations through OCP. For more information, see Perform routine switchover between primary and standby tenants.
Limitations and considerations
- The
METAandSYStenants do not support theSERVICE_NAMEfeature. - OceanBase Cloud Platform (OCP) ensures that within the clusters it manages, there can be only one primary tenant under a
SERVICE_NAME. You must ensure this setting forSERVICE_NAMEmanually via the command line. - The
FAILOVERoperation automatically drops allSERVICE_NAMEunder the tenant. - A tenant can have at most one
SERVICE_NAME. - For a connection established by using
SERVICE_NAME, you are not allowed to execute O&M commands related to the primary/standby role switchover ofSERVICE_NAMEand its tenants. Otherwise, theOB_OP_NOT_ALLOWerror is returned.
Privilege requirements
The user executing this statement must have the ALTER SYSTEM privilege. For more information about OceanBase AI Database privileges, see Permission classification.
Syntax
ALTER SYSTEM {CREATE | DELETE | START | STOP} SERVICE service_name [tenant = 'tenant_name'];
Parameters
Parameters |
Description |
|---|---|
| CREATE | After the service is created, it starts automatically. |
| DELETE | Delete a service. Before deleting a service, you must stop it first. |
| START | Start the service. After starting the service, you can use this SERVICE_NAME Establish a session or allow the request. |
| STOP | Stops the service. After the service is stopped, no sessions started through this SERVICE_NAME exist, and no new sessions can be established through this SERVICE_NAME. |
| service_name | Specify the service name. |
| tenant_name | Optional. Specifies the tenant to operate on. If not explicitly specified, the default tenant name is the current tenant.
NoticeThe |
Examples
Create a service named service_mysql001 for the tenant mysql001.
ALTER SYSTEM CREATE SERVICE service_mysql001 TENANT = 'mysql001';
References
Query the
SERVICE_NAMEand its status of a tenant by using views. For more information, see oceanbase.DBA_OB_SERVICES or oceanbase.CDB_OB_SERVICES.Use the view to specify
MODULEasSERVICE NAMEto query the execution status of O&M commands related toSERVICE_NAME. For more information, see oceanbase.DBA_OB_TENANT_EVENT_HISTORY or oceanbase.CDB_OB_TENANT_EVENT_HISTORY.Use
SERVICE_NAMEto connect to the tenant introduction information. For more information, see Connect to OceanBase AI Database by using OBClient.