After creating a service, you can start it by executing the START SERVICE statement.
Limitations
You cannot execute the START SERVICE statement in a session created based on a service name.
Prerequisites
You have the
ALTER SYSTEMprivilege to execute theSTART SERVICEstatement.The units for the tenant do not contain temporarily offline OBServer nodes. Otherwise, the temporarily offline OBServer nodes cannot provide the service specified by the service name after you execute the
START SERVICEstatement. Therefore, we recommend that you wait until the temporarily offline OBServer nodes are recovered or permanently offline before you execute theSTART SERVICEstatement.For details on confirming whether the tenant's units contain temporarily offline machines, see Prerequisites in Create a service.
Procedure
Log in to a user tenant or the
systenant of the cluster as the tenant administrator.Below is an example. Specify the parameters based on your actual environment when connecting.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -ACheck whether the service to be started is in the
STARTEDstate.For more information, see Query the service status.
If the tenant's service status is not
STARTED, the tenant'sSWITCHOVER_STATUSmust beNORMAL, which indicates that the tenant is not in an intermediate state during primary/standby switchover. You can query the tenant'sSWITCHOVER_STATUSin either of the following ways:- Query the
SWITCHOVER_STATUSof a specified tenant in thesystenant.
obclient [oceanbase]> SELECT TENANT_ID, TENANT_NAME, SWITCHOVER_STATUS FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_NAME = mysql_tenant;Query the
SWITCHOVER_STATUSof the current tenant in a user tenant.MySQL-compatible modeOracle-compatible modeQuery statement in MySQL-compatible mode:
obclient [oceanbase]> SELECT TENANT_ID, TENANT_NAME, SWITCHOVER_STATUS FROM oceanbase.DBA_OB_TENANTS;Query statement in Oracle-compatible mode:
obclient [SYS]> SELECT TENANT_ID, TENANT_NAME, SWITCHOVER_STATUS FROM SYS.DBA_OB_TENANTS;
- Query the
Start the service.
The statement is as follows:
ALTER SYSTEM START SERVICE service_name [TENANT [=] tenant_name];Parameters:
service_name: the name of the service to be started.TENANT [=] tenant_name: the name of the tenant for which you want to start the service. Only thesystenant can specify this parameter. User tenants cannot specify it.
Examples:
Start the service named
s_hzfor the tenantmysql_tenantin thesystenant.obclient [oceanbase]> ALTER SYSTEM START SERVICE s_hz TENANT = mysql_tenant;Start the service named
s_hzin a user tenant.obclient > ALTER SYSTEM START SERVICE s_hz;
If
Query OKis returned, you can connect to all OBServer nodes except the permanently offline ones in the units for the tenant by specifying the service name. IfOB_SERVICE_NOT_FULLY_STARTEDis returned, you can connect to only some of OBServer nodes except the permanently offline ones in the units for the tenant by specifying the service name. You can query the connectable OBServer nodes from the CDB_OB_TENANT_EVENT_HISTORY view in thesystenant or the DBA_OB_TENANT_EVENT_HISTORY (MySQL-compatible mode) or DBA_OB_TENANT_EVENT_HISTORY (Oracle-compatible mode) view in a user tenant.