简体   繁体   中英

Oracle database links between 10g and 11g

Does anyone have experience with database links between 10g and 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. 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.

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)

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"

The solution is to remove dblinks from the underlying view's select clause (which shouldn't really be there in the first place):

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.

Oracle Support Doc ID 730423.1: Select With Local Function and Remote Tables Using a Dblink Hangs Due To Enq DX.

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 to 11g works as does 10g to 10g - just comes up if you db_link from 11g to 10g.

Specifically, I'm currently seeing this issue using 11.2.0.1 to 10.2.0.3; and 11.2.0.2 to 10.2.0.4. As well as varying O/S releases: Windows and Solaris.

Run this in the target 10g and 11g databases:

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.

Run these queries in your 11g linking database:

/* 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(+);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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