今天公司开发在删除表时报错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. MathType初级教程:怎么安装MathType

    MathType 由美国Design Science公司开发,是一款功能强大的数学公式编辑器,它同时支持Windows和Macintosh 两种操作系统,有很好的兼容性,能够在各种文档中加入复杂的数学 ...

  2. 在MathType如何让括号随内容自动调整大小的技巧

    MathType软件是一款数学公式编辑器工具可以轻松输入各种复杂的公式和符号,与Office文档完美结合,显示效果超好,比Office自带的公式编辑器要强大很多.但是很多的新手朋友不知道在MathTy ...

  3. windows上SVN图标不显示

    症状1:项目左侧导航栏表不能正常显示图标 方法:windows->preferences->General->Appearance->Label Decorations    ...

  4. js中如何跳出循环

    1.for循环中我们使用continue:终止本次循环计入下一个循环,使用break终止整个循环. 2.而在jquery中 $.each使用return true 终止本次循环计入下一个循环,retu ...

  5. linq在获取部门层级树种的应用

    public string GetNavigationsJson() { AjaxA_NAVIGATIONS ajaxnavigations = new AjaxA_NAVIGATIONS(); IL ...

  6. GLSL/C++ 实现滤镜效果

    入门效果之浮雕 "浮雕"图象效果是指图像的前景前向凸出背景.常见于一些纪念碑的雕刻上.要实现浮雕事实上很easy.我们把图象的一个象素和左上方的象素进行求差运算.并加上一个灰度.这 ...

  7. 超全面的JavaWeb笔记day18<事务&连接池&DBUtils>

    1.事务 ACID 原子性 一致性 隔离性 持久性 mysql中开启和关闭事务 开启事务:START TRANSACTION 结束事务 提交事务:COMMIT 回滚事务:ROLLBACK JDBC中开 ...

  8. discuz x 系列目录结构说明

    api ┄┄┄外部接口  connect ┄┄┄腾讯互联  db ┄┄┄UCenter数据库备份接口  google ┄┄┄Google引擎使用  javascript ┄┄┄数据和广告的 J ...

  9. lua知识点整理

    1. lua全局环境和局部环境 local cf = loadstring(" local i=0 i=i+1 print(i) ") --从后面两个输出我们可以看出,生成的函数的 ...

  10. 使用Jquery做分页效果

    之前写过一个PHP 的分页效果,但是今天小伙伴和我说了一个不适用后台单纯用前段的JS来写分页,整理了一下,代码如下: html: <div id="containet"> ...