今天公司开发在删除表时报错ora-12083,很是疑惑,数据字典记录的是表,而删除要用物化视图方式删除,如下:

SQL> DROP TABLE CODE_M_AGENCY;
DROP TABLE CODE_M_AGENCY
           *
ERROR at line 1:
ORA-12083: must use DROP MATERIALIZED VIEW to drop "EFMIS_36"."CODE_M_AGENCY"

SQL> DROP MATERIALIZED VIEW CODE_M_AGENCY;
DROP MATERIALIZED VIEW CODE_M_AGENCY
*
ERROR at line 1:
ORA-12003: materialized view "EFMIS_36"."CODE_M_AGENCY" does not exist

使用10046事件跟踪如下:

SQL>alter session set events '10046 trace name context forever,level 12';
SQL>drop table CODE_M_AGENCY;
SQL>alter session set events '10046 trace name context off';

查看跟踪文件报错的递归sql:

=================================================================================================================================================================
PARSING IN CURSOR #139894769163856 len=160 dep=1 uid=0 oct=3 lid=0 tim=1482995091131451 hv=2880999359 ad='e882b160' sqlid='gx4mv66pvj3xz'
select con#,type#,condlength,intcols,robj#,rcon#,match#,refact,nvl(enabled,0),rowid,cols,nvl(defer,0),mtime,nvl(spare1,0),spare2,spare3 from cdef$ where obj#=:1
END OF STMT
BINDS #139894769163856:
Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=00 fl2=0001 frm=00 csi=00 siz=24 off=0
  kxsbbbfp=7f3bca04f3b8  bln=22  avl=04  flg=05
  value=451343
EXEC #139894769163856:c=0,e=54,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,plh=2570921597,tim=1482995091131499
FETCH #139894769163856:c=0,e=4,p=0,cr=2,cu=0,mis=0,r=0,dep=1,og=4,plh=2570921597,tim=1482995091131508
CLOSE #139894769163856:c=0,e=0,dep=1,type=3,tim=1482995091131516
EXEC #139894770891880:c=17998,e=210770,p=0,cr=83,cu=3,mis=0,r=0,dep=0,og=1,plh=0,tim=1482995091131554
ERROR #139894770891880:err=12083 tim=1482995091131562
WAIT #139894770891880: nam='SQL*Net break/reset to client' ela= 1 driver id=1650815232 break?=1 p3=0 obj#=-1 tim=1482995091131628
WAIT #139894770891880: nam='SQL*Net break/reset to client' ela= 38 driver id=1650815232 break?=0 p3=0 obj#=-1 tim=1482995091131679
WAIT #139894770891880: nam='SQL*Net message to client' ela= 0 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1482995091131693

*** 2016-12-29 15:05:01.030
WAIT #139894770891880: nam='SQL*Net message from client' ela= 9898906 driver id=1650815232 #bytes=1 p3=0 obj#=-1 tim=1482995101030616
CLOSE #139894770891880:c=0,e=17,dep=0,type=0,tim=1482995101030778
=================================================================================================================================================================

可以看到是在执行sql(已经替换绑定变量):select con#,type#,condlength,intcols,robj#,rcon#,match#,refact,nvl(enabled,0),rowid,cols,nvl(defer,0),mtime,nvl(spare1,0),spare2,spare3 from cdef$ where obj#=451343;

该sql在pl/sql devloper上执行结果为空。

好吧!我们来看一下正常情况下的drop table操作结果如何,步骤如下:

SQL> create table test01 as select * from user_objects;
SQL> alter session set events '10046 trace name context forever,level 12';
SQL> drop table test01;
SQL> alter session set events '10046 trace name context off';

取得跟踪文件后发现没有找到以上sql信息。

===================================

根据报错信息google查看,发现这是一个oracle bug,解释如下:

ISSUE CLARIFICATION
====================
After dropping the materialized view,while trying to drop the underlying table,
it failed with below error
When I try to drop the table it gives "ORA-12083: must use DROP MATERIALIZED
VIEW ..." .
.
ISSUE VERIFICATION
===================
Verified with error description above.
.
CAUSE DETERMINATION
====================
This is because of the Bug 4287115.
This is a known issue in 9i , which is fixed in 10g.
CAUSE JUSTIFICATION
====================
the bug description clearly matches the issue here.
.
POTENTIAL SOLUTION(S)
======================
To workaround the problem , connected as sys run the following update statement.
The following update should update only one row. In case if it updates more
than one row, then rollback the transaction, which means that this workaround
does not apply to your case.
connect sys/ as sysdba
update tab$ set property = property - 100663296 where
obj# in (select obj# from obj$ where name='OT_CR_ITEM_X' and
owner# in (select USER_ID from all_users where USERNAME=''));
commit;
alter system flush shared_pool;
alter system flush shared_pool;
alter system flush shared_pool;
connect /
Now try dropping the table & it should go through fine.

POTENTIAL SOLUTION JUSTIFICATION(S)
====================================
This is the recommended solution.
.
SOLUTION / ACTION PLAN
=======================
Hi Chunpeng,
This problem is not fixed in 9i,but you can try the workaround given above.
this is fixed in 10g.

