After updating the full table data, we teach you how to recover data.

Source: Internet
Author: User

Today in the update to forget to write the update conditions, resulting in the entire table of data update all, scared the baby, still thought recovery, ask a colleague, they sent me a statement, modified a bit, in the implementation of a bit, the data on the miraculous recovery, here to do a record and share:

--Find the SCN number 
select TIMESTAMP_TO_SCN (To_timestamp (' 2017-10-16 3:00:00 ', ' yyyy-mm-dd HH:MI:SS ')) from dual;
--Take out the SCN point data
Select * FROM Cen_reg.t_reg_person_audit SELECT * from Cen_reg.t_reg_person_audit as of SCN 18894273775
 --Restore table Data cen_reg.t_reg_person_audit
INSERT INTO Cen_reg.t_reg_person_audit select * from Cen_reg.t_reg_person_ Audit as of SCN 18894273775;

1, execute the first statement before you need to modify 2017-10-16 3:00:00 this time, change this time to your updated start time, do not require very accurate, but the approximate scope to be correct, the implementation results are as follows:


The result: 18894273775 is the SCN number we need to execute the second sentence.

2, the implementation of the second sentence before the need to modify the select * from behind, changed to your updated table table name, and SCN number, I believe we also see, is the first step to find out the number

The result of the execution of this statement is that the table data of the previous t_reg_person_audit is not updated

3. Delete your updated table data

Delete from Cen_reg.t_reg_person_audit

4, that is above the implementation of the above the third inning = sentence, the data will be found, that is, the update before the data inserted into the Cen_reg.t_reg_person_audit table


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.