从 Oracle 查询 SQL Server - 强制元数据刷新

发布于 2024-07-20 16:49:53 字数 299 浏览 1 评论 0原文

我是一名 SQL Server 开发人员,负责 Oracle 中的任务。 DBA 在 Oracle 中设置一个指向 SQL Server 数据库的 DBLink。 我正在编写一个关于 SQL Server 数据的视图,然后在 Oracle 端编写一个视图,以将其与其他 Oracle 数据连接起来。

问题:如果我更改 SQL Server 上视图的定义,甚至“Select * From myview@dblink”也会出现“无效列”错误。 关闭TOAD并重新打开似乎可以纠正问题,但真正的问题是如何在不重置连接的情况下强制Oracle重新读取元数据?

I am a SQL Server developer, with a task in Oracle. DBA set up a DBLink in Oracle that points at a SQL Server database. I am writing a view on the SQL Server data and then a view on the Oracle side to join it with additional Oracle data.

Problem: if I change the definition of the view on SQL Server, even "Select * From myview@dblink" errors with "Invalid column." Closing TOAD and reopening seems to correct the problem, but the real question is how to force Oracle to re-read the metadata without resetting the connection?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

猫腻 2024-07-27 16:49:53

这听起来像是 TOAD 的问题,而不是 Oracle 的问题。 如果在 SQL*Plus 中执行此操作会发生什么情况?

This sounds like an issue with TOAD, not oracle. What happens if you do it in SQL*Plus?

梅倚清风 2024-07-27 16:49:53

我不知道我是否理解您的意思,但是如果您有一个指向 Oracle 数据库中的 SQL Server 数据库的 dblink,并且您需要 SQL Server 中的数据,只需执行以下操作:

SELECT *
FROM TABLE@dblink

SELECT "COL", "COL2", "COL3
from TABLE@dblink


SELECT T."COL", H."COL"
FROM TABLE1@dblink T, TABLE2@dblink H
WHERE T."ID" = H."ID"

I dont know if I understand you but if you got a dblink that points to a SQL server DB in your Oracle DB and you need data in SQL server just do:

SELECT *
FROM TABLE@dblink

SELECT "COL", "COL2", "COL3
from TABLE@dblink


SELECT T."COL", H."COL"
FROM TABLE1@dblink T, TABLE2@dblink H
WHERE T."ID" = H."ID"
離人涙 2024-07-27 16:49:53

也许你可以这样做?:

alter view <<view_name>> compile; 

我还没有测试过这个,因为我没有从 Oracle 到 MSSQL 的数据库链接。

Maybe you can do?:

alter view <<view_name>> compile; 

I haven't tested this because I have no db link from Oracle to MSSQL.

や莫失莫忘 2024-07-27 16:49:53

这似乎是 Oracle 10g 客户端的问题。 目前的解决方案是断开连接并重新连接。 鉴于我无法找到其他人遇到此问题,我将假设这是我的客户端配置的问题。

This seems to be an issue with the Oracle 10g client. The current solution is to disconnect and reconnect. Given that I haven't been able to find anyone else with this problem, i will assume that it is a problem with my client config.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文