可以链接到另一个数据库链接吗?

问题描述:

我们在Oracle数据库中有一个现有的数据库链接,该链接链接到Sql Server数据库中的数据.现在,第二个Oracle数据库需要使用相同的数据.由于安全性设置,第二个Oracle数据库无法查看" Sql Server数据库,但可以看到第一个Oracle数据库.

We have an existing database link in an Oracle database that links to data in a Sql Server database. Now, a 2nd Oracle database needs to use that same data. Due to security setup, the 2nd Oracle database cannot "see" the Sql Server database, but it can see the 1st Oracle database.

如果我们在第二个Oracle数据库中创建一个指向第一个Oracle数据库的数据库链接,是否可以通过2个数据库链接从第二个Oracle数据库中的Sql Server数据库查询数据?查询语法如下所示:

If we create a database link in the 2nd Oracle database that points to the 1st Oracle database, will we be able to query data from the Sql Server database in the 2nd Oracle database by going through 2 database links? Would the query syntax look like this:

SELECT * FROM myTable@2ndLink@1stLink

以前有人做过这样的事吗?

Has anyone done something like this before?

我不确定此Synthax是否可以工作(尽管测试它很有趣,但我现在无法做到).但是,即使它不起作用,您仍然可以在数据库1中创建一个视图,该视图指向SQL Server数据库中的表.您可以从数据库2中查询:

I'm not sure this synthax would work (although it would be interesting to test it I can not do it right now). However, even if it doesn't work, you can still create a view in Database 1 that points to a table in your SQL Server Database. From Database 2, you could then query:

SELECT * FROM myView@db1

那将指向正确的表.