Groups | Blog | Home
all groups > sql server programming > july 2007 >

sql server programming : Linked Servers... Connection timeout



Gowtham
7/18/2007 9:42:02 PM
Hello all!

I am writing a stored procedure in SQL SERVER 2000 that queries multiple
remote databases.
When one of them timesout, it will give the error 7399

Error Log:
----------------
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'SQLOLEDB' reported an error.
[OLE/DB provider returned message: Timeout expired]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' IDBInitialize::Initialize
returned 0x80004005: ].


and stop everything after it. is there a way to trap the error and continue

I have applied both the fixes given in Microsoft KB article

http://support.microsoft.com/kb/314530

but the problem still exist

can anyone please help on this

Gowtham
7/18/2007 10:26:02 PM
Yes I have pingged the server and connection is fine.

also when I re-execute the procedure then the connection is fine ...

but the problem is I need to create a job for this stored procedure ...



[quoted text, click to view]
Gowtham
7/18/2007 10:44:00 PM
yes we use a private VPN and our connections to remote servers arew fine.

when I run on local server the result will be displayed within 00:00:15
seconds



[quoted text, click to view]
Gowtham
7/18/2007 11:04:01 PM
Hi,

The functionality of my procedure is as follows

we have 700 remote servers and in each remote server I have written a
procedure.
This procedure stores the result in temp table in remote server

step-1 I will create a table which consists of connection information like
username,passwordetc... I havent used any index on this table but a cursor
will fetch all the rows and then goes for next step

step-2
From my local server I will connect to these 700 servers then
1. Execute the stored procedure on the remote server
2. pulls the data from the temp table in remote server
3. Dumps the data into a local table

The result rows returned from each remote server would typically vary from
10 to 15 rows.

Observation:
--------------
If in a remote server I get time out expired , Iam re-executing the procedure
Then I was able to connect to that remote server and can pull the data



[quoted text, click to view]
Gowtham
7/18/2007 11:42:01 PM
set @s1 = 'exec OPENDATASOURCE('+'''SQLOLEDB'''+','+'''Data
Source='+@ClientIPAddress+';User
ID=sa;Password='+@ClientPassword+''''+')'+'.master.dbo.sp_space_check'
exec(@s1)


result of sp is inserted into temp table in the SP itself .

[quoted text, click to view]
Uri Dimant
7/19/2007 12:00:00 AM
Hi
What if you try the following on the 'problematic' server?

EXEC SVRName.master..sp_space_check

If you have created linked server why would you want to use such dynamic
SQL?



[quoted text, click to view]

Uri Dimant
7/19/2007 12:00:00 AM
Hi
How do you execute the SP? exec svrname.dbname.dob.SP?

One more question , can you tell me , the result of SP should be inserted
into a temporary table within the same SP or do you have separated batch?


[quoted text, click to view]

Uri Dimant
7/19/2007 12:00:00 AM
Hi
Well, you are getting pretty big output or your query does not have properly
created indexes. How many rows do you get back?
Have you looked at execution plan? Does it use indexes?



[quoted text, click to view]

Uri Dimant
7/19/2007 12:00:00 AM
Hi
Is network traffic OK?
When you run the query on local database , does it return result fast?



[quoted text, click to view]

Uri Dimant
7/19/2007 12:00:00 AM
Hi
Did you have PING to the remote server?


[quoted text, click to view]

AddThis Social Bookmark Button