安装步骤解决发现可以正常删除表,如下。

update tab$
   set property = property - 100663296
where obj# in
       (select obj#
          from obj$
         where name = 'CODE_M_DISTRICT'
           and owner# in (select USER_ID from all_users where USERNAME = 'EFMIS_36'));
commit;

oracle Bug 4287115(ora-12083)的更多相关文章

  1. 转:Oracle 执行计划(Explain Plan) 说明

    Oracle 执行计划(Explain Plan) 说明 原贴地址:http://blog.csdn.net/tianlesoftware/article/details/5827245   如果要分 ...

  2. oracle系统函数(日期函数)

    oracle系统函数(日期函数) 调用日期函数时,首先要明确两个概念,时间戳和日期是不同的,日期中包括年月日但不包括小时分钟秒,时间戳包括年月日小时分钟秒.在oracle中,一般情况下,函数中包含da ...

  3. 11g Oracle Rac安装(基于linux6)可能出现的问题

    11g Oracle Rac安装(基于linux6)可能出现的问题汇总: 7)使用"yum"命令执行节点的自动配置失败. 修改一下 /etc/resolv.conf,添加: nam ...

  4. 【Oracle】转:通过案例学调优之--Oracle Time Model(时间模型)

    转自:http://blog.51cto.com/tiany/1596012 通过案例学调优之--Oracle Time Model(时间模型) 数据库时间 优化不仅仅是缩短等待时间.优化旨在缩短最终 ...

  5. PLSQL Developer概念学习系列之登录连接Oracle时出现(没有登录) -PL / SQL Developer:ORA - 12541: TNS :无建听程序的错误解决办法(图文详解)

    不多说,直接上干货! 前期博客 PLSQL Developer概念学习系列之如何正确登录连接上Oracle(图文详解)   如用scott.scott_password进行登录,orcl是全局数据库 ...

  6. Oracle corrupt block(坏块) 详解

    转自:http://blog.csdn.net/tianlesoftware/article/details/5024966 一. 坏块说明 1.1 相关链接 在看坏块之前,先看几个相关的链接,在后面 ...

  7. 【转】Oracle 执行计划(Explain Plan) 说明

    转自:http://blog.chinaunix.net/uid-21187846-id-3022916.html       如果要分析某条SQL的性能问题,通常我们要先看SQL的执行计划,看看SQ ...

  8. Oracle 数据库重放(Database Replay)功能演示

    我们可以捕获生产环境的工作量,在测试环境上重放,从而在不影响生产环境的前提下做一些改动测试. 捕获:需要Oracle版本为10.2.0.4或更高. 重放:需要Oracle版本为11g Release ...

  9. Oracle触发器实例(网搜)

    触发器使用教程和命名规范 目  录触发器使用教程和命名规范 11,触发器简介 12,触发器示例 23,触发器语法和功能 34,例一:行级触发器之一 45,例二:行级触发器之二 46,例三:INSTEA ...

随机推荐

  1. jvm虚拟机原理1

    JVM是虚拟机,也是一种规范,他遵循着冯·诺依曼体系结构的设计原理.冯·诺依曼体系结构中,指出计算机处理的数据和指令都是二进制数,采用存储程序方式不加区分的存储在同一个存储器里,并且顺序执行,指令由操 ...

  2. 转载:【原译】Erlang列表处理(Efficiency Guide)

    转自:http://www.cnblogs.com/futuredo/archive/2012/10/22/2734186.html List handling 1  Creating a list ...

  3. SQL Server 备份和还原数据库

    备份: --完整备份 ) set @db_name = 'WSS_Content_Test'; ) set @db_location = 'D:\spbr0002\0000000B.bak'; --保 ...

  4. 调用外部 DLL 中的函数(1. 早绑定)

    ,b,t,);end; end.

  5. mybatis由浅入深day02_7.3二级缓存

    7.3 二级缓存 7.3.1 原理 下图是多个sqlSession请求UserMapper的二级缓存图解. 首先开启mybatis的二级缓存. sqlSession1去查询用户id为1的用户信息,查询 ...

  6. Android NDK开发-2-环境搭建

    1.环境变量配置NDK 2.选中项目,右键属性菜单,创建一个新的编译器

  7. Python Scrapy 自动爬虫注意细节(2)

    一.自动爬虫的创建,需要指定模版 如: scrapy genspider -t crawl stockinfo quote.eastmoney.com crawl : 爬虫模版 stockinfo : ...

  8. Android package属性、package name和Application ID三者的联系及区别

    package属性:在AndroidManifest.xml文件中. package name:模块结构的包名. Application ID:模块defaultConfig块下的applicatio ...

  9. 在联网时,两台linux服务器传输文件方法

    登陆服务器root用户命令:su - root 传输文件命令:scp +需要传输linux系统文件+空格+目标linux服务器的用户名@服务器ip地址:+传输的文件路径:例:scp /mnt/work ...

  10. web基础----->模板引擎Velocity的使用(一)

    Velocity 是一个基于 Java 的模板引擎框架,提供的模板语言可以使用在 Java 中定义的对象和变量上.今天我们就学习一下Velocity的用法. Velocity的第一个例子 项目的主体是 ...