Delete tables, delete data, and restore Data in Oracle

Source: Internet
Author: User
1. Two Ways to delete table data
A. Delete * From my_table;
B. truncate table my_table;

2. Delete the entire table
Drop table my_table;

How can we recover tables accidentally dropped? In fact, Oracle also has a similar "recycle bin"

For example, you accidentally deleted the my_table table.
Drop table my_table;
When you use the SELECT statement to query this table, the system will prompt that the table or view does not exist.

However, you can use the following statement to query that the table is still in the Oracle recycle bin:
Select * From user_recyclebin where original_name = 'my _ table ';

Now, you can use the following statement to restore data:
Flashback table my_table to before drop;

3. How to thoroughly delete a table: Oracle10g has the recycle bin function. When we delete a table, we did not delete the table completely. Instead, we put the table into the recycle bin, and finally there were a bunch of strange table names: bin $ 2cmp4f1_q2cw3lj + bxlytw = $0 The cleanup method is as follows: Purge TableOrigenal_tablename; Purge index origenal_indexname; To query junk information, use the following SQL statement: Select T. object_name, T. type, T. original_name from user_recyclebin T; The following command is available: Purge recyclebin; It cannot be as complicated as above. Haha! In addition, the method for deleting a table that does not enter recycle is as follows: drop table tablename purge;
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.