Monday, May 24, 2010

Flashback Basics - Flashback table to timstamp

An example of using flashback table. Remember when flashing a table back to a point in the past, that reference constraints still come into play.

Create a table and enable rowmovement

DBATEST@tccdv2us> create table timtab(descr varchar(100), datetime date); Table created. DBATEST@tccdv2us> alter table timtab enable row movement; Table altered.


insert some records into the table

DBATEST@tccdv2us> insert into timtab values ('orginal table',sysdate); 1 row created. DBATEST@tccdv2us>commit; Commit complete. --wait abit DBATEST@tccdv2us>insert into timtab values ('added a row',sysdate); 1 row created. DBATEST@tccdv2us>commit; Commit complete. DBATEST@tccdv2us>select * from timtab; DESCR DATETIME -------------- -------------------- orginal table 24-MAY-2010 20:49:12 added a row 24-MAY-2010 22:03:51



Now lets flash the table back to a point in time



DBATEST@tccdv2us>flashback table timtab to timestamp to_timestamp('24-MAY-2010 20:49:30','DD-MON-YYYY HH24:MI:SS');

Flashback complete.

DBATEST@tccdv2us>select * from timtab;

DESCR DATETIME
------------- --------------------
orginal table 24-MAY-2010 20:49:12

1 row selected.



******************************************
keywords:
******************************************
rdbms version:
******************************************

No comments: