Setting up distributed transactions between Standard and Express?

  • If this is the wrong area for the question, please let me know.

    We have an application running on some computers under 2005 Express. Due to the 4GB limit in Express, the users want to archive data to a server running 2005 Standard.

    I coded a script to copy and delete data from the computer to the server but ran into an error.

    Here is a partial script:

    begin try

    begin distributed transaction

    set identity insert [mydatabase].[dbo].[table1] on

    insert into [server].[mydatabase].[dbo].[table1]

    (list_of_columns)

    select list_of_columns

    from [computer].[mydatabase].[dbo].[table1]

    where conditions

    set identity insert [mydatabase].[dbo].[table1] off

    delete from [computer].[mydatabase].[dbo].[table1]

    where conditions

    commit

    end try

    begin catch

    if @@trancount > 0 rollback

    select @errmsg = error_message(), @err_severity = error_severity()

    raiserror(@errmsg, @err_severity, 1)

    end catch

    The error messages I received was:

    OLE DB provider "SQLNCLI" for linked server "10.121.18.50\SQLEXPRESS" returned message "The partner transaction manager has disabled its support for remote/network transactions.".

    Msg 50000, Level 16, State 1, Line 255

    The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "10.121.18.50\SQLEXPRESS" was unable to begin a distributed transaction.

    I performed the script testing using test databases on the same server and it worked fine. Changing the server names to the real ones made the script fail.

    The computer I'm copying and deleting from is running 2005 Express. Is that an issue?

    Is starting distributed transactions as simple as enabling the Distributed Transaction Coordinator on the client computer?

    Is replication an option? Replicating the computer database to the server, and let the server do an updating replication? Logically it would be on the "same server". Or are there issues with Express here as well?

    TIA,

    Loyd

  • 1st question:

    are you going from x64 to x86 at any point?

    2nd question:

    Have you verified that the linked servers are configured properly and working?

    3rd question:

    Go to the server and do Start->Programs->Administrative tools->Component Services. Right click on My Computer and select properties. Under the MSDTC tab click on Security Configuration. Is the Network DTC Access box checked? What about the Transaction Manager Communication?

  • are you going from x64 to x86 at any point?

    No, all are x86-32bit.

    Have you verified that the linked servers are configured properly and working?

    As far as I can tell, yes. Have a linked server to "10.121.18.50\SQLEXPRESS". Can expand to Catalogs and see correct databases inside. From the server, can run a query such as "select * from [10.121.18.50\SQLEXPRESS].[6f_module].[dbo].[tblvbssweepdata]" and it returns results.

    Go to the server and do Start->Programs->Administrative tools->Component Services. Right click on My Computer and select properties. Under the MSDTC tab click on Security Configuration. Is the Network DTC Access box checked? What about the Transaction Manager Communication?

    On the server itself - nothing checked under Security Configuration. Should it be, as the transaction originator? The error messages indicated the remote (clients) had the error. I can change this if needed.

    On the desktops - these are desktop (client) machines running SQL Server Express. Will need to look at them directly (no remote screen access) and post back.

    --Loyd

  • Regarding #3 then.

    I have had a similar experience where it fixed it:

    Look here: http://support.microsoft.com/kb/839279

  • Look here: http://support.microsoft.com/kb/839279%5B/quote%5D

    Thanks, will review this as well.

  • I must be running into a performance issue here.

    I set up the DTC on two servers: the original running 2005 standard, acting as the "server". Installed 2005 express on another server to act as the "desktop". Backed up and restored the relevant database to the "desktop" server.

    To test the transaction, I'm pulling the minimum amount of data: 1 (one) row from a table, and 202 rows from another. They are linked together by "rawsweepid".

    The first table is tblvbssweepdata, with one row to copy, has a length of 823 bytes. The other table with 202 rows is tbl_vbsrawsweep, has a length of 184. Based on adding together the lengths from syscolumns.

    use server_1905_test

    select sum(length) from syscolumns where id=(select id from sysobjects where name='tbl_vbsrawsweep')

    For tblvbssweepdata, the data size is 823 bytes (plus overhead, etc.)

    For tbl_vbsrawsweep, the data size is (184*202) = 37,168 bytes.

    As I type, the query has run for 15 minutes. Both servers are Windows 2003 server, connected over gigabit ethernet. According to task manager, the network connections are using 4-6% of a 1 Gbps link. It's been a steady 4-6% for the whole 15+ minutes.

    I wonder if the query is really running, or if DTC is hung on a process? I can cancel the query just fine. It's just perplexing to me that such a small amount of data requires so much overhead to process.

    Here is the script in its entireity. I have changed it to pull only 1 rawsweepid to its temp table for processing. Each 1 row from tblvbssweepdata is linked to 201 or 202 rows in tbl_vbsrawsweep.

    /*

    ONE TIME RUN

    Migrate audit stand 1905 tables tbl_VBSRawSweep and

    tblVBSSweepData from local stand to server.

    Purge copied rows from stand.

    Because the stand RawSweepID was reset to 1, and

    RawSweepID is an identity column in tblVBSSweepData,

    increment the sweep IDs by the maximum current sweep

    ID. Correct data so sweep IDs are sequential with no

    gaps.

    This procedure will run on etswvsvsql003, and accesses

    database [6f_module] on the local stand. The

    stand has already been added to SQL Server's linked

    server list.

    etswvsvexttst\SQLEXPRESS1905

    */

    /* Error variables for catch() block. */

    declare @errmsg nvarchar(4000), @err_severity int

    /*

    In production, set cutoff date to leave 3-5

    minutes of data in table. Hopefully this will not

    copy a partial test sweep. Observed step numbers

    for a test run to 201.

    */

    declare @cutoffdatetime as datetime

    set @cutoffdatetime = dateadd(mi,-5,getdate())

    select convert(char,@cutoffdatetime,21)

    /*

    Track maximum sweep ID from tables to convert incoming

    sweep ID from 1905 to (maximum sweep ID + 1) on SQL003.

    */

    declare @lastdatasweepid int

    select @lastdatasweepid = max(rawsweepid)

    from [etswvsvsql003].[server_1905_test].[dbo].[tblvbssweepdata]

    select @lastdatasweepid as [last data sweep id] --, @lastrawsweepid as [last raw sweep id] -- verification

    /*

    Table tblVBSSweepData contains a date time and sweep ID.

    Generate table with date time values in order to provide

    clean cutoff. Generate table of raw sweep ID, test ID,

    solenoid ID, and step number based on first table, to

    narrow selection in tbl_VBSRawSweep.

    Gather keys for data to be archived and purged.

    Observed keys:

    tblVBSSweepData

    DateTime

    RawSweepID

    tbl_VBSRawSweep

    RawSweepID

    TestID

    SolID

    StepNumber

    */

    declare @dtrs table (dt datetime, rs int, tst int, sol int, crs2 int null)

    insert into @dtrs (dt, rs, tst, sol)

    select top 1 datetime, rawsweepid, testid, solid

    from [etswvsvexttst\SQLEXPRESS].[6f_module].[dbo].[tblvbssweepdata]

    where datetime < @cutoffdatetime

    declare @rawsweep table

    (rs int, tst int, sol int, step int, crs2 int null)

    insert into @rawsweep (rs, tst, sol, step)

    select rawsweepid, testid, solid, stepnumber

    from [etswvsvexttst\SQLEXPRESS].[6f_module].[dbo].[tbl_vbsrawsweep] a

    join @dtrs b on (a.rawsweepid = b.rs)

    /*

    We need to convert the incoming sweep IDs to follow the

    existing IDs in SQL003 tables. Logic to convert the ID

    without leaving gaps:

    "maximum sweep ID from SQL003" - "minimum sweep ID from 1905" +

    "current sweep ID value" + 1

    Ex.

    "maximum sweep ID from SQL003"106328-

    "minimum sweep ID from 1905"78+

    "current sweep ID value"78+

    1=106329

    Ex.

    "maximum sweep ID from SQL003"106328-

    "minimum sweep ID from 1905"78+

    "current sweep ID value"350+

    1=106601

    */

    declare @mindtrssweep int

    select @mindtrssweep = min(rs) from @dtrs

    update @dtrs set crs2 = @lastdatasweepid - @mindtrssweep + rs + 1

    update @rawsweep set crs2 = @lastdatasweepid - @mindtrssweep + rs + 1

    select * from @dtrs order by 1,2 -- verification

    select * from @rawsweep order by 1,2,3,4 -- verification

    /*

    Now variable tables @dtrs and @rawsweep contain

    the data required for row copy and purge.

    */

    set xact_abort on -- Required by OLE DB to ignore "nested transaction" errors. See http://msdn.microsoft.com/en-us/library/ms188792.aspx

    begin try

    begin distributed transaction

    print char(13) + '----- Insert from 6f_module to server_1905_test, tblvbssweepdata'

    set identity_insert [server_1905_test].[dbo].[tblvbssweepdata] on

    insert into [etswvsvsql003].[server_1905_test].[dbo].[tblvbssweepdata]

    (TestID, SolID, RawSweepID, ModuleSN, SSN, Passed, [DateTime],

    [Type], [Description], Operator, Comments, SolenoidType,

    SweepTable, Kp, Ki, AdlerPeriod, StepsinWave,

    SwitchingFrequency, DitherFrequency, PurgeTime, SweepTime,

    FluidTemperature, AverageSupply, SupplyMinimum, SupplyMinimumat,

    SupplyMaximum, SupplyMaximumat, SupplyRange, Flowat0, Flowat850,

    MaximumFlow, MaximumFlowat, MaximumRippleinc, MaximumRippleincat,

    MaximumRippledec, MaximumRippledecat, MaximumGain, MaximumGainat,

    MaximumHysteresis, MaximumHysteresisat, RepeatAvgHysterisis,

    GatePoint1lowcurrent, GatePoint1lowpressure, GatePoint1highcurrent,

    GatePoint1highpressure, GatePoint2lowcurrent, GatePoint2lowpressure,

    GatePoint2highcurrent, GatePoint2highpressure, MinimumPressure,

    RawDataFileName, Step1Pressureinc, Step2Pressureinc, Step3Pressureinc,

    Step4Pressureinc, Step5Pressureinc, Step6Pressureinc, Step7Pressureinc,

    Step8Pressureinc, Step9Pressureinc, Step10Pressureinc,

    Step1PressureAverage, Step2PressureAverage, Step3PressureAverage,

    Step4PressureAverage, Step5PressureAverage, Step6PressureAverage,

    Step7PressureAverage, Step8PressureAverage, Step9PressureAverage,

    Step10PressureAverage, RecheckPressure1, RecheckPressure2,

    RecheckPressure3, RecheckPressure4, RecheckPressure5,

    RecheckPressure6, RecheckPressure7, RecheckPressure8,

    RecheckPressure9, RecheckPressure10, RecheckAvePressure1,

    RecheckAvePressure2, RecheckAvePressure3, RecheckAvePressure4,

    RecheckAvePressure5, RecheckAvePressure6, RecheckAvePressure7,

    RecheckAvePressure8, RecheckAvePressure9, RecheckAvePressure10,

    [Gross Leakage], NHCurrentAt475, NHCurrentAt03, NLCurrentAt460,

    NLCurrentAt03, FlowAt485, CurrentAt485)

    select

    TestID, SolID, crs2 /*RawSweepID*/, ModuleSN, SSN, Passed, [DateTime],

    [Type], [Description], Operator, Comments, SolenoidType,

    SweepTable, Kp, Ki, AdlerPeriod, StepsinWave,

    SwitchingFrequency, DitherFrequency, PurgeTime, SweepTime,

    FluidTemperature, AverageSupply, SupplyMinimum, SupplyMinimumat,

    SupplyMaximum, SupplyMaximumat, SupplyRange, Flowat0, Flowat850,

    MaximumFlow, MaximumFlowat, MaximumRippleinc, MaximumRippleincat,

    MaximumRippledec, MaximumRippledecat, MaximumGain, MaximumGainat,

    MaximumHysteresis, MaximumHysteresisat, RepeatAvgHysterisis,

    GatePoint1lowcurrent, GatePoint1lowpressure, GatePoint1highcurrent,

    GatePoint1highpressure, GatePoint2lowcurrent, GatePoint2lowpressure,

    GatePoint2highcurrent, GatePoint2highpressure, MinimumPressure,

    RawDataFileName, Step1Pressureinc, Step2Pressureinc, Step3Pressureinc,

    Step4Pressureinc, Step5Pressureinc, Step6Pressureinc, Step7Pressureinc,

    Step8Pressureinc, Step9Pressureinc, Step10Pressureinc,

    Step1PressureAverage, Step2PressureAverage, Step3PressureAverage,

    Step4PressureAverage, Step5PressureAverage, Step6PressureAverage,

    Step7PressureAverage, Step8PressureAverage, Step9PressureAverage,

    Step10PressureAverage, RecheckPressure1, RecheckPressure2,

    RecheckPressure3, RecheckPressure4, RecheckPressure5,

    RecheckPressure6, RecheckPressure7, RecheckPressure8,

    RecheckPressure9, RecheckPressure10, RecheckAvePressure1,

    RecheckAvePressure2, RecheckAvePressure3, RecheckAvePressure4,

    RecheckAvePressure5, RecheckAvePressure6, RecheckAvePressure7,

    RecheckAvePressure8, RecheckAvePressure9, RecheckAvePressure10,

    [Gross Leakage], NHCurrentAt475, NHCurrentAt03, NLCurrentAt460,

    NLCurrentAt03, FlowAt485, CurrentAt485

    from [etswvsvexttst\SQLEXPRESS].[6f_module].[dbo].[tblvbssweepdata] a

    join @dtrs b on (a.rawsweepid = b.rs and a.datetime = b.dt and

    a.testid=b.tst and a.solid=b.sol)

    set identity_insert [server_1905_test].[dbo].[tblvbssweepdata] off

    print char(13) + '----- Delete from 6f_module, tblvbssweepdata'

    delete from [etswvsvexttst\SQLEXPRESS].[6f_module].[dbo].[tblvbssweepdata]

    where exists

    (select 'x' from @dtrs

    where rs = rawsweepid

    and dt = [datetime]

    and tst = testid

    and sol = solid)

    /* - - - - - - - - - - */

    print char(13) + '----- Insert from 6f_module to server_1905_test, tbl_vbsrawsweep'

    insert into [etswvsvsql003].[server_1905_test].[dbo].[tbl_vbsrawsweep]

    (rawsweepid, testid, solid, stepnumber, commandcurrent,

    ditheramplitude, steptime, supplypressure, [current],

    controlpressure, observedripple,

    observedditheramplitude, flow, interpolatedcurrent,

    interpolatedcontrolincp, interpolatedcontroldecp,

    hysteresis, averagecontrol, gain, [datetime], ssn)

    select

    crs2 /*rawsweepid*/, testid, solid, stepnumber, commandcurrent,

    ditheramplitude, steptime, supplypressure, [current],

    controlpressure, observedripple,

    observedditheramplitude, flow, interpolatedcurrent,

    interpolatedcontrolincp, interpolatedcontroldecp,

    hysteresis, averagecontrol, gain, [datetime], ssn

    from [etswvsvexttst\SQLEXPRESS].[6f_module].[dbo].[tbl_vbsrawsweep] a

    join @rawsweep b on (a.rawsweepid=b.rs and a.testid=b.tst and

    a.solid=b.sol and a.stepnumber=b.step)

    print char(13) + '----- Delete from 6f_module, tbl_vbsrawsweep'

    delete from [etswvsvexttst\SQLEXPRESS].[6f_module].[dbo].[tbl_vbsrawsweep]

    where exists

    (select 'x' from @rawsweep

    where rs = rawsweepid

    and tst = testid

    and sol = solid

    and step = stepnumber)

    commit

    end try

    begin catch

    if @@trancount > 0

    rollback

    select @errmsg = error_message(),

    @err_severity = error_severity()

    raiserror(@errmsg, @err_severity, 1)

    end catch

    set xact_abort off

    Here are the results so far for the query. (21 minutes and counting). Changed "results to text" to get everything. The buffer did not show all rows from @rawsweep, and does not show the print statements yet.

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

    2008-09-23 07:17:54.083

    (1 row(s) affected)

    last data sweep id

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

    106251

    (1 row(s) affected)

    (1 row(s) affected)

    (202 row(s) affected)

    (1 row(s) affected)

    (202 row(s) affected)

    dt rs tst sol crs2

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

    2008-09-02 00:00:50.000 1 1 1 106252

    (1 row(s) affected)

    rs tst sol step crs2

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

    1 1 1 0 106252

    1 1 1 1 106252

    1 1 1 2 106252

    1 1 1 3 106252

    1 1 1 4 106252

    1 1 1 5 106252

    1 1 1 6 106252

    1 1 1 7 106252

    1 1 1 8 106252

    1 1 1 9 106252

    1 1 1 10 106252

    1 1 1 11 106252

    1 1 1 12 106252

    1 1 1 13 106252

    1 1 1 14 106252

    1 1 1 15 106252

    1 1 1 16 106252

    1 1 1 17 106252

    1 1 1 18 106252

    1 1 1 19 106252

    1 1 1 20 106252

    1 1 1 21 106252

    1 1 1 22 106252

    1 1 1 23 106252

    1 1 1 24 106252

    1 1 1 25 106252

    1 1 1 26 106252

    1 1 1 27 106252

    1 1 1 28 106252

    1 1 1 29 106252

    1 1 1 30 106252

    1 1 1 31 106252

    1 1 1 32 106252

    1 1 1 33 106252

    1 1 1 34 106252

    1 1 1 35 106252

    1 1 1 36 106252

    1 1 1 37 106252

    1 1 1 38 106252

    1 1 1 39 106252

    1 1 1 40 106252

    1 1 1 41 106252

    1 1 1 42 106252

    1 1 1 43 106252

    1 1 1 44 106252

    1 1 1 45 106252

    1 1 1 46 106252

    1 1 1 47 106252

    1 1 1 48 106252

    1 1 1 49 106252

    1 1 1 50 106252

    1 1 1 51 106252

    1 1 1 52 106252

    1 1 1 53 106252

    1 1 1 54 106252

    1 1 1 55 106252

    1 1 1 56 106252

    1 1 1 57 106252

    1 1 1 58 106252

    1 1 1 59 106252

    1 1 1 60 106252

    1 1 1 61 106252

    1 1 1 62 106252

    1 1 1 63 106252

    1 1 1 64 106252

    1 1 1 65 106252

    1 1 1 66 106252

    1 1 1 67 106252

    1 1 1 68 106252

    1 1 1 69 106252

    1 1 1 70 106252

    1 1 1 71 106252

    1 1 1 72 106252

    1 1 1 73 106252

    1 1 1 74 106252

    1 1 1 75 106252

    1 1 1 76 106252

    1 1 1 77 106252

    1 1 1 78 106252

    1 1 1 79 106252

    1 1 1 80 106252

    1 1 1 81 106252

    1 1 1 82 106252

    1 1 1 83 106252

    1 1 1 84 106252

    1 1 1 85 106252

    1 1 1 86 106252

    1 1 1 87 106252

    1 1 1 88 106252

    1 1 1 89 106252

    1 1 1 90 106252

    1 1 1 91 106252

    1 1 1 92 106252

    1 1 1 93 106252

    1 1 1 94 106252

    1 1 1 95 106252

    1 1 1 96 106252

    1 1 1 97 106252

    1 1 1 98 106252

    1 1 1 99 106252

    Thanks,

    Loyd

  • The transaction ran in 1 hour 12 minutes 15 seconds and affected 203 rows of data. Will run another with timing attached.

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

    2008-09-23 07:17:54.083

    (1 row(s) affected)

    last data sweep id

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

    106251

    (1 row(s) affected)

    (1 row(s) affected)

    (202 row(s) affected)

    (1 row(s) affected)

    (202 row(s) affected)

    dt rs tst sol crs2

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

    2008-09-02 00:00:50.000 1 1 1 106252

    (1 row(s) affected)

    rs tst sol step crs2

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

    1 1 1 0 106252

    1 1 1 1 106252

    1 1 1 2 106252

    1 1 1 3 106252

    1 1 1 4 106252

    1 1 1 5 106252

    1 1 1 6 106252

    1 1 1 7 106252

    1 1 1 8 106252

    1 1 1 9 106252

    1 1 1 10 106252

    1 1 1 11 106252

    1 1 1 12 106252

    1 1 1 13 106252

    1 1 1 14 106252

    1 1 1 15 106252

    1 1 1 16 106252

    1 1 1 17 106252

    1 1 1 18 106252

    1 1 1 19 106252

    1 1 1 20 106252

    1 1 1 21 106252

    1 1 1 22 106252

    1 1 1 23 106252

    1 1 1 24 106252

    1 1 1 25 106252

    1 1 1 26 106252

    1 1 1 27 106252

    1 1 1 28 106252

    1 1 1 29 106252

    1 1 1 30 106252

    1 1 1 31 106252

    1 1 1 32 106252

    1 1 1 33 106252

    1 1 1 34 106252

    1 1 1 35 106252

    1 1 1 36 106252

    1 1 1 37 106252

    1 1 1 38 106252

    1 1 1 39 106252

    1 1 1 40 106252

    1 1 1 41 106252

    1 1 1 42 106252

    1 1 1 43 106252

    1 1 1 44 106252

    1 1 1 45 106252

    1 1 1 46 106252

    1 1 1 47 106252

    1 1 1 48 106252

    1 1 1 49 106252

    1 1 1 50 106252

    1 1 1 51 106252

    1 1 1 52 106252

    1 1 1 53 106252

    1 1 1 54 106252

    1 1 1 55 106252

    1 1 1 56 106252

    1 1 1 57 106252

    1 1 1 58 106252

    1 1 1 59 106252

    1 1 1 60 106252

    1 1 1 61 106252

    1 1 1 62 106252

    1 1 1 63 106252

    1 1 1 64 106252

    1 1 1 65 106252

    1 1 1 66 106252

    1 1 1 67 106252

    1 1 1 68 106252

    1 1 1 69 106252

    1 1 1 70 106252

    1 1 1 71 106252

    1 1 1 72 106252

    1 1 1 73 106252

    1 1 1 74 106252

    1 1 1 75 106252

    1 1 1 76 106252

    1 1 1 77 106252

    1 1 1 78 106252

    1 1 1 79 106252

    1 1 1 80 106252

    1 1 1 81 106252

    1 1 1 82 106252

    1 1 1 83 106252

    1 1 1 84 106252

    1 1 1 85 106252

    1 1 1 86 106252

    1 1 1 87 106252

    1 1 1 88 106252

    1 1 1 89 106252

    1 1 1 90 106252

    1 1 1 91 106252

    1 1 1 92 106252

    1 1 1 93 106252

    1 1 1 94 106252

    1 1 1 95 106252

    1 1 1 96 106252

    1 1 1 97 106252

    1 1 1 98 106252

    1 1 1 99 106252

    1 1 1 100 106252

    1 1 1 101 106252

    1 1 1 102 106252

    1 1 1 103 106252

    1 1 1 104 106252

    1 1 1 105 106252

    1 1 1 106 106252

    1 1 1 107 106252

    1 1 1 108 106252

    1 1 1 109 106252

    1 1 1 110 106252

    1 1 1 111 106252

    1 1 1 112 106252

    1 1 1 113 106252

    1 1 1 114 106252

    1 1 1 115 106252

    1 1 1 116 106252

    1 1 1 117 106252

    1 1 1 118 106252

    1 1 1 119 106252

    1 1 1 120 106252

    1 1 1 121 106252

    1 1 1 122 106252

    1 1 1 123 106252

    1 1 1 124 106252

    1 1 1 125 106252

    1 1 1 126 106252

    1 1 1 127 106252

    1 1 1 128 106252

    1 1 1 129 106252

    1 1 1 130 106252

    1 1 1 131 106252

    1 1 1 132 106252

    1 1 1 133 106252

    1 1 1 134 106252

    1 1 1 135 106252

    1 1 1 136 106252

    1 1 1 137 106252

    1 1 1 138 106252

    1 1 1 139 106252

    1 1 1 140 106252

    1 1 1 141 106252

    1 1 1 142 106252

    1 1 1 143 106252

    1 1 1 144 106252

    1 1 1 145 106252

    1 1 1 146 106252

    1 1 1 147 106252

    1 1 1 148 106252

    1 1 1 149 106252

    1 1 1 150 106252

    1 1 1 151 106252

    1 1 1 152 106252

    1 1 1 153 106252

    1 1 1 154 106252

    1 1 1 155 106252

    1 1 1 156 106252

    1 1 1 157 106252

    1 1 1 158 106252

    1 1 1 159 106252

    1 1 1 160 106252

    1 1 1 161 106252

    1 1 1 162 106252

    1 1 1 163 106252

    1 1 1 164 106252

    1 1 1 165 106252

    1 1 1 166 106252

    1 1 1 167 106252

    1 1 1 168 106252

    1 1 1 169 106252

    1 1 1 170 106252

    1 1 1 171 106252

    1 1 1 172 106252

    1 1 1 173 106252

    1 1 1 174 106252

    1 1 1 175 106252

    1 1 1 176 106252

    1 1 1 177 106252

    1 1 1 178 106252

    1 1 1 179 106252

    1 1 1 180 106252

    1 1 1 181 106252

    1 1 1 182 106252

    1 1 1 183 106252

    1 1 1 184 106252

    1 1 1 185 106252

    1 1 1 186 106252

    1 1 1 187 106252

    1 1 1 188 106252

    1 1 1 189 106252

    1 1 1 190 106252

    1 1 1 191 106252

    1 1 1 192 106252

    1 1 1 193 106252

    1 1 1 194 106252

    1 1 1 195 106252

    1 1 1 196 106252

    1 1 1 197 106252

    1 1 1 198 106252

    1 1 1 199 106252

    1 1 1 200 106252

    1 1 1 201 106252

    (202 row(s) affected)

    ----- Insert from 6f_module to server_1905_test, tblvbssweepdata

    (1 row(s) affected)

    ----- Delete from 6f_module, tblvbssweepdata

    (1 row(s) affected)

    ----- Insert from 6f_module to server_1905_test, tbl_vbsrawsweep

    (202 row(s) affected)

    ----- Delete from 6f_module, tbl_vbsrawsweep

    (202 row(s) affected)

  • is x64 involved at any point?

  • Both servers are x86 32-bit.

  • I'm sorry, I should have scrolled up to see that question was already answered. Long day yesterday.

    Do you know if you are using Remote Collation?

  • No problem.

    No, I don't know if we're using remote collation. How would I find out?

    I set up DTC according to this Microsoft KB: http://support.microsoft.com/kb/839279

  • I haven't done it in SQL Server 2005.

    I would start here.

  • Will take a look.

    Here is a transaction run (again 1 row for a table, related to 202 rows for another) with time markers. Through its execution, network usage was about 5% of a 1Gbps link.

    ----- Script start: Sep 23 2008 8:54AM

    ----- Getting cutoff date/time: Sep 23 2008 8:54AM

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

    2008-09-23 08:49:11.900

    (1 row(s) affected)

    ----- Getting last data sweep raw id: Sep 23 2008 8:54AM

    last data sweep id

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

    106252

    (1 row(s) affected)

    ----- Populate virtual table @dtrs: Sep 23 2008 8:54AM

    (1 row(s) affected)

    ----- Populate virtual table @rawsweep: Sep 23 2008 8:54AM

    (202 row(s) affected)

    ----- Update virtual tables with corrected raw sweep value: Sep 23 2008 8:54AM

    (1 row(s) affected)

    (202 row(s) affected)

    ----- Show what will be copied: Sep 23 2008 8:54AM

    dt rs tst sol crs2

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

    2008-09-02 00:04:49.000 2 2 2 106253

    (1 row(s) affected)

    rs tst sol step crs2

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

    2 2 2 0 106253

    2 2 2 1 106253

    2 2 2 2 106253

    2 2 2 3 106253

    2 2 2 4 106253

    2 2 2 5 106253

    2 2 2 6 106253

    2 2 2 7 106253

    2 2 2 8 106253

    2 2 2 9 106253

    2 2 2 10 106253

    2 2 2 11 106253

    2 2 2 12 106253

    2 2 2 13 106253

    2 2 2 14 106253

    2 2 2 15 106253

    2 2 2 16 106253

    2 2 2 17 106253

    2 2 2 18 106253

    2 2 2 19 106253

    2 2 2 20 106253

    2 2 2 21 106253

    2 2 2 22 106253

    2 2 2 23 106253

    2 2 2 24 106253

    2 2 2 25 106253

    2 2 2 26 106253

    2 2 2 27 106253

    2 2 2 28 106253

    2 2 2 29 106253

    2 2 2 30 106253

    2 2 2 31 106253

    2 2 2 32 106253

    2 2 2 33 106253

    2 2 2 34 106253

    2 2 2 35 106253

    2 2 2 36 106253

    2 2 2 37 106253

    2 2 2 38 106253

    2 2 2 39 106253

    2 2 2 40 106253

    2 2 2 41 106253

    2 2 2 42 106253

    2 2 2 43 106253

    2 2 2 44 106253

    2 2 2 45 106253

    2 2 2 46 106253

    2 2 2 47 106253

    2 2 2 48 106253

    2 2 2 49 106253

    2 2 2 50 106253

    2 2 2 51 106253

    2 2 2 52 106253

    2 2 2 53 106253

    2 2 2 54 106253

    2 2 2 55 106253

    2 2 2 56 106253

    2 2 2 57 106253

    2 2 2 58 106253

    2 2 2 59 106253

    2 2 2 60 106253

    2 2 2 61 106253

    2 2 2 62 106253

    2 2 2 63 106253

    2 2 2 64 106253

    2 2 2 65 106253

    2 2 2 66 106253

    2 2 2 67 106253

    2 2 2 68 106253

    2 2 2 69 106253

    2 2 2 70 106253

    2 2 2 71 106253

    2 2 2 72 106253

    2 2 2 73 106253

    2 2 2 74 106253

    2 2 2 75 106253

    2 2 2 76 106253

    2 2 2 77 106253

    2 2 2 78 106253

    2 2 2 79 106253

    2 2 2 80 106253

    2 2 2 81 106253

    2 2 2 82 106253

    2 2 2 83 106253

    2 2 2 84 106253

    2 2 2 85 106253

    2 2 2 86 106253

    2 2 2 87 106253

    2 2 2 88 106253

    2 2 2 89 106253

    2 2 2 90 106253

    2 2 2 91 106253

    2 2 2 92 106253

    2 2 2 93 106253

    2 2 2 94 106253

    2 2 2 95 106253

    2 2 2 96 106253

    2 2 2 97 106253

    2 2 2 98 106253

    2 2 2 99 106253

    2 2 2 100 106253

    2 2 2 101 106253

    2 2 2 102 106253

    2 2 2 103 106253

    2 2 2 104 106253

    2 2 2 105 106253

    2 2 2 106 106253

    2 2 2 107 106253

    2 2 2 108 106253

    2 2 2 109 106253

    2 2 2 110 106253

    2 2 2 111 106253

    2 2 2 112 106253

    2 2 2 113 106253

    2 2 2 114 106253

    2 2 2 115 106253

    2 2 2 116 106253

    2 2 2 117 106253

    2 2 2 118 106253

    2 2 2 119 106253

    2 2 2 120 106253

    2 2 2 121 106253

    2 2 2 122 106253

    2 2 2 123 106253

    2 2 2 124 106253

    2 2 2 125 106253

    2 2 2 126 106253

    2 2 2 127 106253

    2 2 2 128 106253

    2 2 2 129 106253

    2 2 2 130 106253

    2 2 2 131 106253

    2 2 2 132 106253

    2 2 2 133 106253

    2 2 2 134 106253

    2 2 2 135 106253

    2 2 2 136 106253

    2 2 2 137 106253

    2 2 2 138 106253

    2 2 2 139 106253

    2 2 2 140 106253

    2 2 2 141 106253

    2 2 2 142 106253

    2 2 2 143 106253

    2 2 2 144 106253

    2 2 2 145 106253

    2 2 2 146 106253

    2 2 2 147 106253

    2 2 2 148 106253

    2 2 2 149 106253

    2 2 2 150 106253

    2 2 2 151 106253

    2 2 2 152 106253

    2 2 2 153 106253

    2 2 2 154 106253

    2 2 2 155 106253

    2 2 2 156 106253

    2 2 2 157 106253

    2 2 2 158 106253

    2 2 2 159 106253

    2 2 2 160 106253

    2 2 2 161 106253

    2 2 2 162 106253

    2 2 2 163 106253

    2 2 2 164 106253

    2 2 2 165 106253

    2 2 2 166 106253

    2 2 2 167 106253

    2 2 2 168 106253

    2 2 2 169 106253

    2 2 2 170 106253

    2 2 2 171 106253

    2 2 2 172 106253

    2 2 2 173 106253

    2 2 2 174 106253

    2 2 2 175 106253

    2 2 2 176 106253

    2 2 2 177 106253

    2 2 2 178 106253

    2 2 2 179 106253

    2 2 2 180 106253

    2 2 2 181 106253

    2 2 2 182 106253

    2 2 2 183 106253

    2 2 2 184 106253

    2 2 2 185 106253

    2 2 2 186 106253

    2 2 2 187 106253

    2 2 2 188 106253

    2 2 2 189 106253

    2 2 2 190 106253

    2 2 2 191 106253

    2 2 2 192 106253

    2 2 2 193 106253

    2 2 2 194 106253

    2 2 2 195 106253

    2 2 2 196 106253

    2 2 2 197 106253

    2 2 2 198 106253

    2 2 2 199 106253

    2 2 2 200 106253

    2 2 2 201 106253

    (202 row(s) affected)

    ----- Starting transaction: Sep 23 2008 8:54AM

    ----- Insert from 6f_module to server_1905_test, tblvbssweepdata: Sep 23 2008 8:54AM

    (1 row(s) affected)

    ----- Delete from 6f_module, tblvbssweepdata: Sep 23 2008 8:54AM

    (1 row(s) affected)

    ----- Insert from 6f_module to server_1905_test, tbl_vbsrawsweep: Sep 23 2008 8:54AM

    (202 row(s) affected)

    ----- Delete from 6f_module, tbl_vbsrawsweep: Sep 23 2008 8:54AM

    (202 row(s) affected)

    ----- Transaction committed: Sep 23 2008 10:06AM

    ----- Script end: Sep 23 2008 10:06AM

  • Remote collation does not seem to be a factor. Per http://msdn.microsoft.com/en-us/library/ms190918(SQL.90,printer).aspx,

    If the linked server is an instance of SQL Server, the collation information is automatically derived from the SQL Server OLE DB provider interface.

    I changed the remote collation from TRUE to FALSE and ran the script again. Approximately same runtime, 1 hour 12 minutes 2 seconds.

    I read the query restrictions and optimizations documents, and did not see anything obvious.

    The only thing I can think of is I create table variables @dtrs and @rawsweep that hold the values to be copied and deleted. If they aren't sent across the wire to the linked server, then every row in the linked table must be sent back to the initiating server to determine if they qualify for the subquery and where exists clause.

    I cannot directly copy the values into the server's tables because I need to revalue the rawsweepid, and it's an identity column in one of the tables. So on the copy and insert, I revalue the rawsweepid identity value.

    Perhaps if I created additional table variables to hold the data coming from the linked server, then act on that. Perhaps will need same temporary tables on initiating and linked server.

    More later.

  • Have you looked at global variables?

    Have you completely eliminated the possibility of temp tables?

    How about your tempdb size? Do you see anything in your logs about it growing pretty large?

    Why don't you run profiler and see what's going on under the hood?

    Just a few more thoughts.

    Edited to throw in link I just found that might help you : Link

Viewing 15 posts - 1 through 15 (of 15 total)

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