Data Recovery test after Oracle error drop/update operation _oracle

Source: Internet
Author: User
Tags commit

1, the drop table, how to recover

Copy Code code as follows:

CREATE TABLE ETL (ID number);
INSERT into ETL values (1);
Commit
drop table ETL;

If the drop table ETL Purge--no recovery is possible

The following table recovery is performed:

(1) to introduce the view for recovery: Dba_recyclebin
Sql> SELECT object_name,original_name,can_undrop,can_purge from Dba_recyclebin WHERE original_name= ' ETL ';
object_name Original_name Can Can
------------------------------ -------------------------------- --- ---
Bin$v0qznpbkrbieuax/mzb8ww==$0 ETL Yes Yes
Sql> CREATE TABLE ETL as SELECT * from "bin$v0qznpbkrbieuax/mzb8ww==$0";
Table has been created.
Sql> SELECT * from ETL;
Id
----------
1
Restore completed.
(2) Unable to restore the situation: drop table ETL purge;
Sql> CREATE TABLE ETL2 (NAME VARCHAR2 (10));
Table has been created.
Sql> INSERT into ETL2 VALUES (' TEST ');
1 lines have been created.
Sql> COMMIT;
Submit completed.
sql> DROP TABLE ETL2 PURGE;
The table has been deleted.
Sql> SELECT object_name,original_name,can_undrop,can_purge from Dba_recyclebin WHERE original_name= ' ETL2 ';
No rows selected
Sql>
2, the Update table recovery
Sql> SELECT sysdate from DUAL;
Sysdate
-------------------
2008-11-21 19:45:20
Sql> SELECT * from ETL;
Id
----------
1
sql> UPDATE ETL SET id=2;
1 rows have been updated.
Sql> SELECT * from ETL;
Id
----------
2
Sql> COMMIT;
Submit completed.
CREATE TABLE Test_bak
As
SELECT * FROM test as of TIMESTAMP To_timestamp (' 20081126 103435 ', ' yyyymmdd Hh24miss ');
Table has been created.
Sql> SELECT * from Etl_bak;
Id
----------
1
Sql>
Completes the restore of the Update table.

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.