简体   繁体   English

10g和11g之间的Oracle数据库链接

[英]Oracle database links between 10g and 11g

Does anyone have experience with database links between 10g and 11g? 有没有人有10g和11g之间的数据库链接经验?

Is this a supported setup/operation? 这是受支持的设置/操作吗? Is it possible? 可能吗? Are there any problems? 有什么问题吗? Caveats? 注意事项?

I've been using DB Links from 11g to 10g. 我一直在使用11g到10g的数据库链接。 No big issues. 没有大问题。

Only caveat is that 11g can use mixed-case passwords and you might want to switch that off if you are trying to connect from a 10g database to an 11g one. 唯一需要注意的是,11g可以使用大小写混合的密码,如果尝试从10g数据库连接到11g数据库,则可能需要关闭密码。

A view with dblink in the select list can no longer be accessed from another schema via a synonym (used to work in Oracle 10) 选择列表中具有dblink的视图不再可以通过同义词从另一个模式访问(用于Oracle 10)

The view 风景

create or replace foo_view as
select foo.id@link id --yes, I know this is stupid... legacy code
from foo@link

On other DB user 在其他数据库用户上

create synonym foo_synonym for otherdb.foo_view

select foo_synonym: "ORA-02019 connection description for remote database not found" 选择foo_synonym:“找不到远程数据库的ORA-02019连接描述”

The solution is to remove dblinks from the underlying view's select clause (which shouldn't really be there in the first place): 解决方案是从基础视图的select子句中删除dblinks(首先不应真正存在该子句):

create or replace foo_view as
select foo.id id
from foo@lin foo

Sometimes there are problems, when a link from 11G to 10.2.0.4. 当从11G到10.2.0.4的链接时,有时会出现问题。

Oracle Support Doc ID 730423.1: Select With Local Function and Remote Tables Using a Dblink Hangs Due To Enq DX. Oracle Support文档ID 730423.1:由于Enq DX,使用Dblink的带有本地函数和远程表的选择挂起。

ORA-01719 can also be thrown if you have an outer join query in 11g that also uses IN or OR and the tables are being referenced through a db_link to 10g. 如果您在11g中有一个外部联接查询也使用IN或OR,并且通过db_link将表引用到10g,则也可能引发ORA-01719。

11g to 11g works as does 10g to 10g - just comes up if you db_link from 11g to 10g. 11g至11g和10g至10g一样工作-如果db_link从11g至10g,就会出现。

Specifically, I'm currently seeing this issue using 11.2.0.1 to 10.2.0.3; 具体来说,我目前使用11.2.0.1至10.2.0.3看到此问题; and 11.2.0.2 to 10.2.0.4. 和11.2.0.2至10.2.0.4。 As well as varying O/S releases: Windows and Solaris. 以及不同的O / S版本:Windows和Solaris。

Run this in the target 10g and 11g databases: 在目标10g和11g数据库中运行此命令:

create table u1 (c1 number);
create table u2 (c1 number, c2 number);
insert into u1 values (1);
insert into u1 values (2);
insert into u2 values (1,1);
insert into u2 values (1,2);
commit;

Create db_links (DB10, DB11) in your 11g linking database to both the 10g and 11g linked databases. 在11g链接数据库中创建到10g和11g链接数据库的db_links(DB10,DB11)。

Run these queries in your 11g linking database: 在11g链接数据库中运行以下查询:

/* this will fail 11g to 10g*/
SELECT *
FROM u1@DB10 a,
(SELECT *
FROM u2@DB10
WHERE c1 IN (1, 2, 3)) b
WHERE a.c1 = b.c1(+);

/* this will work 11g to 11g*/
SELECT *
FROM u1@DB11 a,
(SELECT *
FROM u2@DB11
WHERE c1 IN (1, 2, 3)) b
WHERE a.c1 = b.c1(+);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM