eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 如何修改 VirtualBox 虚拟机的磁盘大小 | Blog首页 | Oracle数据库中 MISSING 文件名称的出现和处理 »

警惕:Oracle中删除的分区不会进入回收站(Recyclebin)
modb.pro

最近在『云和恩墨大讲堂』的微信群讨论中,有朋友提到分区的删除和闪回问题,我注意到很多人可能忽略了这个问题。

在Oracle数据库中,单个删除的分区并不会进入回收站,全表删除的分区才可能和全表一起放入回收站。这是因为单个分区删除之后,是无法通过简单的闪回加入原分区表中,既然无法保证一致性,这个分区就不会进入回收站中。

以下这个测试展示了这个过程:

SQL> select * from v$version;

BANNER CON_ID

-------------------------------------------------------------------------------- ----------

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0

PL/SQL Release 12.2.0.1.0 - Production 0

CORE 12.2.0.1.0 Production 0

TNS for Linux: Version 12.2.0.1.0 - Production 0

NLSRTL Version 12.2.0.1.0 - Production 0

SQL> CREATE TABLE enmotech (

2 PartID integer not null,

3 CretTm date not null,

4 PartCD varchar2(2) not null

5 ) partition by list (partcd) automatic (

6 partition pBJ values ('BJ'),

7 partition pCD values ('CD'),

8 partition pGZ values ('GZ'),

9 partition pSH values ('SH')

10 );

Table created.

SQL> insert into enmotech values (1, sysdate, 'KM');

1 row created.

SQL> select partition_name from user_tab_partitions

2 where table_name = 'ENMOTECH';

PARTITION_NAME

--------------------------------------------------------------------

PBJ

PCD

PGZ

PSH

SYS_P281

SQL> alter table enmotech drop partition SYS_P281 purge;

alter table enmotech drop partition SYS_P281 purge

*

ERROR at line 1:

ORA-14048: a partition maintenance operation may not be combined with other operations

SQL> alter table enmotech drop partition PSH;

Table altered.

SQL> select * from user_recyclebin;

no rows selected

SQL> drop table enmotech;

Table dropped.

SQL> select object_name,original_name,type from user_recyclebin;

OBJECT_NAME ORIGINAL_NAME TYPE

---------------------------------------- -------------------- -------------------------

BIN$TflQLiTmWX7gUwo4qMBX+A==$0 ENMOTECH TABLE

BIN$TflQLiTmWX7gUwo4qMBX+A==$0 ENMOTECH Table Partition

BIN$TflQLiTmWX7gUwo4qMBX+A==$0 ENMOTECH Table Partition

BIN$TflQLiTmWX7gUwo4qMBX+A==$0 ENMOTECH Table Partition

BIN$TflQLiTmWX7gUwo4qMBX+A==$0 ENMOTECH Table Partition

很多时候,想当然的结果可能并不可信,实践操作方能出真知,多动手,是技术人的王道。


历史上的今天...
    >> 2013-04-25文章:
    >> 2011-04-25文章:
    >> 2010-04-25文章:
           ACOUG第二次地面活动 小记
    >> 2008-04-25文章:
           春天的花开以及冬日的冰
    >> 2007-04-25文章:
           新书定稿与山海雄关
    >> 2006-04-25文章:
           我的写作进度之二
    >> 2005-04-25文章:

By eygle on 2017-04-25 16:07 | Comments (0) | FAQ | 3249 |


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com