Introduction to Oracle's Flashback table

Source: Internet
Author: User
Tags commit set time

Because the rowid of the data being flashback back may change.

Sql> CREATE TABLE TT (ID int,name varchar2 (4000)) tablespace users;

Table has been created.

Sql> ALTER TABLE TT Pctfree 50;

The table has changed.

Sql> INSERT INTO TT values (1,rpad (' A ', 4000, ' + '));

1 lines have been created.

Sql> commit;

Submit completed.

Sql> INSERT INTO TT values (2,rpad (' B ', 4000, ' + '));

1 lines have been created.

Sql> commit;

Submit completed.

Sql> Select Id,substr (name,1,1), rowid from TT;

ID SU ROWID

---------- -- ------------------

1 a AAAC+FAAEAAAGT3AAA

2 b aaac+faaeaaagt4aaa

sql> analyze table TT compute statistics;

The table is parsed.

Sql> Delete from TT;

2 rows have been deleted.

Sql> commit;

Submit completed.

Sql> INSERT INTO TT values (3,rpad (' C ', 4000, ' + '));

1 lines have been created.

Sql> commit;

Submit completed.

--when inserting a id=3, it's obvious that you have repeatedly used the ROWID to delete id=1

Sql> Select Id,substr (name,1,1), rowid from TT;

ID SU ROWID

---------- -- ------------------

3 C AAAC+FAAEAAAGT3AAA

Sql> select Current_scn from V$database;

Current_scn

-----------

379146

Sql> set time on

11:58:34 sql> Select ID from TT as of SCN 379146;

Id

----------

3

11:58:37 sql> Select ID from TT as of SCN 379140;

Id

----------

3

11:58:42 sql> Select ID from TT as of SCN 379130;

Id

----------

3

11:58:47 sql> Select ID from TT as of SCN 379100;

Id

----------

1

2

11:58:52 sql> Flashback table TT to SCN 379100;

Flashback table TT to SCN 379100

*

Line 1th Error:

ORA-08189: Cannot flash back the table because row move is not enabled

11:59:42 sql> ALTER TABLE TT enable row movement;

The table has changed.

11:59:57 sql> Flashback table TT to SCN 379100;

Flash back complete.

--tt was flashback back rowID has changed, which is why flashback

Table needs to enable row movement, in the normal table

The rowid of the data is definitely not to be changed.

12:00:25 sql> Select Id,substr (name,1,1), rowid from TT;

ID SU ROWID

---------- -- ------------------

2 b Aaac+faaeaaagt3aab

1 a AAAC+FAAEAAAGT4AAA

12:00:35 sql>

This article URL address: http://www.bianceng.cn/database/Oracle/201410/45559.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.