About flashback table

Source: Internet
Author: User

Flashback table uses the data in the undo tablespace to implement data rollback. To perform flashback on a table, you must always grant row movement to the table. Otherwise, an error occurs. Let's make an experiment to verify it: first check scott. dd table can be row movement [SQL] SQL> select row_movement from dba_tables where owner = 'Scott 'and table_name = 'dd'; ROW_MOVE -------- DISABLED we found that DD table row movement is not available. When row movement is unavailable, check whether the flashback table can be used. [SQL] SQL> select current_scn from v $ database; CURRENT_SCN ----------- 7514420 SQL> delete from scott. dd; 1 row has been deleted. SQL> commit; submitted completely. SQL> flashback table scott. dd to scn 7514420; flashback table scott. dd to scn 7514420 * 1st row error: ORA-08189: Unable to flash back table SQL because row movement is not enabled> verified: to flashback the table, you must always make the table row movement. Let's repeat it: [SQL] SQL> select * from scott. dd; unselected row SQL> insert into scott. dd values (2); 1 row has been created. SQL>/1 line has been created. SQL>/1 line has been created. SQL>/1 line has been created. [SQL] SQL> select * from scott. dd; H ---------- 2 2 2 2 SQL> Add the dd table to the permanent row movement [SQL] SQL> alter table scott. dd enable row movement; the table has been changed. SQL> select row_movement from dba_tables where owner = 'Scott 'and table_name = 'dd'; ROW_MOVE -------- enabled SQL> re-verify whether data in the DD table can be flashed back: [SQL] SQL> select current_scn from v $ database; CURRENT_SCN ----------- 7515150 SQL> delete from scott. dd; four rows have been deleted. SQL> commit; submitted completely. SQL> select * from scott. dd; unselected rows SQL> flashback table scott. dd to scn 7515150; flash back complete. Query data in the dd table: [SQL] SQL> select * from scott. dd; H ---------- 2 2 2 2 SQL> the flashback table command can be used to operate multiple tables at the same time. table names are separated by commas. Because the flashback table is restored Based on the undo table, the truncate operation cannot flashback table. Supplement: 1: Because flashback table is a rollback Based on undo, it is affected by the undo_retention parameter. To ensure that data can be successfully rolled back, you must have enough information in the undo tablespace for rollback. 2: syntax [SQL] FLASHBACK TABLE tablename TO TIMESTAMP to_timestamp ('2017-04-24 11:13:48 ', 'yyyy-mm-dd hh24: mi: ss '); flashback table gdf to scn 123456;

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.