【练习】flushback基于时间的闪回查询

1.创建table t1

15:19:41 SCOTT@ORA11GR2>create table t1 as select * from scott.emp;

Table created.

15:23:45 SCOTT@ORA11GR2>select table_name,tablespace_name from user_tables where table_name = 'T1';

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
T1                             USERS

2.drop table t1

15:24:33 SCOTT@ORA11GR2>drop table t1;

Table dropped.

3.查看回收站和tab

15:25:04 SCOTT@ORA11GR2>show recycle;
ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
---------------- ------------------------------ ------------ -------------------
T1               BIN$QSqfMdIlFhXgUwEAAH971w==$0 TABLE        2016-11-13:15:25:03
15:25:09 SCOTT@ORA11GR2>select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
BIN$QSqfMdIlFhXgUwEAAH971w==$0 TABLE
BONUS                          TABLE
DEPT                           TABLE
EMP                            TABLE
EMP1                           TABLE
SALGRADE                       TABLE

6 rows selected.

4.闪回查询

15:25:55 SCOTT@ORA11GR2>flashback table t1 to before drop;

Flashback complete.

15:26:21 SCOTT@ORA11GR2>select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
BONUS                          TABLE
DEPT                           TABLE
EMP                            TABLE
EMP1                           TABLE
SALGRADE                       TABLE
T1                             TABLE

6 rows selected.
原文地址:https://www.cnblogs.com/tomatoes-/p/6151282.html