客户要求访问两个数据库里的表,不允许我们把数据库导到一个库里,这个sql如何写啊?
例如:
select table1.*,table2.* from table1 , table2 where table1 .id = table2.id
table1 和table2 在两个数据库里

解决方案 »

  1.   

    两个数据库用的用户名和密码是不同的
    select table1.*,table2.* from table1 , table2@dbserver2 where table1 .id = table2.id
    会报 ora-02019错误,说什么远程数据库没有找到,这个密码在哪里指定呢?
      

  2.   

    在A数据库中创建链接数据库,链接到B数据库
    create shared public database link tempB
      connect to 用户名 identified by 密码
      using 'tns name'; 
    然后就可以直接在A中查询,增删改B数据库中的表了,例如现在你在A中,select * from 表名@tempB
      

  3.   

    ORA-02019: connection description for remote database not found