You can execute the DELETE SERVICE statement to delete a service not in use.
Limitations
You cannot execute the DELETE SERVICE statement in a session created based on a service name.
Prerequisites
You have the ALTER SYSTEM privilege.
Procedure
Log in to a user tenant or the
systenant of the cluster as the tenant administrator.Note that you must specify the corresponding parameters in the following sample code based on your actual database configurations.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -ACheck whether the service to be deleted is in the
STOPPEDstate.For more information, see Query the service status.
If the service is in the
STOPPEDstate, you can directly delete it. Otherwise, you must stop it first. For more information, see Stop a service.Delete the service.
Here is an example:
ALTER SYSTEM DELETE SERVICE service_name [TENANT [=] tenant_name];The parameters are described as follows:
service_name: the name of the service to be deleted.TENANT [=] tenant_name: the name of the tenant for which you want to delete the service. This parameter is valid only in thesystenant.
Here are some examples:
Delete a service named
s_hzfor a tenant namedmysql_tenantin thesystenant.obclient [oceanbase]> ALTER SYSTEM DELETE SERVICE s_hz TENANT = mysql_tenant;Delete a service named
s_hzin a user tenant.obclient > ALTER SYSTEM DELETE SERVICE s_hz;