Oracle Database error operation deleted the table, how to recover

Source: Internet
Author: User

One: Recovery of tables

For the mistakenly deleted table, as long as not using the Purge permanent delete option, then recover from the flash back area hope is quite large. The general steps are:

1. Query the deleted table from Flash back

SELECT * FROM RecycleBin

2. Performing a table recovery

Flashback table TB to before drop, where the TB represents the name of the table you want to restore.

Second: Table Data recovery

As long as there is no TRUNCATE statement, we can select recovery according to the commit time of the transaction, and the general steps are:

1, the first query from the Flashback_transaction_query view, the view provides the table name for the query, transaction commit time, Undo_sql and other fields.

Example: SELECT * from Flashback_transaction_query where
Table_name= ' TEST '; (this in my actual operation found that there is no table name in the background, but a different table name, so if you can't find the table name, you can try to find the operation time, when the recovery time to try to see which time to recover)

2, the implementation of the table record recovery

The query is usually based on time, the query statement mode is SELECT * from TB as of timestamp
To_timestamp (Time, ' yyyy-mm-dd hh24:mi:ss '); TB refers to the name of a table, which is a point in time

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

If you have data, recovery is extremely straightforward, with the statement Flashback table TB to timestamp
To_timestamp (Time, ' yyyy-mm-dd hh24:mi:ss ');

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

NOTE: ALTER TABLE Testvarchar enable row movement;

The purpose of this command is to allow Oracle to modify the ROWID assigned to the row. In Oracle
, an ROWID is assigned to a row when it is inserted, and the line always has this rowid. The Flashback table handles the EMP
Complete the delete and reinsert the rows so that the rows are assigned a new ROWID. To support flashback, Oracle must be allowed to perform this operation

Oracle Database error operation deleted the table, how to recover

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.