近来有套库空间紧张,发现有很大BIN$开头的TABLE partition,index partition 类型的段,查询确认是2个月前删除的对象,手动清空过dba_recyclebin使用purge,但都过去几天了,后来dba_recyclebin一直为空,发现对象BIN$XX还存在,ORACLE 在处理大的分区表时在开启RECYCLEBIN的情况有时会出现这种异常情况,下面记录一下这个CASE。

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for HPUX: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

SQL> select bytes,segment_type,owner,tablespace_name,segment_name from dba_segments where segment_name like 'BIN$%'

BYTES SEGMENT_TYPE OWNER TABLESPACE_NAME SEGMENT_NAME
-------------------- ------------------ --------------- ------------------------------ ------------------------------
5,006,950,400 INDEX PARTITION CDR CDR_INX7 BIN$Du34GVECb4zgVAAfKQ3k2w==$0
13,659,799,552 INDEX PARTITION CDR CDR3 BIN$Du34GVECb4zgVAAfKQ3k2w==$0
1,048,576 INDEX PARTITION CDR CDR3 BIN$Du34GVECb4zgVAAfKQ3k2w==$0
80,321,970,176 TABLE PARTITION CDR CDR_INX5 BIN$Du34GVEDb4zgVAAfKQ3k2w==$0
84,739,620,864 TABLE PARTITION CDR CDR4 BIN$Du34GVEDb4zgVAAfKQ3k2w==$0
80,260,104,192 TABLE PARTITION CDR CDR_T1 BIN$Du34GVEDb4zgVAAfKQ3k2w==$0
80,747,692,032 TABLE PARTITION CDR CDR_INX8 BIN$Du34GVEDb4zgVAAfKQ3k2w==$0
...

select object_id from dba_objects where object_name like 'BIN%';
--省略

SQL> @oid 578398

owner object_name object_type SUBOBJECT_NAME CREATED LAST_DDL_TIME status DATA_OBJECT_ID
------------------------- ------------------------------ ------------------ ------------------------------ ----------------- ----------------- --------- --------------
CDR BIN$Du34GVEDb4zgVAAfKQ3k2w==$0 TABLE PARTITION GPRS312_MAX 20140722 22:27:02 20140828 17:14:30 VALID 592609

SQL> select * from dba_tables where table_name='BIN$Du34GVEDb4zgVAAfKQ3k2w==$0';

no rows selected

SQL> select * from dba_tables where table_name like 'BIN%';

no rows selected
SQL> select 1 from cdr."BIN$Du34GVEDb4zgVAAfKQ3k2w==$0" partition(GPRS312_01) where rownum<2;

1
----------
1

SQL> select * from dba_recyclebin;

no rows selected

SQL> select count(*) from dba_tab_partitions where table_name='BIN$Du34GVEDb4zgVAAfKQ3k2w==$0';

COUNT(*)
----------
31

TIP:
当分区表在RECYCLEBIN开启的情况下:
drop N partition ,partitioon 会直接删除而不会进recyclebin
drop table, 表信息会从DBA_TABLES 消失,dba_tab_partition 重命名为BIN$开头的对象,其它TRIGER,INDEX同类同,但同时会在DBA_RECYCLEBIN中记录table的BIN 和原表名及删除时的一些信息,而且可以使用BIN$开头的表名查询表记录。

试着去删除

SQL> purge index cdr."BIN$Du34GVECb4zgVAAfKQ3k2w==$0";
purge index cdr."BIN$Du34GVECb4zgVAAfKQ3k2w==$0"
*
ERROR at line 1:
ORA-38307: object not in RECYCLE BIN

SQL> drop table cdr."BIN$Du34GVEDb4zgVAAfKQ3k2w==$0";
drop table cdr."BIN$Du34GVEDb4zgVAAfKQ3k2w==$0"
*
ERROR at line 1:
ORA-38301: can not perform DDL/DML over objects in Recycle Bin
解决方法:

SQL> ALTER SESSION SET RECYCLEBIN=OFF;
Session altered.

SQL> drop table cdr."BIN$Du34GVEDb4zgVAAfKQ3k2w==$0";
Table dropped.
如果session级关闭recyclebin不可以,可以尝试在实例级关闭或重启实例后再次尝试删除,本次清理释放了2T的空间。

O对删除大分区表时的最佳实践:
Demantra Large Table Partitions and Using the Flashback Recycle bin, recyclebin, dba_recyclebin and sys.RECYCLEBIN$ Purge Best Practice (文档 ID 1962730.1)

