How to use a SQL2000 Linked Server to query an Oracle 11G table
Asked Answered
Z

2

2

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

Zetta answered 20/8, 2010 at 20:1 Comment(0)
H
0

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.

Homager answered 20/8, 2010 at 20:52 Comment(0)
C
0

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.

Canebrake answered 16/11, 2012 at 17:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.