0

We are migrating from SQL Server 2005 to Oracle 11G. I have been trying to do an update to a table in Oracle using data stored in a table in SQL Server.

Using SQL Developer, I have completed the following:

  1. Created a connection to the Oracle Database

    Created Connection name --> e9_crp
    Supplied User name and Pass
    Defined Host Name and SID
    
  2. I also created a connection to the SQL Server that contains the reference data

    Connection Name --> sql_data
    User Name and Pass
    Host and Port
    

The connection name used for SQL Server is sql_data

The connection name used for Oracle is e9_crp

The table in SQL Server is in a database my_tmp with owner of dbo and is called tiers (my_tmp.dbo.tiers).

In SQL Developer, I can see, select, and view the tiers table. This SQL statement also works using the worksheet when in the sql_data connection:

 select * from [my_tmp].[dbo].[tiers]

Trying to connect to this table when in the e9_crp connection schema, I have been trying to do something like this:

 select * from [sql_data].[my_tmp].[dbo].[tiers]

But this returns an error stating that the tiers table does not exist:

 ORA-00903: invalid table name
 00903. 00000 -  "invalid table name"

Both tables have a unique ID of 'item', so in a perfect world this should work:

 select a.itm, b.tier
 from [e9_crp].[crpdta].[itemmaster] a inner join [sql_data].[my_tmp].[dbo].[tiers] b
     on(a.itm = b.itm)

This is assuming that I use the connection name in the table identifier. BUT, this obviously does not work. What I need to do is be able to join these 2 databases together in a similar fashion as necessary.

How can I use SQL Developer to join these 2 tables? I have tried multiple iterations of table strings for the join but no luck. Any help is appreciated.

4

1 回答 1

1

Oracle 有 DBLink 的概念,SQL Server 有 Linked Server 的概念。这两个功能都允许您从两个单独的数据库中查询数据。

这是一个链接,其中包含将 Oracle DBLink 设置到 SQL Server DB 的说明...

http://www.dba-oracle.com/t_database_link_sql_server_oracle.htm

这是一个链接,其中包含将 SQL Server 链接服务器设置到 Oracle DB 的说明......

http://support.microsoft.com/kb/280106

另请参阅此 SO 帖子...

SQL 语句加入 Oracle 和 MS SQL Server

于 2013-07-22T20:25:30.627 回答