Tuesday, April 16, 2013

Point In Time Recovery through Flashback in 11g.

For PITR you don't need to enable the Flashback in your database.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO

SQL>conn scott/tiger
SQL> select * from test;

no rows selected

SQL> insert into test
  2  select * from emp;

14 rows created.

SQL> select count(*) from test;

  COUNT(*)
----------
       126

SQL> delete from test;

126 rows deleted.

SQL> conn /as sysdba
Connected.

SQL> select to_char(sysdate,'YYYY/MM/DD HH:MI:SS') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2013/04/16 05:00:29

SQL> conn /as sysdba
Connected.
SQL> flashback table scott.test
  2  to timestamp to_timestamp('2013/04/16 04:45:00','YYYY/MM/DD HH:MI:SS');
flashback table scott.test
                      *
ERROR at line 1:
ORA-08189: cannot flashback the table because row movement is not enabled


SQL> alter table scott.test enable row movement;

Table altered.

SQL> flashback table scott.test
  2  to timestamp to_timestamp('2013/04/16 04:45:00','YYYY/MM/DD HH:MI:SS');

Flashback complete.

SQL> select count(*) from scott.test;

  COUNT(*)
----------
       126

Thanks!!!

No comments:

Post a Comment