Solved

Poor performance of linked oracle server

Posted on 2004-09-29
6
310 Views
Last Modified: 2012-06-27
Hi there

Am wondering if anyone may able to offer any suggestions for a problem I'm having with a SQL linked servers.

I've got a SQL server running which has a linked server to an oracle database.  I'm finding that a query run via the SQL server takes signifigantly longer than if I run the same query with a straight ODBC connection. (4 seconds on ODBC vs 4 minutes 50 seconds with a linked server.)

Any ideas about what could be causing the lag?

Regards


Marty
0
Comment
Question by:martypitt
6 Comments
 
LVL 34

Expert Comment

by:arbert
ID: 12187298
Maybe--can you post the query.  What happens if you use OPENQUERY against the server instead of using the linked server directly?

select * from openquery(yourlinkedservername,'thesql statement')


When you use a linked server, SQL Server will pass the criteria to the server that it thinks it can "safely" pass.  If it doesn't know how to pass a where clause or function, it will select all the records from the linked server and perform the criteria on the local SQL Server instead.  When you use openquery, a passthru query is actually passed.

Brett
0
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 12187704

With ODBC Connection U get only partial data(If ur data has alot of rows)

But when u use it with penquery from a linked server, SQL Server would try to get all rows into a temp Table in Tmpdb, for that reason it would took along time.

If not the problem would be Client Connection Drivers.

Or ur linked Server Oracle Db Connection Provider could be different then the ODBC Driver.


Melih SARICA

0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 12188053
as Arbert indicates, the problem might be the "query" so that SQL server cannot optimize it.

Sample Query with probable bad performance:
select * from OracleServer..Schema.table1
, OracleServer.Schema.Table2
where table1.pk = table2.pk

Sample query with best performance:
select * from OpenQuery ( OracleServer,
' select col1, col2, .... from Schema.table1
, Schema.Table2
where table1.pk = table2.pk
' )

The reason is explained by non_zero: in the first case, the join is performed on the local Sql server, thus all the data from both tables needs to be transferred to the sql server.
The second sample passes the sql to the oracle box, the join is performed on the oracle box, and only the results are send back

Cheers

CHeers
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 10

Expert Comment

by:imrancs
ID: 12192471
hmmm, good information for me as well
0
 
LVL 34

Expert Comment

by:arbert
ID: 12192485
Always --especially with linked servers--you finally figure out some workarounds for their poor performance...
0
 
LVL 34

Expert Comment

by:arbert
ID: 12195625
So what did you find the problem was?
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Suggested Solutions

In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now