You can drop a tenant by using an SQL statement.
Considerations
When you drop a tenant, the databases and tables in this tenant are also dropped. Proceed with caution.
Limitations
You can drop a user tenant only from the sys tenant.
Procedure
Log on to the
systenant as therootuser.Execute any of the following statements to drop a tenant.
Statements for dropping a tenant:
obclient> DROP TENANT tenant_name [FORCE]or
obclient> DROP TENANT tenant_name PURGE;Parameters:
DROP TENANT:Drops the specified tenant to the recycle bin if the recycle bin feature is enabled for the sys tenant. The sys tenant can purge or restore tenants in the recycle bin. For more information, see Recycle bin.
Drops the specified tenant after a delay if the recycle bin feature is disabled by the sys tenant. A garbage collection (GC) operation is performed by a background thread. You can still query internal tables for information of the tenant. The delay is determined by the
schema_history_expire_timeparameter. The default delay is 7 days, which indicates that the tenant as well as databases and tables under the tenant will be deleted 7 days after theDROP TENANTstatement is executed.For more information about the
schema_history_expire_timeparameter, see schema_history_expire_time.
The
DROP TENANT PURGEstatement only drops tenants after a delay. It does not drop tenants to the recycle bin no matter whether the recycle bin feature is enabled by the sys tenant.The
FORCEparameter specifies that a tenant is immediately dropped no matter whether the recycle bin feature is enabled by the sys tenant.
Examples:
When the recycle bin feature is enabled by the sys tenant, drop tenant
t1and move the tenant to the recycle bin. When the recycle bin feature is disabled by the sys tenant, drop tenantt1after a delay.obclient> DROP TENANT t1;Drop tenant
t1after a delay, without moving the tenant to the recycle bin.obclient> DROP TENANT t1 PURGE;Immediately drop tenant
t1.obclient> DROP TENANT t1 FORCE;
After a tenant is dropped, the databases and tables of the tenant are also deleted. However, the resources that are allocated to the tenant are not deleted and can be allocated to other tenants.