The Oracle drop table does not directly delete drop tables XX purge

Source: Internet
Author: User
Tags dba

drop table
Execute DROP TABLE XX statement
The drop table is placed in the Recycle Bin (user_recyclebin) instead of being deleted directly. In this way, the table information in the Recycle Bin can be restored or completely erased.
Retrieve the deleted table information by querying the Recycle Bin User_recyclebin, and then use the statement
Flashback table <user_recyclebin.object_name or user_recyclebin.original_name> to before drop [rename to <new_ table_name>];
Restore the table in the Recycle Bin to the original name or specify a new name, and the data in the table is not lost.
To delete a table completely, use the statement: drop table <table_name> Purge;
Clearing the information in the Recycle Bin
Clear the specified table: Purge table <table_name>;
Clear the current user's Recycle Bin: Purge RecycleBin;
Clear the Recycle Bin for all users: Purge Dba_recyclebin;
Do not put in the Recycle Bin, the direct deletion is: drop table xx purge;




Clearing data in a table
The truncate operation is very similar to the delete operation without a where condition, except that all the information in the table is deleted, but the tables still exist.
Example: Truncate TABLE XX
Truncate does not support rollback and cannot truncate a table with a foreign key, if you want to remove the foreign key first, and then delete it.
After TRUNCATE TABLE, it is possible that the tablespace is still not released and can use the following statement:
ALTER TABLE name deallocate UNUSED KEEP 0;
Note that if you do not add keep 0, the tablespace will not be freed.
For example:
ALTER TABLE F_MINUTE_TD_NET_FHO_B7 deallocate UNUSED KEEP 0;
Or:
TRUNCATE Table (Schema) table_name DROP (reuse) storage to release the tablespace.
For example: Truncate TABLE test1 DROP STORAGE;




Querying the table under the user
If your user rights are not DBA:
Then you use
SELECT * from User_tables;
You can query the tables that are owned by the current user.
If you are a DBA user:
SELECT * from Dba_tables;

The Oracle drop table does not directly delete drop tables xx purge

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.