Oracle Flash Back Technology

Source: Internet
Author: User

Undo data is retained for 7 days
Orcl> Show Parameter Undo

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
_optimizer_undo_cost_change string 12.1.0.2
temp_undo_enabled Boolean FALSE
Undo_management string AUTO
Undo_retention integer 604800
Undo_tablespace string UNDOTBS1
Orcl> select 604800/60/60/24 from dual;

604800/60/60/24
---------------
7

1: Flash back query, using Undo

Querying table data at a specified point in time

SELECT * from Scott.acct as of timestamp to_timestamp (' 2018-05-20 15:30:00 ', ' yyyy-mm-dd hh24:mi:ss ') WHERE user_id = 1;

2: Flash Back table

The Flashback table (Flashback tables) uses the Undo information to restore a Table object to a previous point in time (a snapshot)

Sql>flashback table test to timestamp to_timestamp (' 2018-05-20 15:30:00 ', ' yyyy-mm-dd hh24:mi:ss ');

Sql>flashback table test to timestamp SCN 115544;

Sql>flashback table test to timestamp to_timestamp (' 2018-05-20 15:30:00 ', ' yyyy-mm-dd hh24:mi:ss ') enable triggers;

Using the Flashback table premise

1) The normal user needs to have flashback any table system permissions. Commands such as:

SQL>Grant Flashback any table to Scott;

2) There is a SELECT, INSERT, delete, ALTER permission for the table.

3) The table must be guaranteed to have row movement (row movement).

Restore the table to a certain point in the past, restore the test table to just recorded point in time (or SCN), because there are triggers in the table, so the use of the keyword enable triggers;

Flashback table Test to timestamp to_timestamp (' 2018-05-20 15:30:00 ', ' yyyy-mm-dd hh24:mi:ss ') enable triggers;

3: Flash Back Data archive

Querying the state of a past period of time

Select
VERSIONS_STARTSCN, VERSIONS_ENDSCN, Versions_starttime, Versions_endtime, Versions_xid, Versions_operation,ORDER_ID
From Scott.emp
WHERE order_id in (100827979,100827973,100785947);

Oracle Flash Back Technology

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.