时间点:time1
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
152713033
SQL> select count(*) from testvarchar;
COUNT(*)
----------
10000000
操作如下:
SQL> delete testvarchar;
10000000 rows deleted.
SQL> commit;
Commit complete.
SQL> select count(*) from testvarchar;
COUNT(*)
----------
0
时间点:time2
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
152883734
用Flashback功能查询以前的数据
SQL> select count(*) from testvarchar as of scn 152713033;
COUNT(*)
----------
10000000
SQL>
用flashback直接恢复表
SQL> flashback table testvarchar to scn 152713033;
flashback table testvarchar to scn 152713033
*
ERROR at line 1:
ORA-08189: cannot flashback the table because row movement is not enabled
SQL> alter table testvarchar enable row movement;
Table altered.
这个命令的作用是,允许Oracle 修改分配给行的rowid。在Oracle 中,插入一行时就会为它分配一个rowid,而且这一行永远拥有这个rowid。闪回表处理会对EMP 完成DELETE,并且重新插入行,这样就会为这些行分配一个新的rowid。要支持闪回就必须允许Oracle 执行这个操作
SQL> flashback table testvarchar to scn 152713033;
Flashback complete.
SQL> select count(*) from testvarchar;
COUNT(*)
----------
10000000
SQL>
-------完--------
阅读(1241) | 评论(0) | 转发(0) |