如何使用SQL2000链接服务器查询Oracle 11G表
如何构建使用链接服务器“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.
我尝试使用两个可能的驱动程序中的每一个创建链接服务器:
- Microsoft OLEDB Provider for Oracle
- 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:
- Microsoft OLEDB Provider for
Oracle - Oracle Provider for OLEDB
..without luck.
Could it be a driver issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您可能在正确的轨道上考虑这是一个区分大小写的问题。引用自微软支持文档如何设置链接服务器并对其进行故障排除SQL Server 中的 Oracle 数据库关于错误 7312、7313、7314:
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:
我刚刚解决了这个问题。如果 Oracle 以前确实有效,那么它可能是最近升级的。
为了解决这个问题,我连接到 Oracle 并执行了“descr TABLENAME;”并检查有问题的列。就我而言,我的列类型为 NUMBER,没有任何比例,如本预览所示。
我要求 DBA 强制对这 3 列进行缩放,问题现已解决!
但我确实发现这个解决方案还有一个解决方法。您还可以将 TSQL
从 更改为
如果未在列上设置可为空性,
则 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.
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
to
And Microsoft Support report a problem if nullability is not set on a column.
More info about my search on Google.