object dependencies improve in 11g
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
——-
INVALIDORACLE10.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等待。
“11gR2出来了,又开始读文档了”
娃哈哈
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.)