Invalid segment BIN$xxx and dba_recyclebin was empty (回收站空,释放无效的BIN$xx空间)的更多相关文章

  1. ORA-10635: Invalid segment or tablespace type

    上周星期天在迁移数据时,碰到了ORA-10635: Invalid segment or tablespace type 错误,当时的操作环境如下: 操作系统版本: [oracle@xxxxx scr ...

  2. django报错解决:Invalid HTTP_HOST header: 'xxx.com'. You may need to add u'xxx.com' to ALLOWED_HOSTS.

    django版本:1.11.15 使用uwsgi+nginx运行django程序,出现报错,报错为:Invalid HTTP_HOST header: 'xxx.com:82'. You may ne ...

  3. Invalid HTTP_HOST header: 'xxx.xx.xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS

    Invalid HTTP_HOST header: 'xxx.xx.xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS - buk ...

  4. Invalid HTTP_HOST header: 'xxx.xxx:8000'. You may need to add 'xxx.xx' to ALLOWED_HOSTS

    用python3 manage.py runserver 0.0.0.0:8000命令运行django程序后,通过浏览器访问服务器网址的8000端口,出现访问错误,报错为 Invalid HTTP_H ...

  5. Error: Invalid CSS after "xxx": expected 1 selector or at-rule, was "{}"

    在VSCode中编译sass文件时,出现报错:Error: Invalid CSS after "xxx": expected 1 selector or at-rule, was ...

  6. empty视为空的条件

    /** * empty视为空的条件: * (1)."" (空字符串) * (2).0 (作为整数的0) * (3).0.0 (作为浮点数的0) * (4)."0" ...

  7. Spring Scheduled定时任务报错 java.lang.IllegalStateException: Encountered invalid @Scheduled method 'xxx': For input string: "2S"

    报错信息如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ding ...

  8. java——解决"java.io.StreamCorruptedException: invalid stream header: xxx"

    这个错误是由序列化引起的,可能的原因以及解决方法: 1.kryo对于集合(比如 Map)的反序列化会失效,报这个错误,解决办法比较暴力,不用kryo了,直接用java原生方法. 2.使用Java原生方 ...

  9. eclipse中的Invalid text string (xxx).

    这个是说明在eclipse中引用HTML的时候,语法出现了不规范的错误 可以到https://www.w3school.com.cn/index.html里面找找对应对象的问题 我之前就是option ...

随机推荐

  1. 【转】iOS开发者申请发布证书及真机调试图文详解

    原文网址:http://www.tqcto.com/article/mobile/57822.html 打开iOS Dev Center,选择Sign in,登陆(至少99美元账号),登陆之后在网页右 ...

  2. Android-webView的loadUrl

    1 //打开本包内asset目次下的test.html文件 wView.loadUrl(" file:///android_asset/test.html "); 2 //打开本地 ...

  3. 初学acm感想

    初学acm,觉得大部分题对我来说都是陌生的,好多类型没见过,好多题没思路,打击确实不小,或许这个阶段正是比较能考验人的时候吧,因为只有坚持下来才有收获,没有人生下来就是大神,所以不能气馁更不能放弃,有 ...

  4. $(function(){})里面不能声明定义函数

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. Bzoj 2456: mode 数论,众数

    2456: mode Time Limit: 1 Sec  Memory Limit: 1 MBSubmit: 2843  Solved: 1202[Submit][Status][Discuss] ...

  6. seq命令

    seq 5 seq 5 >1.txt 其中的>是覆盖 seq 1 5 用来产生从数1到数5之间的所有整数 或, seq 5

  7. phpDesigner 工具快捷键巧用

    Zend Studio工具默认的快捷方式, 如果你从事php工作, 自然能够体会到一些便利性, 比如CTRL+D, 可以直接复制当前一行, 这对于重复代码及调试都有很大帮助. Ctrl+U转换大小写之 ...

  8. 使用GSoap开发WebService客户端与服务端

    Gsoap 编译工具提供了一个SOAP/XML 关于C/C++ 语言的实现, 从而让C/C++语言开发web服务或客户端程序的工作变得轻松了很多. 用gsoap开发web service的大致思路 我 ...

  9. SQL GROUP BY GROUPING SETS,ROLLUP,CUBE(需求举例)

    实现按照不同级别分组统计 关于GROUP BY 中的GROUPING SETS,ROLLUP,CUBE 从需求的角度理解会更加容易些. 需求举例: 假如一所学校只有两个系, 每个系有两个专业, 每个专 ...

  10. Codeforces 114A-Cifera(暴力)

    A. Cifera time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...