You can use this statement to restore deleted tenants from the recycle bin.
The recycle bin must be enabled. You can run the
show variables like 'recyclebin ';statement to check whether the recycle bin is enabled.
OceanBase(admin@test)> show variables like 'recyclebin'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | recyclebin | ON | +---------------+-------+ 1 row in set (0.00 sec)
If the recycle bin is disabled, run the
set recyclebin = on; statement to enable it. Tenants in the recycle bin are not actually deleted and still occupy storage space. You can run the
purge recyclebin; command to purge them from the recycle bin.
FLASHBACK TENANT tenant_name TO BEFORE DROP [RENAME to new_tenant_name];
Specifies the name of the tenant to be restored. You can use the original name of the tenant before it is dropped to the recycle bin or the name of the tenant in the recycle bin. The name of the tenant in the recycle bin is unique and can identify the tenant. The original name of the tenant may be repeated. If you use the original name of the tenant, the tenant entered the recycle bin at the latest time is restored.
Renames the tenant after it is restored.
Restore tenant tenant1 from the recycle bin.
obclient> flashback tenant tenant1 to before drop; Query OK, 0 rows affected (0.01 sec)