1
votes

I have searched for the flashback command. Somewhere it is written we can rollback the truncate operation, and somewhere it is written we can't rollback. Can the FLASHBACK command in Oracle used to rollback the truncate table operation?

1
Flashback isn't the same as rollback, but no, it can't recover from a truncate and you can't do a flashback query past a truncate. It can recover from a drop table which might be the confusion. Perhaps you could quote and/or link to the sources for the two conflicting statements? - Alex Poole

1 Answers

3
votes

You need to have Flashback Data Archive enabled. Then the truncate could be reversed with a statement like this:

insert into <truncated_table> 
   select * from <truncated_table> as of timestamp <some time>;

Thanks to @Jon Heller for adding this useful information about the new feature:

This requires version 11.2 or higher, which introduced support for DDL statements such as truncate.