需要从sqlplus连接到两个不同的db

Hem*_*ant 1 unix oracle shell scripting sqlplus

我需要从两个不同的数据库中获取信息.

select * from TABLE_ONDB2 where column_on_db2 in ( select column_on_db1 from TABLE_ONDB1 );

问题是在不同的数据库实例上,所以我无法弄清楚如何放置表名和列名等.

我希望我的问题很明确.

Mar*_*and 5

我试着用数据库链接做到这一点:

http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/ds_concepts002.htm

但是,这不是SQL*Plus功能.它的工作原理是建立从DB2到DB1的连接(数据库正在这样做).

You can then query both tables from DB2 with the '@db-link' name notation. e.g.,

select *
  from TABLE_ONDB2
 where column_on_db2
    in (select column_on_db1 from TABLE_ONDB1@DB_LINK_NAME);
                                             ^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)

The benefit is that you can access the table in all different ways, also as a join.