Oracle10g新特性:Recycle Bin回收站
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入 Oracle10g提供了类似操作系统中的回收站功能。当drop table的时候,实际上只是将其重命名,并将table以及相关联的对象如index,constraint等放到回收站(RecycleBin)中,后续如果发现drop错了table
欢迎进入Oracle社区论坛,与200万技术人员互动交流 >>进入
Oracle10g提供了类似操作系统中的回收站功能。当drop table的时候,实际上只是将其重命名,并将table以及相关联的对象如index,constraint等放到回收站(RecycleBin)中,后续如果发现drop错了table,可以使用flashback table命名将回收站中的table还原,这就是Oracle10g的Flashback Drop功能。
1.什么是Recycle Bin
实际上,Recycle Bin只是一个保存被drop的对象的一个数据字典表。所以,可以通过如下语句查询回收站中的信息:select * from recyclebin
除非拥有sysdba权限,每个用户只能看到属于自己的对象。所以,对于用户来说,好像每个人都拥有自己的回收站。即使用户有删除其他schema对象的权限,也只能在recyclebin中看到属于自己的对象。
做个小试验:SQL> conn ning/ning已连接。
SQL> drop table test;
表已删除。
SQL> drop table test.test;
表已删除。
SQL> select object_name,original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$xJlIkIFVR/yau1Qb8ocxxQ==$0 TEST
SQL> conn test/test已连接。
SQL> select object_name,original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$1PKEiRExRN2g3tqEEWLfyw==$0 TEST
以下几种drop不会将相关对象放进RecycleBin:
* drop tablespace:会将RecycleBin中所有属于该tablespace的对象清除* drop user:会将RecycleBin中所有属于该用户的对象清除* drop cluster:会将RecycleBin中所有属于该cluster的成员对象清除* drop type:会将RecycleBin中所有依赖该type的对象清除
RecycleBin中的对象会被系统自动按照规则重命名,这是为了防止命名冲突。命名格式为:BIN$unique_id$version
其中unique_id是26个字符的对象唯一标识符,version则是对象在数据库中的版本号。
SQL> create table t(id int);
表已创建。
SQL> drop table t;
表已删除。
SQL> select object_name,original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$+7J5MgT2RbCX+tka+zjpgA==$0 T
SQL> create table t(id int);
表已创建。
SQL> drop table t;
表已删除。
SQL> select object_name,original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$+7J5MgT2RbCX+tka+zjpgA==$0 T BIN$pc+kkUM7QjuQeCDGtwlzgQ==$0 T
可以看到,删除table t后,重建一个名为t的table,再次删除,其unique_id是不一样的。
这时,做一个还原看看:
SQL> select object_name,original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$+7J5MgT2RbCX+tka+zjpgA==$0 T
这里,Oracle选择了最后一次删除的T表还原。
再次删除:SQL> drop table t;
表已删除。
SQL> select object_name,original_name from recyclebin;
OBJECT_NAME ORIGINAL_NAME
------------------------------ --------------------------------
BIN$4bNgZiMGTA63iwA5xflh5A==$0 T BIN$+7J5MgT2RbCX+tka+zjpgA==$0 T
可以看到unique_id又变了。所以,通过这种命名方式,避免了对于删除table后又重建了同名table的情况可能造成的命名冲突。
[1] [2] [3] [4]

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



A bin file is a computer file format and is the abbreviation of "binary file". bin files are commonly used to store and transfer computer programs or data. In software development, the compiler converts source code into binary form and generates an executable bin file. These bin files contain the machine code of the computer program and can be run directly on the computer. Because binary files contain low-level machine instructions, they are generally more efficient and faster than text files.

The method of using MDK to generate a bin file includes steps such as creating a project, writing application code, setting the output path and name, compiling and linking. Detailed introduction: 1. Open the MDK software and create a new project. Select "New Project" in the "Project" menu, and then select the model and supplier of the target device; 2. In the pop-up dialog box, select the save path and name of the project, and click the "Save" button, etc.

Understand the key features of SpringMVC: To master these important concepts, specific code examples are required. SpringMVC is a Java-based web application development framework that helps developers build flexible and scalable structures through the Model-View-Controller (MVC) architectural pattern. web application. Understanding and mastering the key features of SpringMVC will enable us to develop and manage our web applications more efficiently. This article will introduce some important concepts of SpringMVC

PHP8.3 released: Overview of new features As technology continues to develop and needs change, programming languages are constantly updated and improved. As a scripting language widely used in web development, PHP has been constantly improving to provide developers with more powerful and efficient tools. The recently released PHP 8.3 version brings many long-awaited new features and improvements. Let’s take a look at an overview of these new features. Initialization of non-null properties In past versions of PHP, if a class property was not explicitly assigned a value, its value

An in-depth analysis of the new features of PHP8 to help you master the latest technology. As time goes by, the PHP programming language has been constantly evolving and improving. The recently released PHP8 version provides developers with many exciting new features and improvements, bringing more convenience and efficiency to our development work. In this article, we will analyze the new features of PHP8 in depth and provide specific code examples to help you better master these latest technologies. JIT compiler PHP8 introduces JIT (Just-In-Time) compilation

With the rapid development of the Internet, programming languages are constantly evolving and updating. Among them, Go language, as an open source programming language, has attracted much attention in recent years. The Go language is designed to be simple, efficient, safe, and easy to develop and deploy. It has the characteristics of high concurrency, fast compilation and memory safety, making it widely used in fields such as web development, cloud computing and big data. However, there are currently different versions of the Go language available. When choosing a suitable Go language version, we need to consider both requirements and features. head

There is no concept of a class in the traditional sense in Golang (Go language), but it provides a data type called a structure, through which object-oriented features similar to classes can be achieved. In this article, we'll explain how to use structures to implement object-oriented features and provide concrete code examples. Definition and use of structures First, let's take a look at the definition and use of structures. In Golang, structures can be defined through the type keyword and then used where needed. Structures can contain attributes

C++ functions have the following types: simple functions, const functions, static functions, and virtual functions; features include: inline functions, default parameters, reference returns, and overloaded functions. For example, the calculateArea function uses π to calculate the area of a circle of a given radius and returns it as output.
