Database mistakenly deleted tables and recovery of records in the table

Source: Internet
Author: User
First, the recovery of the table
     to mistakenly deleted the table, as long as not using the Purge permanent deletion option, then recover from the flash back zone hope is very large. General steps are:
	1, from the Flash Back query deleted table
    		SELECT *
	from RecycleBin 2, perform table recovery
   		Flashback table  Tbname to  Before drop;                        The tbname here represents the name of the table you want to restore.
second, the table data recovery
     to mistakenly delete the table records, as long as there is no TRUNCATE statement, you can choose to restore according to the transaction time of submission, the general steps are:
	1, first from the Flashback_transaction_query view query, The view provides fields such as table names, transaction submission times, Undo_sql, and so on for queries. For
     		Example: SELECT * from Flashback_transaction_query where table_name= ' TEST ';
        2, the implementation of the table record recovery
     		generally first based on the time query, query statement mode for
		SELECT * from TB as of timestamp to_timestamp (time, ' yyyy-mm-dd hh24:mi:ss '); TB refers to the table name, time refers to a point
     		 such as 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, the recovery is extremely simple, the statement is
			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, when a row is inserted, it is assigned a rowid, and this line always owns the ROWID. The Flash-back table processing completes the delete on the EMP and inserts the rows again, which assigns a new rowid to the lines. Oracle must be allowed to perform this operation to support Flash-back

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.