You can execute the SHOW RECYCLEBIN statement to query for objects in the recycle bin.
Considerations
Because only the sys tenant can delete tenants, MySQL-compatible and Oracle-compatible user tenants can be moved only to the recycle bin of the sys tenant after they are dropped. Tenant deletion supports forced and non-forced modes. For more information, see DROP TENANT. In the sys tenant, you can view databases, tables, and indexes of the current tenant as well as all tenant recycle bin objects in the system. In a MySQL-compatible user tenant, you can view only databases, tables, and indexes in the recycle bin. In an Oracle-compatible user tenant, you can view only tables and indexes in the recycle bin.
Background information
When you perform a DROP operation on a database object or tenant:
If the recycle bin is enabled, the object is moved to the recycle bin and can be queried in the recycle bin.
If the recycle bin is disabled, the object is not moved to the recycle bin and cannot be queried in the recycle bin.
Procedure
Log in to the database as a tenant administrator of the
systenant or a user tenant.Note
- The administrator user of a MySQL-compatible tenant is
root, and that of an Oracle-compatible tenant isSYS. - To view tenant recycle bin objects, you must log in to the database as the
systenant.
Below is a connection example. Use your actual environment when connecting to the database.
obclient -h10.xx.xx.xx -P2883 -uroot@sys#obdemo -p***** -AFor more detailed guidance on connecting to the database, see Overview of connection methods (MySQL-compatible mode) and Overview of connection methods (Oracle-compatible mode).
- The administrator user of a MySQL-compatible tenant is
Execute the following statement to view recycle bin objects.
obclient [(none)]> SHOW RECYCLEBIN; +-------------------------------------+-------------------+--------+----------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +-------------------------------------+-------------------+--------+----------------------------+ | RECYCLE_$_100017_1672050541224936 | oracle001 | TENANT | 2023-01-16 11:01:40.258000 | | __recycle_$_100017_1673426335319344 | __idx_500788_idx1 | INDEX | 2023-01-11 16:38:55.318878 | | __recycle_$_100017_1673426335329040 | __idx_500788_idx2 | INDEX | 2023-01-11 16:38:55.328312 | | __recycle_$_100017_1673426335331800 | t1 | TABLE | 2023-01-11 16:38:55.331481 | +-------------------------------------+-------------------+--------+----------------------------+ 4 rows in setThe fields in the returned result are described as follows:
OBJECT_NAME: The name of the object in the recycle bin.ORIGINAL_NAME: The original name of the object.TYPE: The type of the recycle bin object.The sys tenant supports four types:
INDEX,TABLE,DATABASE, andTENANT. In this example,oracle001is a tenant-type recycle bin object.MySQL-compatible user tenants support three types:
INDEX,TABLE, andDATABASE.Oracle-compatible user tenants support two types:
INDEXandTABLE.
CREATETIME: The time when the object was placed in the recycle bin.
References
For more information about the recycle bin, see the following: