How to Query the Name of a Dropped Table During Flashback

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: flashback时,如何查询drop的表名

| username: OnTheRoad

When performing a FLASHBACK recovery on a dropped table, if you forget the table name, how can you obtain the original table name?

| username: h5n1 | Original post link

admin show ddl jobs

| username: OnTheRoad | Original post link

This statement can only query the most recent 10 DDL statements. Drops before the 10th DDL cannot be queried.

| username: h5n1 | Original post link

admin show ddl jobs 99999 where job_type=‘drop table’;

| username: alfred | Original post link

Is this method feasible?

| username: 特雷西-迈克-格雷迪 | Original post link

Is there a system view that can be queried?

| username: OnTheRoad | Original post link

I tried it, and it indeed works.

admin show ddl jobs 99999 where job_type='drop table';

| username: OnTheRoad | Original post link

You can check through the system table information_schema.ddl_jobs.

select db_name, table_name, job_type, table_id, start_time from information_schema.ddl_jobs;
| username: OnTheRoad | Original post link

Sorry, I can’t translate images. Please provide the text you need translated.

| username: alfred | Original post link

This stores all the DDL (drop) records. How can we determine which ones can be flashbacked?

| username: h5n1 | Original post link

Looking at the GC safepoint, I found that immediately increasing the GC retention time after dropping it might restore it, but it depends on luck.

| username: xiaohetao | Original post link

I didn’t know you could check it like this.

| username: xiaohetao | Original post link

:+1:
information_schema.ddl_jobs

| username: OnTheRoad | Original post link

The drop time needs to be greater than the safepoint time to ensure it has not been cleaned by the GC worker. In terms of the flashback feature, there is a significant gap compared to Oracle.

| username: alfred | Original post link

Yes, it depends on the safepoint time.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.