The purpose of Flashback is to roll back the data if you have misperformed the data and submitted it. Some people may say that the backup can be used to restore the system to a previous error, but the correct operation data is also lost. The only possible method is log mining, but log mining is complicated and difficult to locate. Therefore, Oracle has launched the Flashback Technology to restore misoperation. Flashback: Flashback Database
Table Level: Flashback Drop and Flashback Table, Flashback Data Archive
Record level: Flashback Version Query and Flashback Transaction Query
| Flashback family |
Flashback Log
|
Tablespace Recycle Bin
|
UNDO |
Function
|
Flashback Database
|
Yes |
|
|
Roll back a database |
Flashback Drop
|
|
Yes |
|
Restore tables accidentally deleted |
Flashback Version Query
|
|
|
Yes |
Recover misoperation data |
Flashback Transaction Query
|
|
|
Yes |
Same as above |
Flashback Table
|
|
|
Yes |
Same as above
|
Flashback Technology Development History Flashback Version/Transaction Query and Flashback TableFlashback Query and Flashback Table both use undo to implement rollback. When you need to flash back to a previous time point, use Flashback Query to Query, confirm the SCN or Timestamp of the Flashback, and then use the Flashback Table to implement the Flashback.
1. 9i Flashback Query
9i Flashback Query can Query the object status at a certain time point in the past. The test is as follows:
The current system time is:
A105024 @ O02DMS1> alter session set nls_date_format = 'yyyy-mm-dd: hh24: mi: ss ';
A105024 @ O02DMS1> select sysdate from dual;
SYSDATE
-------------------
2011-12-16: 02: 51: 16
There is a data entry in the test table:
A105024 @ O02DMS1> select * from test;
ID
----------
1
Delete the data:
A105024 @ O02DMS1> delete from test;
A105024 @ O02DMS1> commit;
In this case, the test table has no data:
A105024 @ O02DMS1> select * from test;
No rows selected
However, you can use the Flashback Query to Query the deleted data:
A105024 @ O02DMS1> select * from test as of timestamp to_timestamp ('2017-12-16: 02: 51: 16', 'yyyy-mm-dd: hh24: mi: ss ');
ID
----------
1
Data can also be restored if necessary:
A105024 @ O02DMS1> insert into test select * from test as of timestamp to_timestamp ('2017-12-16: 02: 51: 16', 'yyyy-mm-dd: hh24: mi: ss ');
A105024 @ O02DMS1> commit;