An interesting question about ORACLE FLASHBACK TABLE

Source: Internet
Author: User

We know that,ORACLEThe FLASHBACK feature is added for 10 Gb.FLASHBACK TABLEIt is used to repair tables that are accidentally deleted. However, today we found an interesting problem with the flashback table. Let's take a look at the following: I will use an example to illustrate the interesting problem I encountered. You are welcome to discuss it.

 
 
  1. SQL> CONNECT SYSDBA/***** AS SYSDBA
  2.  
  3. Connected.
  4.  
  5. SQL> CREATE TABLE TEST (T VARCHAR2 (10 ));
  6.  
  7. The table has been created.
  8.  
  9. SQL> DROP TABLE TEST;
  10.  
  11. The table has been deleted.
  12.  
  13. SQL> FLASHBACK TABLE TEST TO BEFORE DROP;
  14.  
  15. FLASHBACK TABLE TEST TO BEFORE DROP
  16.  
  17. *
  18.  
  19. Row 3 has an error:
  20.  
  21. ORA-38305: the object is not in the recycle bin

ORA-38305 error, at first I thought it was caused by the recycle bin mechanism parameter OFF, Oracle10g, introduced the recycle bin mechanism, the drop data table is saved in the recycle bin. When a data table is deleted by mistake, you can recycle it from the recycle bin. The recycle bin mechanism is similar to the recycle bin mechanism on Windows. In Windows, when we choose to delete a file, the file is not deleted from the hard disk in essence, but the file is renamed in one form, so that you can see it from the recycle bin. So I checked the RECYCLEBIN parameter.

 

The strange thing is that the recycle bin parameter is enabled. The SQL> SHOW RECYCLEBIN; table cannot be deleted. What the hell is going on? It took a long time. Later, I modified the tablespace used to create the table, and everything was OK.

 
 
  1. SQL> CREATE TABLE TEST (T VARCHAR2 (10) TABLESPACE USERS;
  2.  
  3. The table has been created.
  4.  
  5. SQL> DROP TABLE TEST;
  6.  
  7. The table has been deleted.
  8.  
  9. SQL> SHOW RECYCLEBIN;
  10.  
  11. ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
  12.  
  13. -----------------------------------------------------------------------------
  14.  
  15. Test bin $ gVtRcd2NTqihW6yM4vs0Hw = $0 TABLE: 12: 40: 42
  16.  
  17. SQL> FLASHBACK TABLE TEST TO BEFORE DROP;
  18.  
  19. Flash back complete.
  20.  
  21. SQL> SELECT * FROM TEST;
  22.  
  23. Unselected row

If you do not specify the table space to be created, the default table space SYSTEM is used. You can view the table space using SELECT TABLESPACE_NAME FROM USER_TABLES WHERE TABLE_NAME = 'test. Later, I repeated this experiment multiple times, and the results are all the same. It seems that the flashback table feature cannot be used in the tablespace SYSTEM. It is very interesting. Later I checked the information to know: you cannot 'flashback table to before drop 'a table which has been created in the SYSTEM tablespace. the table is sent to the recyclebin only if it existed in some other tablespace other than SYSTEM tablespace and that tablespace must be locally managed. it seems that ORACLE limits the use of the recycle bin mechanism in the tablespace SYSTEM. I don't know why ORACLE has this restriction.

We will introduce the Oracle database flashback table knowledge here, hoping to help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.