Oracle delete data after restoration

When we delete from carelessness directly without conditions but there is no rollback of a very simple way to be able to restore data to the state before the delete

The first program has helped me solve practical problems, yet the practice of the second program

In this record for future reference

 

One: According to time to recover:

1, query the database current time (the purpose of the database is to check your computer time is similar to time, but at different times to avoid the wrong time to restore data to a point)

select  to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

2, query data before deleting data point in time

select * from 表名 as of timestamp to_timestamp('2016-08-11 16:12:11','yyyy-mm-dd hh24:mi:ss');

(If there is no data, will continue to time in advance)

3, recovery data (exciting times)

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

It's done, data recovery;

But there could be problems, such as an error: ORA-08189: row movement is not enabled, can not flash back to the table;

Do not be afraid, this is very simple;

alter table 表名 enable row movement;

Then again, you can execute the above SQL;

Two: to restore data from a database SCN

1, query the current database SCN No.

select current_scn from v $ database; (if not performed, the switching system or a user to user queries sys)    

Queries to the current value: 91,799,986

2, reduce the number of queries SCN is deleted table data (if no data SCN continues to shrink, because the database is operating more than one person, change SCN number more, you can reduce the number of multi-number)

select * from 表名 as of scn 91799980;

3, recovery data

flashback table 表名 to scn 91799980;

The restoration is complete. If the error: ORA-08189: row movement is not enabled, can not flash back to the table; the results of the program above.

 

Thank bloggers   original address https://blog.csdn.net/zflovecf/article/details/83088021

Guess you like

Origin www.cnblogs.com/yangsirc/p/11084846.html