ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11g中对象细粒度管理一例

11g中对象细粒度管理一例

原创 Linux操作系统 作者:to_be_dba 时间:2013-03-15 20:28:40 0 删除 编辑

 

11g中oracle提供了细粒度的对象管理。如:视图所依赖的表若发生结构变化,在10g及以前版本中会导致视图失效,而在11g中,若结构变化未影响视图,则视图仍然有效。

在11g中:

SQL> drop table t;

Table dropped

SQL> create table t as select * from emp;

Table created

SQL> create view v_t as select ename,deptno from t;

View created

SQL> select status from dba_objects where object_name='V_T';

STATUS
-------
VALID

SQL> alter table t add a varchar2(2);

Table altered

SQL> select status from dba_objects where object_name='V_T';

STATUS
-------
VALID

 

在10g中:

SQL> drop table t;

Table dropped

SQL> create table t as select * from emp;

Table created

SQL> create view v_t as select ename,deptno from t;

View created

SQL> select status from dba_objects where object_name='V_T';

STATUS
-------
VALID

SQL> alter table t add a varchar2(2);

Table altered

SQL> select status from dba_objects where object_name='V_T';

STATUS
-------
INVALID

 

若视图是select * from table得到的,即使将视图对应的表增加列,视图也不会失效。

SQL> create view v_t2 as select * from t;

View created

SQL> select status from dba_objects where object_name='V_T';

STATUS
-------
VALID

SQL> alter table t add b varchar2(2);

Table altered

SQL> select status from dba_objects where object_name='V_T';

STATUS
-------
VALID

删除一列,视图依然无动于衷:

SQL> alter table t drop column a;

Table altered

SQL> select status from dba_objects where object_name='V_T';

STATUS
-------
VALID

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26451536/viewspace-756473/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-11-23

  • 博文量
    170
  • 访问量
    484890