oracle10g Recycle Bin and completely delete table:drop table xx purge

Source: Internet
Author: User

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.
1. 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;


2. Clear 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;


===============================================================================
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as Test
Sql> select * from Test1;
A B C
-- -- ----------
11 5
11 10
11 10
13 10
14 10
15 10
16 10
17 10
18 10
19 10
20 11
Rows selected
Sql> CREATE TABLE Test2 as SELECT * from Test1;s
Table created
Sql> select * from Test2;
A B C
-- -- ----------
11 5
11 10
11 10
13 10
14 10
15 10
16 10
17 10
18 10
19 10
20 11
Rows selected
sql> drop table test2;
Table dropped
Sql> Select object_name, Original_name, operation, type from User_recyclebin;
object_name original_name Operation TYPE
------------------------------ -------------------------------- --------- -------------------------
Bin$g5jfma/oshc6+wswkjiv2w==$0 TEST1 DROP TABLE
Bin$vqwemdg4r9mk9fyjndyzvg==$0 TEST2 DROP TABLE
Sql> Flashback table Test2 to before drop rename to test3;--' to test3 ' renaming tables
Done
Sql> select * from Test3;
A B C
-- -- ----------
11 5
11 10
11 10
13 10
14 10
15 10
16 10
17 10
18 10
19 10
20 11
Rows selected
Sql> select * from Test2;
SELECT * FROM Test2
ORA-00942: Table or view does not exist
--Delete the table completely
sql> drop table Test3 purge;
Table dropped
Sql> SELECT * from user_recyclebin where original_name = ' TEST3 ';
object_name original_name Operation TYPE ts_name createtime droptime dropscn partition_name CAN_UNDROP CAN_PURGE RELATED B Ase_object Purge_object SPACE
------------------------------ -------------------------------- --------- ------------------------- --------------- --------------- ------------------- ------------------- ------- -------------------------------- ---------- --------- ------- ----------- ------------ -----
Sql> select * from User_recyclebin;
object_name original_name Operation TYPE ts_name createtime droptime dropscn partition_name CAN_UNDROP CAN_PURGE RELATED B Ase_object Purge_object SPACE
------------------------------ -------------------------------- --------- ------------------------- --------------- --------------- ------------------- ------------------- ------- -------------------------------- ---------- --------- ------- ----------- ------------ -----
bin$g5jfma/oshc6+wswkjiv2w==$0 TEST1 DROP TABLE tp_test1 2007-08-23:07:57:28 2007-08-23:07:58:51 1411156 Yes Yes 53086 53 086 53086 896
--Clear the table information in the Recycle Bin Test1
Sql> Purge table test1;
Done
Sql> select * from User_recyclebin;
object_name original_name Operation TYPE ts_name createtime droptime dropscn partition_name CAN_UNDROP CAN_PURGE RELATED B Ase_object Purge_object SPACE

Table name appears in Oracle 10g: Bin$2cmp4fjwq2cw3lj+bxlytw==$0 recently found these strange table names in Oracle, found after Internet lookup is the oracle10g Recycle Bin function, and did not completely delete the table, but put the table into the Recycle Bin , and at last there was such a strange list of names ....

First, the method of elimination is as follows:

1, purge table origenal_tablename;

Purge index origenal_indexname;

2, PURGE RecycleBin;

Second, the query spam information, you can use the following SQL statement:

SELECT T.object_name,t.type, t.original_name from User_recyclebin t;

Third, delete the table does not enter the Recycle method:

drop table TableName 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.