Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to undo a TRUNCATE TABLE ?

resistanceIsFruitfulJan 6 2016 — edited Jan 6 2016

DB version: 12.1.0.2

OS : Oracle Linux 6.5

In the below metioned example, How can I bring the table to the pre-TRUNCATE state ? I tried doing a FLASBHACK TABLE , but it errored out as shown below

SQL> grant select on v_$database to scott;

Grant succeeded.

SQL> conn scott/tiger

Connected.

SQL>

SQL>

SQL> CREATE TABLE test2 (  id  NUMBER(10));

Table created.

SQL> INSERT INTO test2 (id) VALUES (2016);

1 row created.

SQL> commit;

Commit complete.

SQL> ALTER TABLE test2 ENABLE ROW MOVEMENT;

Table altered.

SQL> SELECT current_scn FROM v$database;

CURRENT_SCN

-----------

    1831058

SQL>

SQL> truncate table test2;

Table truncated.

SQL> SELECT current_scn FROM v$database;

CURRENT_SCN

-----------

    1831137

SQL> flashback table TEST2 to SCN 1831058;

flashback table TEST2 to SCN 1831058

                *

ERROR at line 1:

ORA-01466: unable to read data - table definition has changed


We have FLASHBACK DATABASE enabled in this DB, but we don't want to take the entire DB to past point in time just to get records from one table.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 3 2016
Added on Jan 6 2016
6 comments
850 views