Oracle Recycle Bin Function

Source: Internet
Author: User

The Oracle Recycle Bin function is familiar with the Recycle Bin function in windows. You can restore the deleted files to the Recycle Bin. the Oracle recycle bin works exactly the same, but there are some differences in implementation details. in addition, the recycle bin can only recycle tables and related objects, including indexes, constraints, triggers, nested tables, large binary (LOB) segments, and LOB index segments. the recycle bin function is available from Orace 10g. 1. the recycle bin is enabled and disabled by default. however, we can disable and enable the recyclebin parameter. for each session, you can use alter session set recyclebin = off; and alter session set recyclebin = on; to close and enable it. for all sessions, you can modify the system parameter recyclebin, however, note that 10g and 11G are a little different. If their parameter types are different, 10g can be used: alter system set recyclebin = off; and alter system set recyclebin = on; to disable and enable 11g, you can use: alter system set recyclebin = off deferred; and alter system set recyclebin = on deferred; To disable and enable 2. view the recycle bin content select * from user_recyclebin; or select * from recyclebin; view the object drop by the current user (including the object's previous name and the name after the drop) select * from dba_recyclebin; view all objects dropped by a user. when an object is dropped, the recycle bin function is enabled. it is not actually deleted. In fact, we only modified the name. We can still find it using select * from user_objects where type = 'table. its name is a bit strange, for example, BIN $ qAUuckGyd3TgQKjAFAFTAg ==$ 0. Its naming convention is BIN $ unique_id $ version, where BIN represents RecycleBin, unique_id is the unique identifier of the object in the database. It is 26 characters in length and version indicates the version number of the object. 3. Restore the content of the recycle BIN. If a table test is dropped, the drop object_name is BIN $ qAUuckGyd3TgQKjAFAFTAg ==$ 0. You can use flashback table "BIN $ empty = $0" to before drop; (Remember to add double quotation marks) or flashback table test to before drop; to restore. however, if you drop a table test, create a new table test, and then drop. therefore, flashback table test to before drop can only restore the test table that is finally dropped. an error occurs when the first drop table is restored because the table name cannot be duplicated. therefore, you must rename the flashback table test to before drop rename to test24 and clear the recycle BIN. If only one table is cleared at a time, you can use the PURGE table test or PURGE table "BIN $ qAUuckGyd3TgQKjAFAFTAg === "; if you can use PURGE recyclebin or PURGE dba_recyclebin to restore only one table at a time, you cannot restore all tables at a time as you do. 5. Note: If the table is under the system tablespace, you cannot use the recycle bin function, I don't know why. If the tablespace is full, the system will automatically clear part of the content in the recycle bin. First, clear the earliest drop object.

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.