测试了一把:
SQL> select count(*) from test;
COUNT(*)
----------
652080
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:14:32
SQL> delete from test where rownum commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
552081
SQL> alter table test shrink space;
Table altered.
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:14:32','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
541427
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:21:06
SQL> delete from test where rownum commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
441428
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:21:06','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
541427
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:24:05
SQL> delete from test where rownum commit;
Commit complete.
SQL> alter table test shrink space;
Table altered.
SQL> select count(*) from test;
COUNT(*)
----------
441428
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:24:05','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
359267
每次做完shrink后再flashback,结果错了.
The following DDL operations change the structure of a table, so that you cannot subsequently use the TO SCN or TO TIMESTAMP clause to flash the table back to a time preceding the operation: upgrading, moving, or truncating a table; adding a constraint to a table, adding a table to a cluster; modifying or dropping a column; adding, dropping, merging, splitting, coalescing, or truncating a partition or subpartition (with the exception of adding a range partition).
|