How to recover deleted table or table records in oracle

How to recover deleted table or table records in oracle

Article classification: Database

One: table recovery

     For tables deleted by mistake, as long as the PURGE permanent deletion option is not used, there is a good chance of recovery from the flash back area. The general steps are:

1. Query the deleted table from the flash back

    select * from recyclebin

2. Execute table recovery

   flashback table tb to before drop, where tb represents the name of the table you want to restore.

Two: table data recovery

    For table records deleted by mistake, as long as there is no truncate statement, you can choose to restore them according to the commit time of the transaction. The general steps are as follows:

     1. First query from the flashback_transaction_query view. The view provides fields such as table name, transaction submission time, and UNDO_SQL for query.

     Such as: select * from flashback_transaction_query where table_name='TEST';
     2. Execute table record recovery

     Generally, the query is performed according to the time first, and the query statement mode is select * from tb as of timestamp to_timestamp(time,'yyyy-mm-dd hh24:mi:ss'); tb refers to the table name, and time refers to a certain time point

      如select * from scott.test as of timestamp to_timestamp('2009-12-11 20:53:57','yyyy-mm-dd hh24:mi:ss');

    If there is data, recovery is very simple, the statement is flashback table tb to timestamp to_timestamp(time,'yyyy-mm-dd hh24:mi:ss');

   如flashback table scott.test to timestamp to_timestamp('2009-12-11 20:47:30','yyyy-mm-dd hh24:mi:ss');

Guess you like

Origin blog.csdn.net/s_ongfei/article/details/5996058