Oracle recycle bin recyclebin
Racle10g Recycle Bin
1> what is Recycle Bin?
In fact, Recycle Bin is only a data dictionary table that stores the drop object. Therefore, you can use the following statement to query information in the recycle bin:
Select * from recyclebin
Unless you have sysdba permissions, you can only view your own objects. Therefore, for users, it seems that everyone has their own recycle bin. Even if you have the permission to delete other schema objects, you can only view your own objects in recyclebin.
Install Oracle 11gR2 (x64) in CentOS 6.4)
Steps for installing Oracle 11gR2 in vmwarevm
Install Oracle 11g XE R2 In Debian
Make a small test:
SQL> conn ning/ning
Connected.
SQL> drop table test;
The table has been deleted.
SQL> drop table test. test;
The table has been deleted.
SQL> select object_name, original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
--------------------------------------------------------------
BIN $ xJlIkIFVR/yau1Qb8ocxxQ = $0 TEST
SQL> con test/test
Connected.
SQL> select object_name, original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
--------------------------------------------------------------
BIN $ 1PKEiRExRN2g3tqEEWLfyw ==$ 0 TEST
The following drop statements do not put related objects into RecycleBin:
Drop tablespace: clears all objects in RecycleBin that belong to this tablespace.
Drop user: clears all objects belonging to this user in RecycleBin.
Drop cluster: clears all member objects belonging to the cluster in RecycleBin.
Drop type: clears all objects dependent on this type in RecycleBin.
Objects in RecycleBin will be automatically renamed by the system according to rules to prevent name conflicts. Name format: BIN $ unique_id $ version
Unique_id is the unique identifier of a 26-character object, and version is the version number of the object in the database.
SQL> create table t (id int );
The table has been created.
SQL> drop table t;
The table has been deleted.
SQL> select object_name, original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
--------------------------------------------------------------
BIN $ + 7J5MgT2RbCX + tka + zjpgA = $0 T
SQL> create table t (id int );
The table has been created.
SQL> drop table t;
The table has been deleted.
SQL> select object_name, original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
--------------------------------------------------------------
BIN $ + 7J5MgT2RbCX + tka + zjpgA = $0 T
BIN $ pc + kkUM7QjuQeCDGtwlzgQ ==0 0 T
As you can see, after deleting table t, recreate a table named t and delete it again. Its unique_id is different.
At this time, make a restoration to see:
SQL> select object_name, original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
--------------------------------------------------------------
BIN $ + 7J5MgT2RbCX + tka + zjpgA = $0 T
Here, Oracle selects the T table restoration that was last deleted.
Delete again:
SQL> drop table t;
The table has been deleted.
SQL> select object_name, original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
--------------------------------------------------------------
BIN $ 4bNgZiMGTA63iwA5xflh5A ==0 0 T
BIN $ + 7J5MgT2RbCX + tka + zjpgA = $0 T
You can see that the unique_id has changed. Therefore, this naming method avoids naming conflicts when the table with the same name is recreated after the table is deleted.
2. How to enable/disable RecycleBin
By setting the initialization parameter recyclebin, you can determine whether to enable the recycle bin function. By default, the recycle bin function is enabled.
SQL> alter system set recyclebin = off;
The system has been changed.
SQL> alter system set recyclebin = on;
The system has been changed.
SQL> alter session set recyclebin = off;
The session has been changed.
SQL> alter session set recyclebin = on;
The session has been changed.
For more details, please continue to read the highlights on the next page: