July 2, 2025

Resolving MySQL ERROR 5270: Object Not Found in Recycle Bin During Flashback

Troubleshoot MySQL ERROR 5270 caused by object visibility issues in the Recycle Bin. Learn strategies for safe flashback operations and tenant isolation in multi-tenant environments.

Phenomenon

When attempting to flashback a dropped table using SHOW RECYCLEBIN or FLASHBACK TABLE, users may encounter:

ERROR 5270 (HY000): Object not in RECYCLE BIN

Steps to Reproduce:

Create and drop a table:

CREATE TABLE test.a (i INT);  
DROP TABLE test.a;  

Attempt to flashback:

FLASHBACK TABLE test.a TO BEFORE DROP;  
-- Returns ERROR 5270  

Root Cause:
By default, FLASHBACK TABLE uses the ​current database context. If the table was dropped from a different database, the command fails unless explicitly qualified with database.table.

Key Findings & Solutions

1. ​Retrieve an Object’s Database in the Recycle Bin

Use the internal __all_recyclebin table:

SELECT 
  rb.database_id, 
  db.database_name, 
  rb.original_name 
FROM __all_recyclebin rb 
JOIN __all_virtual_database db ON rb.database_id = db.database_id;

2. ​Handling Duplicate Table Names

The Recycle Bin retains ​multiple versions​ of the same-named table. Flashback prioritizes the ​most recently dropped instance. Verify with:

SHOW RECYCLEBIN;  
-- Newest entry appears first  

3. ​Recycle Bin Visibility After Shutdown

The Recycle Bin remains accessible even when disabled:

SET SESSION recyclebin = 0;  
SHOW RECYCLEBIN; -- Still visible  

4. ​Tenant Isolation

Recycle Bin contents are ​tenant-specific:

  • Tenant A cannot access objects from Tenant B’s Recycle Bin.
  • Use ALTER SYSTEM CHANGE TENANT to switch contexts.

5. ​Post-Disable Flashback

Tables can still be recovered after disabling the Recycle Bin:

SET SESSION recyclebin = 0;  
FLASHBACK TABLE test.a TO BEFORE DROP; -- Works if object exists in __all_recyclebin  

Conclusion

  • Visibility: Use __all_recyclebin to locate objects across tenants/databases.
  • Safety: Always qualify table names with database.table during flashback.
  • Cleanup: Purge obsolete entries to manage storage:
PURGE RECYCLEBIN;  

For advanced scenarios, explore MySQL’s documentation on Recycle Bin architecture.

You will get best features of ChatDBA