On the principle of Oracle database Flash-back deletion table

Source: Internet
Author: User

First of all, you should understand that the object of the flashback deletion is simply a table, it allows you to restore the previously deleted table to the state before it was deleted, as well as to restore all indexes and any permissions and triggers, and the unique primary key and non-null constraints will also be restored (note that foreign keys are not included).

At Oracle 10g, the drop TABLE command is implemented in such a way that it actually does not delete the table at all, but simply renames the table and puts the renamed table in the Recycle Bin (each user has a Recycle Bin) that can be user_ The RecycleBin data dictionary looks at the contents of the current user's Recycle Bin, such as the name of the table renamed after the drop and the name before the drop, and so on, we already know that rname a table does not alter the object number of the table, and when the user issues a drop TABLE command, It has been mapped internally to the Rename command, the object number of the table after the deletion of the table has not changed, and the size of the storage space has not changed, only at this time it occupies space can be occupied (personally think it should be when there is no other space to use it will occupy it), then there will be problems, Cause the flash-back delete operation is not necessarily 100% successful, and then when you delete a table, you re-establish a table of the same name, at this time you want to rename the table to flash back delete operation, such as: Flashback table table_name to before drop rename new _name;.

Attention:

1.truncate tables cannot be flashed back to delete operations.

2.drop table name purge; The deleted table deletes more references and cannot be recovered.

3.drop user Liu Cascade, so that the deleted users Liu's table is not to be flashed back,

4. If you delete a table and then re-establish a table of the same name, to delete the newly created table, then the Recycle Bin will have two different name of the Recycle Bin table, the default flash-back delete operation will restore the latest version, you can specify the Recycle Bin table name to specify the table to be restored. such as: Flashback table "Bin$cxltgwchmotguwpyqcbkaa==$0" to before drop;

5. If there are indexes and constraints on the table, in this case, when you drop the table, the corresponding constraints and indexes are renamed in the Recycle Bin, and when you flash back, the associated indexes and constraints remain in the Recycle Bin name, but can be renamed to the previous name: Alter INDEX.         Index in the Recycle Bin name "rename to Name_inx;" ALTER TABLE TABLE_NAME RENAME constraint "Constrains the name of the Recycle Bin" to the previous name;

6.flashback drop cannot flash back to table in system table space

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.