Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
358 views
in Technique[技术] by (71.8m points)

sql - Unable to use two database links in a single query

I'm trying to use two database links in a single query, one for fetching data and the other to insert data. But I'm unable to use them in a single query, even though both of them work perfectly when they are used in separate queries. Can't I use separate database links in a single query and if so why not? The query I'm trying to run is like

INSERT INTO TABLE1@DBLINK1 SELECT * FROM TABLE2@DBLINK2;
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This looks like a bug in 10g. Possibly bug 6320621, ORA-2019 OCCURS WHEN SQL CONNECTS MULTIPLE SITES VIA DBLINK'; or 5713736, 'INSERT INTO STATEMENT WITH SELECT OPTION FAILS USING DB-LINK ORA-02019'. You probably need to raise an SR with Oracle to get this investigated for your specific circumstances.

As an alternative approach, you could maybe consider unloading the data from one database and then loading it into the other. For example, you could use expdp and impdp, with the tables and content=data_only options, to do the transfer in two stages. Of course you need space to store the dump file on your intermediate database server, and it's rather less convenient. You might be able to do that form the source or destination database servers, avoiding the intermediate, but it's not clear if you have any direct access.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...