You can delete a tenant by using SQL statements.
Delete a tenant by using SQL statements
After a tenant is deleted, the databases and tables of the tenant are also deleted. However, the resources that are allocated to the tenant is not deleted and can be allocated to other tenants.
You can use the following syntax to delete a tenant:
DROP TENANT | FORCE
or
DROP TENANT $tenant_name PURGE;
Where:
DROP TENANT:Moves the specified tenant to the recycle bin if the recycle bin feature is enabled at the tenant level. You can clear or restore tenants in the recycle bin. For more information, see Recycle bin at the tenant level.
Deletes the specified tenant with a delay if the recycle bin feature is disabled at the tenant level. A garbage collection (GC) operation is performed by a background thread. You can still query the information of the tenant by using an internal table. The delay duration for tenant deletion is determined by the
schema_history_expire_timeparameter. The default delay duration is seven days. For more information about theschema_history_expire_timeparameter, see schema_history_expire_time.
The
DROP TENANT PURGEstatement deletes tenants only with a delay. It does not move tenants to the recycle bin no matter whether the recycle bin feature is enabled.The FORCEparameter specifies that a tenant is immediately deleted no matter whether the recycle bin feature is enabled.
The following are sample statements:
Delete the tenant t1 with a delay and move the tenant to the recycle bin:
obclient> DROP TENANT t1;Delete the tenant t1 with a delay and do not move the tenant to the recycle bin:
obclient> DROP TENANT t1 PURGE;Immediately delete the tenant t1:
obclient> DROP TENANT t1 FORCE;