物化视图导出导入可能导致物化视图日志的失效

SQL> create user yang identified by yang;
用户已创建。
已用时间:  00: 00: 00.10
SQL> grant resource,connect to yang;
授权成功。
已用时间:  00: 00: 00.01
SQL> grant create meterialized view to yang;
grant create meterialized view to yang
      *
第 1 行出现错误:
ORA-00990: 权限缺失或无效
已用时间:  00: 00: 00.01
SQL> show user
USER 为 "SYS"
SQL> grant create materialized view to yang;
授权成功。
已用时间:  00: 00: 00.00
SQL> create user b identified by b;
用户已创建。
已用时间:  00: 00: 00.01
SQL> grant create materialized view to b;
授权成功。
已用时间:  00: 00: 00.00
SQL> grant create materialized view to b;
授权成功。
已用时间:  00: 00: 00.04
SQL> conn yang/yang
已连接。
SQL> select * from tab;
未选定行
已用时间:  00: 00: 00.07
SQL> create table t(id number primary key);
表已创建。
已用时间:  00: 00: 00.21
SQL> insert into t values(1);
已创建 1 行。
已用时间:  00: 00: 00.01
SQL> col change_vector$$ format a40
SQL> select * from mlog$_t;
select * from mlog$_t
              *
第 1 行出现错误:
ORA-00942: 表或视图不存在
已用时间:  00: 00: 00.00
SQL> select * from sys.mlog$_t;
select * from sys.mlog$_t
                  *
第 1 行出现错误:
ORA-00942: 表或视图不存在

已用时间:  00: 00: 00.00
SQL> rollback;
回退已完成。
已用时间:  00: 00: 00.04
SQL> create materialized view log on t;
实体化视图日志已创建。
已用时间:  00: 00: 00.39
SQL> create materialized view mv_t as select * from t;
实体化视图已创建。
已用时间:  00: 00: 01.21
SQL> insert into t values(1);
已创建 1 行。
已用时间:  00: 00: 00.04
SQL> col change_vector$$ format a40
SQL> select * from mlog$_t;

        ID SNAPTIME$$     D O CHANGE_VECTOR$$                                  
---------- -------------- - - ----------------------------------------         
         1 01-1月 -00     I N FE                                               
已用时间:  00: 00: 00.00
SQL> commit;
提交完成。
已用时间:  00: 00: 00.00
SQL> exec dbms_mview.refresh('mv_t');
PL/SQL 过程已成功完成。
已用时间:  00: 00: 00.79
SQL> commit;
提交完成。
已用时间:  00: 00: 00.00
SQL> select * from mv_t;
        ID                                                                     
----------                                                                     
         1                                                                     
已用时间:  00: 00: 00.00
SQL> grant resource,connect to b;
grant resource,connect to b
*
第 1 行出现错误:
ORA-01031: 权限不足
已用时间:  00: 00: 00.04
SQL> conn system/yang as sysdba
已连接。
SQL> grant resource,connect to b;
授权成功。
已用时间:  00: 00: 00.01
SQL> conn yang/yang
已连接。
已用时间:  00: 00: 00.01
SQL> insert into t values (2);
已创建 1 行。
已用时间:  00: 00: 00.00
SQL> select * from mlog$_t;

        ID SNAPTIME$$     D O CHANGE_VECTOR$$                                  
---------- -------------- - - ----------------------------------------         
         2 01-1月 -00     I N FE                                               
已用时间:  00: 00: 00.00
SQL> conn b/b
已连接。
SQL> select * from mlog$_t;
未选定行
已用时间:  00: 00: 00.00
SQL> select * from tab;
TNAME                          TABTYPE  CLUSTERID                              
------------------------------ ------- ----------                              
MLOG$_T                        TABLE                                           
MV_T                           TABLE                                           
RUPD$_T                        TABLE                                           
T                              TABLE                                           
已用时间:  00: 00: 00.03
SQL> select * from t;
        ID                                                                     
----------                                                                     
         1                                                                     

已用时间:  00: 00: 00.01
SQL> select * from mv_t;
        ID                                                                     
----------                                                                     
         1                                                                     

已用时间:  00: 00: 00.01
SQL> insert into t values (2);
已创建 1 行。
已用时间:  00: 00: 00.00
SQL> select * from t;
        ID                                                                     
----------                                                                     
         1                                                                     
         2                                                                     

已用时间:  00: 00: 00.00
SQL> select * from mv_t;
        ID                                                                     
----------                                                                     
         1                                                                     

已用时间:  00: 00: 00.00
SQL> exec dbms_mview.refresh('mv_t');
BEGIN dbms_mview.refresh('mv_t'); END;

*
第 1 行出现错误:
ORA-12018: 在创建 "B"."MV_T" 的代码时出现以下错误
ORA-01741: 非法的零长度标识符
ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2537
ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2743
ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2712
ORA-06512: 在 line 1

已用时间:  00: 00: 00.57
SQL> conn yang/yang
已连接。
SQL> select * from t;
        ID                                                                     
----------                                                                     
         1                                                                     
         2                                                                     

已用时间:  00: 00: 00.01
SQL> select * from mv_t;
        ID                                                                     
----------                                                                     
         1                                                                     
已用时间:  00: 00: 00.01
SQL> exec dbms_mview.refresh('mv_t');
PL/SQL 过程已成功完成。
已用时间:  00: 00: 00.42
SQL> select * from mv_t;
        ID                                                                     
----------                                                                     
         1                                                                     
         2                                                                     
已用时间:  00: 00: 00.00
SQL> select * from t;
        ID                                                                     
----------                                                                     
         1                                                                     
         2                                                                     

已用时间:  00: 00: 00.00

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

转载于:http://blog.itpub.net/22664653/viewspace-668661/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值