如何使用SQL2000链接服务器查询Oracle 11G表

发布于 2024-09-15 20:10:48 字数 1838 浏览 3 评论 0原文

如何构建使用链接服务器“idwd”查询 Projects_dim 表所需的 SQL?

为了测试连接,我使用链接服务器名称运行了一个示例查询。为了访问链接服务器上的表,我使用了由四部分组成的命名语法:

linked_server_name.catalog_name.schema_name.table_name。

替换这些值,您会得到:

idwd.idwd.wimr.PROJECTS_DIM

of 应该是以下内容吗?

idwd..wimr.PROJECTS_DIM

数据库名称是“idw”,但下面的网格在“catalog”下显示一个空白值,这是我困惑的根源之一,尽管我相信更可能的方法是构建语法,假设合格表的目录部分名称应为空,如以下第一个示例所示。

    select * from idwd..wimr.PROJECTS_DIM
    
    Server: Msg 7314, Level 16, State 1, Line 1
    OLE DB provider 'idwd' does not contain table '"wimr"."PROJECTS_DIM"'.  The table either does not exist or the current user does not have permissions on that table.

select * from idwd.idwd.wimr.PROJECTS_DIM

Server: Msg 7312, Level 16, State 1, Line 1
Invalid use of schema and/or catalog for OLE DB provider 'MSDAORA'. A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog and/or schema.

我需要做什么来查询这个表?

我正在使用适用于 Oracle 的 MS OLEDB 驱动程序。

我想也许存在区分大小写的问题,所以我尝试了这个:

select * from IDWD..WIMR.PROJECTS_DIM


Server: Msg 7356, Level 16, State 1, Line 1
OLE DB provider 'MSDAORA' supplied inconsistent metadata for a column. Metadata information was changed at execution time.

和这个:

select * from IDWD.IDWD.WIMR.PROJECTS_DIM

Server: Msg 7312, Level 16, State 1, Line 1
Invalid use of schema and/or catalog for OLE DB provider 'MSDAORA'. A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog and/or schema.

我尝试使用两个可能的驱动程序中的每一个创建链接服务器:

  1. Microsoft OLEDB Provider for Oracle
  2. Oracle OLEDB 提供程序

..不幸的是。

会不会是驱动问题?

替代文字

How can I construct the SQL that I need to query the Projects_dim table using the Linked Server "idwd"?

To test the connection, I ran a sample query using the linked server name. To access the tables on the linked server, I used a four-part naming syntax:

linked_server_name.catalog_ name.schema_name.table_name.

replacing the values, you get:

idwd.idwd.wimr.PROJECTS_DIM

of should it be the following?

idwd..wimr.PROJECTS_DIM

The database name is "idw" but the grid below shows a blank value under "catalog", which is one source of my confusion, though I believe that the more likely approach is to construct the syntax assuming that the catalog part of the qualified table name should be blank as in the following first example.

    select * from idwd..wimr.PROJECTS_DIM
    
    Server: Msg 7314, Level 16, State 1, Line 1
    OLE DB provider 'idwd' does not contain table '"wimr"."PROJECTS_DIM"'.  The table either does not exist or the current user does not have permissions on that table.

select * from idwd.idwd.wimr.PROJECTS_DIM

Server: Msg 7312, Level 16, State 1, Line 1
Invalid use of schema and/or catalog for OLE DB provider 'MSDAORA'. A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog and/or schema.

What do I need to do to query this table?

I am using the MS OLEDB Driver for Oracle.

I thought perhaps there is an issue with case-sensitivity, so I tried this:

select * from IDWD..WIMR.PROJECTS_DIM


Server: Msg 7356, Level 16, State 1, Line 1
OLE DB provider 'MSDAORA' supplied inconsistent metadata for a column. Metadata information was changed at execution time.

and this:

select * from IDWD.IDWD.WIMR.PROJECTS_DIM

Server: Msg 7312, Level 16, State 1, Line 1
Invalid use of schema and/or catalog for OLE DB provider 'MSDAORA'. A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog and/or schema.

I tried to create a linked server using each of the two likely drivers:

  1. Microsoft OLEDB Provider for
    Oracle
  2. Oracle Provider for OLEDB

..without luck.

Could it be a driver issue?

alt text

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

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

发布评论

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

评论(2

记忆で 2024-09-22 20:10:48

听起来您可能在正确的轨道上考虑这是一个区分大小写的问题。引用自微软支持文档如何设置链接服务器并对其进行故障排除SQL Server 中的 Oracle 数据库关于错误 7312、7313、7314:

如果您收到这些错误消息,
Oracle 中可能缺少表
架构,否则您可能没有权限
在那张桌子上。验证架构
名称已通过使用输入
大写。按字母顺序排列的情况
表和列应该是
按照Oracle系统中指定的
表。

在 Oracle 端,一个表或一个
不使用 double 创建的列
引号存储在
大写。如果表或列
用双引号括起来,
表或列存储为
是。

Sounds like you may be on the right track thinking about this as an issue of case sensitivity. Quoting from the Microsoft support document How to set up and troubleshoot a linked server to an Oracle database in SQL Server regarding errors 7312, 7313, 7314:

If you receive these error messages, a
table may be missing in the Oracle
schema or you may not have permissions
on that table. Verify that the schema
name has been typed by using
uppercase. The alphabetical case of
the table and of the columns should be
as specified in the Oracle system
tables.

On the Oracle side, a table or a
column that is created without double
quotation marks is stored in
uppercase. If the table or the column
is enclosed in double quotation marks,
the table or the column is stored as
is.

温柔戏命师 2024-09-22 20:10:48

我刚刚解决了这个问题。如果 Oracle 以前确实有效,那么它可能是最近升级的。

为了解决这个问题,我连接到 Oracle 并执行了“descr TABLENAME;”并检查有问题的列。就我而言,我的列类型为 NUMBER,没有任何比例,如本预览所示。

Preview

我要求 DBA 强制对这 3 列进行缩放,问题现已解决!

但我确实发现这个解决方案还有一个解决方法。您还可以将 TSQL

从 更改为

SELECT * FROM idwd..wimr.PROJECTS_DIM

如果未在列上设置可为空性,

SELECT * FROM OPENQUERY(idwd,'select * from wimr.PROJECTS_DIM')

则 Microsoft 支持人员会报告问题。

有关我的 在 Google 上搜索

I just resolved this issue. Oracle was probably upgraded recently if it did worked before.

To resolve I connected to Oracle and did a "descr TABLENAME;" and check whatever column was in problem. In my case, I had a column type as NUMBER without any scale like in this preview.

Preview

I asked a DBA to force a scale for these 3 columns and problem is now solved!

But I did find also there is a workaround this solution. You can also change the TSQL

from

SELECT * FROM idwd..wimr.PROJECTS_DIM

to

SELECT * FROM OPENQUERY(idwd,'select * from wimr.PROJECTS_DIM')

And Microsoft Support report a problem if nullability is not set on a column.

More info about my search on Google.

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