今天公司开发在删除表时报错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. HGNC 数据库-人类基因组数据库

    HGNC 全称为HUGO Gene Nomenclature Committee, 叫做 HUGO基因命名委员会,负责对人类基因组上包括蛋白编码基因, ncRNA基因,甲基因和其他基因在内的所有基因提 ...

  2. 二分求幂,快速求解a的b次幂

    一个引子 如何求得a的b次幂呢,那还不简单,一个for循环就可以实现! void main(void) { int a, b; ; cin >> a >> b; ; i < ...

  3. js unicode处理

    //岗位详细界面 var str="1.\u000D\u21B52.\u000D\u21B53"; var pad = function() { var tbl = []; ret ...

  4. iOS开发- UILabel 自己主动换行 及 高度自适应

    主要是今天看到论坛有人问这个问题.帮忙解决之后, 顺便Mark下. 非常easy, 代码写的非常清楚. 直接上代码. UILabel *label = [[UILabel alloc] initWit ...

  5. Ubuntu 10.04 安装 Oracle11gR2

    注意点: 在 ubuntu的 /bin 下建立以下几个基本命令的链接: /bin/basename->/usr/bin/basename /bin/awk->/usr/bin/gawk / ...

  6. Unity3D协程

    协程介绍 Unity的协程系统是基于C#的一个简单而强大的接口 ,IEnumerator,它允许你为自己的集合类型编写枚举器.这一点你不必关注太多,我们直接进入一个简单的例子来看看协程到底能干什么.首 ...

  7. 公式编辑器编辑倒L符号的方法

    数学公式全都是由数字字母和一些符号组成的,一些常用的字母符号我们使用起来也很熟练,但是在数学中也有一些符号是比较少用的,比如倒着的L,这个符号在一些函数中出现过,表示某一类的函数.在word公式编辑器 ...

  8. 如何使用matlab中的胞元数组

    胞元数组(cell Arry)的基本组分是胞元(cell),每个胞元本身在数组中是平等的,只能以下标区分.胞元可以存放任何类型.任何大小的数组,如任意维数值数组.字符串数组.符号对象等,而且同一个胞元 ...

  9. oracle 触发器 pragma autonomous_transaction

    from:http://blog.csdn.net/ruru7989/article/details/30712987一般情况下在触发器中是不能使用DDL语句的,使用自治事务可以实现 可以在触发器中加 ...

  10. Linux-Oracle

    1.使用Oracle登录,或者其他用户登录,切换到Oracle账户下: 2.登录后在Oracle主目录后使用vi创建.bashrc文件: 3.在文件中输入如下参数: export ORACLE_SID ...