object dependencies improve in 11g

September 9th, 2009 | Categories: Boring | Tags:

11gR2出来了,又开始读文档了。

第一章有个例子(Schema Object Dependencies),说道11g中对象之间的耦合性更加弱,DDL不会导致不必要的对象invalid,很多操作都能够从中受益,如 Online Table Redefinition。

下面是在10g中的一个测试.


10g中,尽管依赖表的存储过程和触发器并不涉及新增加的column,但DDL仍然invalidate这些对象。

ORACLE10.2.0.4@ SQL> create or replace trigger test_trig
2    before insert or update
3  on test
4    for each row
5  begin
6  :new.LAST_MODIFIED:=sysdate;
7  end;
8  /
Trigger created.

ORACLE10.2.0.4@ SQL> CREATE OR REPLACE PROCEDURE test_proc
2  AS
3  BEGIN
4   FOR x IN ( SELECT ID,title FROM test )
5   LOOP
6     NULL;
7   END LOOP;
8  END;
9  /
Procedure created.

ORACLE10.2.0.4@ SQL> alter table test add columnM varchar2(20);
Table altered.

ORACLE10.2.0.4@ SQL> select status from dba_objects where object_name=’TEST_PROC’;
STATUS
——-
INVALID

ORACLE10.2.0.4@ SQL> select status from dba_objects where object_name=’TEST_TRIG’;
STATUS
——-
INVALID

如果在11gR2中同样的测试,如上对象就不会invalidate,除非source code中显示的引用到具体的列。

这样给一些应用特别繁忙的表作一些添加列或者修改列定义的DDL操作,更加安全了,避免发生严重的library cache lock&pin等待。

Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
  1. SargentTi
    September 10th, 2009 at 15:59
    Quote | #1

    “11gR2出来了,又开始读文档了”
    娃哈哈

  2. Yong Huang
    September 19th, 2009 at 05:47
    Quote | #2

    Relaxation of the invalidation rule starts in 11gR1, not 11gR2. Here’s what I wrote in my article:
    Oracle 11g somewhat relaxes the invalidation rule by introducing fine-grained dependency. For example, if view V does not reference column C of table T, you can alter T to do anything on C without invalidating V. (This feature can be turned off by setting the parameter _IGNORE_FG_DEPS to NONE, for debugging or troubleshooting purposes.)