Link Server doesn''t work except through query analyzer: MSSQL freezing / timing out

  • Environment:

    Server1 (Local)

    OS Windows 2000 Server

    SQL Server 2000

    Server2 (Remote)

    OS Windows 2003 Server

    SQL Server 2000

    (Both with most recent service packs)

    Using Enterprise Manager, we have set up the Link Server (LINK_A) in the Local Server 1 to connect to Server 2.

    The SQL we need to run is the following:

    INSERT INTO table1(column1,column2)

    SELECT A.column1, A.column2

    FROM LINK_A.catalog_name.dbo.table2 AS A

    WHERE A.column1 > xxxx;

    When we run this from the Query Analyzer, it completes with no problems in a few seconds.

    Our problem:

    When we add the DTS Package as the ActiveX Script (VB Script) to the Local Package, it times out at "obj_Conn.Execute str_Sql"

    Dim Sql, obj_Conn

    Set obj_Conn = CreateObject("ADODB.Connection")

    obj_Conn.Open XXXX

    obj_Conn.BeginTrans

    str_Sql = "INSERT INTO table1("

    str_Sql = str_Sql & "column1"

    str_Sql = str_Sql & ", column2"

    str_Sql = str_Sql & ")"

    str_Sql = str_Sql & " SELECT A.column1"

    str_Sql = str_Sql & ", A.column2"

    str_Sql = str_Sql & " FROM LINK_A.catalog_name.dbo.table2 AS A"

    str_Sql = str_Sql & " WHERE A.column1 > 0"

    str_Sql = str_Sql & ";"

    obj_Conn.Execute str_Sql

    ----------------------------------------------------------

    When we make a Stored Procedure and run the following SQL, it freezes.

    INSERT INTO table1(column1,column2)

    SELECT A.column1, A.column2

    FROM LINK_A.catalog_name.dbo.table2 AS A

    WHERE A.column1 > xxxx

    We've also tried the following with the same results;

    INSERT INTO table1(column1,column2)

    SELECT A.column1, A.column2

    FROM [LINK_A].[catalog_name].[dbo].[table2] AS A

    WHERE A.column1 > xxxx

    The same thing happens when we try to run the "SELECT" by itself.

    SELECT TOP 1 @test-2=A.column1

    FROM LINK_A.catalog_name.dbo.table2 AS A

    WHERE A.column1 > xxxx

    ORDER BY A.column1

    What is going wrong here, and how do we need to change this so that it runs without timing out or freezing?

  • - What's your connection's authorisation ? Is it the same as with QA ?

    - I guess your connection is running in "repeatable read"-isolation level ! More locking-related resources are needed, waits, ...

    - Why don't you just create a second dts-connection and import the needed data into your table1 ? This is easier, better controlable and without the caveots linked servers have.

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Compare the connection properties of the two environments. One or more of the differences could be causing your problem...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • check the security option which u have choosen

    try using the last option

    "be made using this security context"

    and specify the remote login and password...


    Thanks ,

    Shekhar

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply