eygle.com   eygle.com
eygle.com  
 

« 进京六周年 - 我的生活、我的北京 | Blog首页 | ORA-01114、ORA-27067错误案例一则 »

关于Oracle的Dual表

作者:eygle |【转载时请以超链接形式标明文章和作者信息及本声明
链接:

有朋友问到关于Oracle的Dual表问题,并且提到了Tom的一个链接:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1562813956388

很多人关心的是Dual的内部实现,这Oracle自然是不会披露的,不过我们可以从一些有限的资料获得关于Dual的印象:

There is internalized code that makes this happen. Code checks that ensure that a table scan of SYS.DUAL only returns one row. Svrmgrl behaviour is incorrect but this is now an obsolete product.

The base issue you should always remember and keep is: DUAL table should always have 1 ROW. Dual is a normal table with one dummy column of varchar2(1).
This is basically used from several applications as a pseudo table for getting results from a select statement that use functions like sysdate or other prebuilt or application functions.
If DUAL has no rows at all some applications (that use DUAL) may fail with NO_DATA_FOUND exception. If DUAL has more than 1 row then applications (that use DUAL) may fail with TOO_MANY_ROWS exception.

So DUAL should ALWAYS have 1 and only 1 row.

前两句话最为关键,实际上我们也容易猜到,Oracle通过内部代码来实现对于DUAL的访问和控制,并且通过Internal Code使得这个表与众不同。

Tom提到在Close了Database之后,可以看到这个表的内存地址及展现,这说明这个表的结构并不单纯:

SQL> select * from dual;

D
-
X

SQL> alter database close;

Database altered.

SQL> select * from dual;

ADDR          INDX    INST_ID D
-------- ---------- ---------- -
0A4F8858          0          1 X

注意不要更改Dual表的内容,否则可能引起数据库的问题。
如果该表意外删除,可以通过设置初始化参数replication_dependency_tracking = FALSE,重启数据库来重建该表。


历史上的今天...
      >> 2006-04-05文章:
             Oracle10g:v$session_wait_history视图
      >> 2005-04-05文章:
             使用Rman进行不完全恢复
      >> 2004-04-05文章:
------
这篇 【关于Oracle的Dual表 】来自 eygle.com | CSDN网摘| del.icio.us|Google订阅 | 鲜果订阅 | 抓虾订阅

By eygle on 2009-04-05 22:09 | Comments (1) | Posted to FAQ | Edit |

相关文章 随机文章
  • 关注一下Oracle的CPU (Critical Patch Updates)
  • cursor_space_for_time参数在11.1.0.7中
  • 使用Profile对用户Session会话进行资源限制
  • MGMT_VIEW 用户的功能与作用
  • 如何转义口令中的特殊符号(如@)
  • 东方标准系列课程-《深度解析Oracle》
    开始架设Oracle10gR2 RAC系统
    《深度解析Oracle》之 Redo & Undo
    Control SCN of Undo Segments
    Google Book上的Oracle图书
    搜索本站:

    留言 (1)

    谢谢,提到的这些。
    您的邮件我已收到。


    持续关注Dual表中

    Posted by: Zianed at April 8, 2009 1:43 PM

    发表留言:



    Remember Me?
    (输入验证码后方可评论,谢谢支持)



    CopyRight © 2004~2010 eygle.com, All rights reserved.