Oracle Flashback Drop: Undo a DROP TABLE Operation

7.4Oracle Flashback Drop: Undoa DROP TABLE Operation

Oracle Flashback Drop reverses theeffects of aDROP TABLEoperation. It can be used to recover afterthe accidental drop of a table. Flashback Drop is substantially faster thanother recovery mechanisms that can be used in this situation, such aspoint-in-time recovery, and does not lead to any loss of recent transactions ordowntime.

OracleFlashback Drop

When you drop a table, the databasedoes not immediately remove the space associated with the table. Instead, thetable is renamed and, along with any associated objects, it is placed intheRecycle Binof the database. The Flashback Drop operationrecovers the table from the recycle bin.

To understand how to use OracleFlashback Drop, you must also understand how the recycle bin works, and how toaccess and manage its contents.

This section covers the followingtopics:

本部分包括如下内容:

What is the Recycle Bin?How Tables and Other Objects Are Placed in the Recycle BinNaming Convention for Objects in the Recycle BinViewing and Querying Objects in the Recycle BinRecycle Bin Capacity and Space PressurePurging Objects from the Recycle Bin

7.4.1What is the Recycle Bin?

Therecycle bin is a logical container for all dropped tablesand their dependent objects. When a table is dropped, the database will storethe table, along with its dependent objects in the recycle bin so that they canbe recovered later. Dependent objects which are stored in the recycle bininclude indexes, constraints, triggers, nested tables, LOB segments and LOBindex segments.

7.4.2How Tables and Other Objects Are Placed inthe Recycle Bin

Tables are placed in the recycle bin along with their dependentobjects whenever aDROPTABLEstatement is executed. Forexample, this statement places theEMPLOYEE_DEMOtable, along withany indexes, constraints, or other dependent objects listed previously, in therecycle bin:

SQL> DROP TABLE EMPLOYEE_DEMO;Table Dropped

The table and its dependent objects will remain in therecycle bin until they arepurgedfrom the recycle bin.You can explicitly purge a table or other object from the recycle bin with theSQL*PlusPURGEstatement, as described in. If you aresure that you will not want to recover a table later, you can drop itimmediately and permanently, instead of placing it in the recycle bin, by usingthePURGEoption of theDROP TABLEstatement, as shown inthis example:

drop table

DROP TABLE employee_demo PURGE;

Even if you do not purge objects from the recycle bin, thedatabase purges objects from the recycle bin to meet tablespace spaceconstraints. See"RecycleBin Capacity and Space Pressure"formore details.

即便我们没有将回收站中的对象清空出去,数据库也会将这些对象清空以便释放表空间压力。

Recycle bin objects are not counted as used space. If you querythe space views to obtain the amount of free space in the database, objects inthe recycle bin are counted as free space.

回收站战友的空间不会被标记为”已使用“。如果我们查询有关数据库空闲空间的视图,那么回收站中的对象所占用的空间是被标记为空闲空间的。

Dropped objects still appear in theviewsUSER_TABLES,ALL_TABLES,DBA_TABLES,USER_INDEX,ALL_INDEXandDBA_INDEX.A new column,DROPPED, is set toYESfor these objects. You canuse theDROPPEDcolumn in queries against these views to view onlyobjects that are not dropped.

To view only objects in the recycle bin, usetheUSER_RECYCLEBINandDBA_RECYCLEBINviews, describedlater in this chapter.

7.4.3Naming Convention for Objects in theRecycle Bin

When a table and its dependent objects are moved totherecycle bin, they are assigned unique names, to avoid name conflictsthat may arise in the following circumstances:

当数据表和依赖与该表的对象被移动到回收站后,他们会把分配唯一的名称,以避免在如下情况下,发生名称冲突

A user drops a table, creates another with the same name, then drops the second table.

用户删除了一个表,创建了另一张同名的表,然后又将第二张表删除

Two users have tables with the same name, and both users drop their tables.

两个用户创建了相同名称的表,并且两个用户都删除了表

The assigned names are globally unique and are used to identifythe objects while they are in the recycle bin. Object names are formed asfollows:

被分配的表的名称是全局唯一的,以便唯一标识这些在回收站的对象。对象名称是按照如下格式进行命名的

文画音,看似耳目所为,其实是内心世界的感受。

Oracle Flashback Drop: Undo a DROP TABLE Operation

相关文章:

你感兴趣的文章:

标签云: