Solved

Anomalies in database link querying (Oracle to MS SQL Server 2005)

Posted on 2012-12-20
6
1,099 Views
Last Modified: 2013-01-08
I have a database link from oracle to mssql using db4odbc / odbc32 (windows)

Problem 1,

When i do 

SELECT 
    *
  FROM Orderdetail@"DB"

query executes in 0.561 seconds..

when i do 

SELECT 
    *
  FROM Orderdetail@"DB" where "ItemNumber" = 10242;
This query was running for 10 minutes before i canceled it, (i know we have a itemnumber 10242

Open in new window


Problem 2
when i do 
SELECT 
    *
  FROM Customers@"DB";

I get
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'A'. {42S22,NativeErr = 207}[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'RContactName'. 
ORA-02063: preceding 2 lines from DB
28500. 00000 -  "connection from ORACLE to a non-Oracle system returned this message:"

Open in new window



Problem 3

I have to use double quotes on "ColumnNames" in order to exectute query, I can't do ColumnNames, is there anyway to get rid of this?
0
Comment
Question by:futureDBA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 43

Expert Comment

by:Eugene Z
ID: 38710441
how fast does the query SELECT
    *
  FROM Orderdetail where ItemNumber = 10242;


run on sql server?  ItemNumber  may has no indexes or you run during busy hours and something is blocking  specially if the table is big.


about this one  run the query in Sql server first and try do not use * -
--
also you may check this

Accessing SQL Server from Oracle with Database Gateway for ODBC (DG4ODBC)

http://www.easysoft.com/applications/oracle/database-gateway-dg4odbc.html#config
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 38710498
The first one looks like Oracle is doing the filtering - evaluating "ItemNumber" itself, which is disastrous. I assume this is related to the second "bug".

The second one seems to result from case-sensitivity. MSSQL is not case-sensitive by default, but maybe the DB was installed that way, and hence requires exact the same notation?
0
 

Author Comment

by:futureDBA
ID: 38713534
i ran the same query

one via oracle (Sql Developer) one straight from the MS SQL Server using Toad for SQL,

Oracle execution time = 84.998 seconds
MSSQL execution time = 0.0051 seconds

SELECT
    *
  FROM Orderdetail@"DB" where "ItemNumber" = 10242
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 70

Expert Comment

by:Qlemo
ID: 38713689
Can you execute the query on MSSQL without the double quotes?
0
 

Author Comment

by:futureDBA
ID: 38713780
yes, in mssql (via toad) I can do

SELECT * FROM Orderdetail where itemnumber = 10242
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 38714216
Then I guess you have issues with the dblink, using ODBC. Then you might want to switch to Ole DB, which can use Native Driver, and allows for better support of datatypes and objects.
hsolesql, which is the corresponding application (to be used in the PROGRAM section of the HS listener file), is desupported meanwhile, but can be used nevertheless. You have to create a .UDL file containing:
[oledb]
Provider=SQLOLEDB.1;Password=Pwd;Persist Security Info=True;User ID=Usr;Initial Catalog=TheDB;Data Source=TheMSSQLInstance;Application Name=Orace-Gateway 

Open in new window

Then create a hs/admin/init«OLE-SID».ora file as copy of the corresponding template in that folder (renaming your ODBC one, of course), and enter the full path and name of above UDL file with forward slashes.
More info about the "old" HS methods: http://docs.oracle.com/cd/B19306_01/server.102/b14232/gencon.htm
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question