首页 > 技术文章 > flashback table

jycjy 2019-09-11 16:31 原文

前提:开启回收站

   查看回收站状态

SQL> show parameter recyclebin;

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
recyclebin			     string	 ON

  

SQL> desc test;
 Name					   Null?    Type
 ----------------------------------------- -------- ----------------------------
 TABLE_NAME				   NOT NULL VARCHAR2(30)
SQL> drop table test;

Table dropped.
SQL> select original_name,operation,droptime from recyclebin;
no rows selected
SQL> flashback table test to before drop;
flashback table test to before drop
*
ERROR at line 1:
ORA-38305: object not in RECYCLE BIN
SQL> 

  

SQL> show user
USER is "SYS"
SQL> 

 奇怪,为什么回收站是开的,删除时不进回收站呢?系统表空间是不放入回收站的

scott用户就没有问题:

SQL> show user
USER is "SCOTT"
SQL>create table  test as select * from emp;
Table created.

SQL> select count(1) from test;

  COUNT(1)
----------
       270

SQL> drop table test;

Table dropped.

SQL> select original_name,operation,droptime from recyclebin;

ORIGINAL_NAME			 OPERATION DROPTIME
-------------------------------- --------- -------------------
TEST				 DROP	   2019-09-11:02:13:37

SQL> flashback table test to before drop;

Flashback complete.

SQL> select count(1) from test;

  COUNT(1)
----------
       270

SQL> 

 回收站开启的方法:

alter session set recyclebin=off;

alter system set recyclebin=off DEFERRED;

 

推荐阅读