Flashback features are really a very useful thing if we have such a situation. Depending on the undo retention settings, we could travel past in time!
One manager was looking for an old snapshot of records before it was being modified by the user. This is how I was able to retrieve the thing -
* Created a temp table with the data just before the unwanted changes -
CREATE TABLE tmp_users AS
(SELECT * FROM users
AS OF TIMESTAMP TO_TIMESTAMP('27-DEC-09 12:18:00','DD-MON-YY HH24: MI: SS')
WHERE user_id = '7EF3D2SP');
* There is another cool thing is 10g and onwards - one could flashback a whole table to some point in time.
FLASHBACK TABLE users TO TIMESTAMP TO_TIMESTAMP('27-DEC-09 12:18:00','DD-MON-YY HH24: MI: SS');
* Even, if a table is accidentally dropped, nothing to worry about :-)
FLASHBACK TABLE users TO BEFORE DROP;
I know, there is another cool thing called Flashback Database to rewind the whole database to some period in past! This is much simpler than the traditional point in time recovery with archived redo logs - not posting anything on that today.
***
No comments:
Post a Comment