1. Ensure that the prerequisites described in Prerequisites of Flashback Drop are met.

    The following list summarizes the user privileges required for the operations related to Flashback Drop and the recycle bin:
    
    DROP
    
    Any user with DROP privileges over an object can drop the object, placing it in the recycle bin.
    
    FLASHBACK TABLE ... TO BEFORE DROP
    
    Privileges for this statement are tied to the privileges for DROP. That is, any user who can drop an object can perform Flashback Drop to retrieve the dropped object from the recycle bin.
    
    PURGE
    
    Privileges for a purge of the recycle bin are tied to the DROP privileges. Any user having DROP TABLE, DROP ANY TABLE, or PURGE DBA_RECYCLE_BIN privileges can purge the objects from the recycle bin.
    
    READ or SELECT and FLASHBACK for objects in the Recycle Bin
    
    Users must have the READ or SELECT and FLASHBACK privileges over an object in the recycle bin to query the object in the recycle bin. Any users who had the READ or SELECT privilege over an object before it was dropped continue to have the READ or SELECT privilege over the object in the recycle bin. Users must have FLASHBACK privilege to query any object in the recycle bin, because these are objects from a past state of the database.
    
    Objects must meet the following prerequisites to be eligible for retrieval from the recycle bin:
    
    The recycle bin is only available for non-system, locally managed tablespaces. If a table is in a non-system, locally managed tablespace, but one or more of its dependent segments (objects) is in a dictionary-managed tablespace, then these objects are protected by the recycle bin.
    
    Tables that have fine-grained auditing (FGA) and Virtual Private Database (VPD) policies defined over them are not protected by the recycle bin.
    
    Partitioned index-organized tables are not protected by the recycle bin.
    
    The table must not have been purged, either by a user or by Oracle Database during a space reclamation operation.

    Prerequisites

  2. Connect SQL*Plus to the target database and obtain the name of the dropped table in the recycle bin.

    You can use the SQL*Plus command SHOW RECYCLEBIN as follows:

    SHOW RECYCLEBIN;
    
    ORIGINAL NAME    RECYCLEBIN NAME                   TYPE         DROP TIME
    ---------------- --------------------------------- ------------ -------------
    EMPLOYEE_DEMO BIN$gk3lsj/3akk5hg3j2lkl5j3d==$0 TABLE 2013-04-11:17:08:54

    The ORIGINAL NAME column shows the original name of the object, whereas the RECYCLEBIN NAME column shows the name of the object as it exists in the bin.

    Alternatively, you can query USER_RECYCLEBIN or DBA_RECYCLEBIN to obtain the table name. The following example queries the RECYCLEBIN view to determine the original names of dropped objects:

    SELECT object_name AS recycle_name, original_name, type
    FROM recyclebin; RECYCLE_NAME ORIGINAL_NAME TYPE
    -------------------------------- --------------------- ----------
    BIN$gk3lsj/3akk5hg3j2lkl5j3d==$0 EMPLOYEE_DEMO TABLE
    BIN$JKS983293M1dsab4gsz/I249==$0 I_EMP_DEMO INDEX

    If you plan to manually restore original names for dependent objects, then ensure that you make note of each dependent object's system-generated recycle bin name before you restore the table.

    Note:

    Object views such as DBA_TABLES do not display the recycle bin objects.

  3. Optionally, query the table in the recycle bin.

    You must use the recycle bin name of the object in your query rather than the object's original name. The following example queries the table with the recycle bin name of BIN$gk3lsj/3akk5hg3j2lkl5j3d==$0:

    SELECT *
    FROM "BIN$gk3lsj/3akk5hg3j2lkl5j3d==$0";

    Quotation marks are required because of the special characters in the recycle bin name.

    Note:

    If you have the necessary privileges, then you can also use Flashback Query on tables in the recycle bin, but only by using the recycle bin name rather than the original table name. You cannot use Data Manipulation Language (DML) or DDL statements on objects in the recycle bin.

  4. Retrieve the dropped table.

    Use the FLASHBACK TABLE ... TO BEFORE DROP statement. The following example restores the BIN$gk3lsj/3akk5hg3j2lkl5j3d==$0 table, changes its name back to hr.employee_demo, and purges its entry from the recycle bin:

    FLASHBACK TABLE "BIN$gk3lsj/3akk5hg3j2lkl5j3d==$0" TO BEFORE DROP;
    

    The table name is enclosed in quotation marks because of the possibility of special characters appearing in the recycle bin object names.

    Alternatively, you can use the original name of the table:

    FLASHBACK TABLE HR.EMPLOYEE_DEMO TO BEFORE DROP;
    

    You can also assign a new name to the restored table by specifying the RENAME TO clause. For example:

    FLASHBACK TABLE "BIN$gk3lsj/3akk5hg3j2lkl5j3d==$0" TO BEFORE DROP
    RENAME TO hr.emp_demo;
  5. Optionally, verify that all dependent objects retained their system-generated recycle bin names.

    The following query determines the names of the indexes of the retrieved hr.employee_demo table:

    SELECT INDEX_NAME
    FROM USER_INDEXES
    WHERE TABLE_NAME = 'EMPLOYEE_DEMO'; INDEX_NAME
    ------------------------------
    BIN$JKS983293M1dsab4gsz/I249==$0
  6. Optionally, rename the retrieved indexes to their original names.

    The following statement renames the index to its original name of i_emp_demo:

    ALTER INDEX "BIN$JKS983293M1dsab4gsz/I249==$0" RENAME TO I_EMP_DEMO;
    
  7. If the retrieved table had referential constraints before it was placed in the recycle bin, then re-create them.

    This step must be performed manually because the recycle bin does not preserve referential constraints on a table.

最新文章

  1. Linux下的压缩和解压缩命令——compress/uncompress
  2. POM
  3. C#函数式编程之缓存技术
  4. linux matlab2013b 安装教程
  5. 重新开始学习c#啦,希望能坚持下去!
  6. js实现FileUpload选择图片后预览功能
  7. select的使用(二)
  8. 将vim改造成C/C++开发环境(IDE) 2011
  9. iframe 元素
  10. 【软件技巧】Sublime Text为不同语法定义不同高亮
  11. Sliverlight之 故事板
  12. SpringMVC一路总结(
  13. js中运动框架的封装
  14. nodejs 构建本地web测试服务器 以及 解决访问静态资源的问题!
  15. 《SpringMVC从入门到放肆》二、SpringMVC的执行流程及默认配置
  16. Sublime + Python3 + 虚拟环境 + 去除 中文输出乱码
  17. TabLayout您可能不知道的实用用法
  18. DLL加载,设置相对路径
  19. CSS表单3 光标样式 (每个位置鼠标放上去的样式不同)
  20. CSS3 根据屏幕大小显示内容(@media)

热门文章

  1. nginx重新编译安装upload模块
  2. 断开ssh链接在后台继续运行命令
  3. Linux中的各种锁及其基本原理
  4. django中配置MySql
  5. Gradle Settings 类的学习
  6. java中使用SimpleDateFormat实现字符串和日期的相互转换
  7. Androidstudio中添加jar包
  8. MySQL存储过程、触发器、自定义函数、事务
  9. $strobe$monitor$display
  10. 通过virsh console进入虚拟机