Flashback table quick recovery of accidentally deleted data

Source: Internet
Author: User

In Oracle Database Operations, accidental data deletion and table drop often occur. In the past, after this happens, developers often seek help from DBAs or administrators to use database backup and recovery to retrieve the data.

From oracle 9i, 10 Gb, you do not have to use backup to restore. There is a fast recovery method called flashback. You can use flashback query or flashback table.

I. FLASHBACK QUERY

Adaptation scope: The data in the table is constantly changing. You need to see that some records have been deleted and modified by mistake at a certain time point. You can recover the data based on these records.

-- Flashing back to 15 minutes ago

Select * from orders as of timestamp (effecimestamp-interval '15' minute) where ......

Here, you can replace minute with DAY, SECOND, and MONTH, for example:

SELECT * FROM orders as of timestamp (SYSTIMESTAMP-INTERVAL '2' DAY)

-- Returns to a certain time point.

Select * from orders as of timestamp to_timestamp ('01-Sep-04 16:18:57. 100', 'dd-Mon-RR HH24: MI: SS. ff') where...

-- Two days ago

Select * from orders as of timestamp (sysdate-2) where .........

Ii. FLASHBACK TABLE

1. You can use the drop table to restore the table quickly.

Flashback table orders to before drop;

If the drop table has already created a new table with the same name, add the rename to clause.

Flashback table order to before drop rename to order_old_version;

2. After the table data is deleted or modified incorrectly, no subsequent data changes can be made and can be quickly restored.

Step 1: First enable row migration

Alter table order enable row movement;

Step 2: flashback table

To 15 minutes ago:

Flashback table order to timestamp incluimestamp-interval '15' minute;

To a certain time point:

Flashback table order to timestamp TO_TIMESTAMP ('2017-09-12 01:15:25 PM ', 'yyyy-MM-DD HH: MI: SS am ')

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.