欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle 11g创建远程物化视图时提示“ORA

程序员文章站 2024-04-05 11:01:54
...

----建立测试环境DBLINK:create database link lnk connect to user1 identified by pwd1 using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = 172.17.211.114)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SID= REMOTEDB

----建立测试环境DBLINK:
create database link lnk
  connect to user1
  identified by pwd1
  using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = 172.17.211.114)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SID= REMOTEDB)))';

--创建物化视图,每隔两天自动同步更新一次;
  CREATE MATERIALIZED VIEW DEPARTMENT  
     REFRESH FORCE                 
     START WITH SYSDATE                   
     NEXT  SYSDATE + 2                  
     WITH PRIMARY KEY       
  AS SELECT * FROM user1.DEPARTMENT@lnk WHERE 1=1;     

将远程服务器的一个表映射为本地的一个物化视图,使用下列语句:


结果提示:"ORA-01788: 此查询块中要求 CONNECT BY 子句"。

Oracle 11g创建远程物化视图时提示“ORA

google无法访问,百度搜索太扯蛋,用必应,总算得到线索,解决方案:

在本地库中执行如下语句:

ALTER SYSTEM SET "_ALLOW_LEVEL_WITHOUT_CONNECT_BY"=TRUE SCOPE=BOTH 


OK!


助人等于自助! 3w@live.cn