Oracle Delete data by mistake

Source: Internet
Author: User

There are two scenarios for solving this problem:

One: To recover according to time:

1, query the current time of the database (the purpose is to check whether the database time is similar to your computer time, to avoid different time and restore data to the wrong point in time)

Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual;

2. Query data before deleting data point in time

SELECT * from table name as of timestamp To_timestamp (' 2016-08-11 16:12:11 ', ' yyyy-mm-dd hh24:mi:ss ');

(If there is no data, keep the time in advance)

3. Recovering data (exciting moments)

Flashback table name to timestamp to_timestamp (' 2016-08-11 16:12:11 ', ' yyyy-mm-dd hh24:mi:ss ');

Successful, data recovery success;

However, there may be problems, such as error: ORA-08189: Line movement is not enabled, can not flash back to the table;

Do not be afraid, this is very simple;

ALTER TABLE name enable row movement;

Then execute the above SQL again;

Second: Recover data based on database SCN

1, query the current database SCN number

Select Current_scn from V$database; (Can not be executed, switch to SYS user or System user query)

The current value of the query is: 91799986

2, reduce the SCN number query deleted table data (if no data continue to shrink SCN, because the database operation more than one person, the SCN number changes more, you can reduce the number of several)

SELECT * from table name as of SCN 91799980;

3. Recovering data

Flashback table name to SCN 91799980;

Recovery is complete. If error: ORA-08189: The line movement function is not enabled, the table cannot be flashed back;

Oracle Delete data by mistake

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.