Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 546429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:51:58+00:00 2026-05-13T10:51:58+00:00

We are doing an import process from a source database to a destination database.

  • 0

We are doing an import process from a source database to a destination database. We need to run these imports frequently in an automated fashion.

The source is on a separate server than the destination. Both are MS SQL 2008. We access the source using Linq2SQL and the destination using a custom Data Layer. We do not ever modify the source DB (though we do not restore it as read-only at present). However, right now when we run the import within a transactionScope, the entire transaction gets promoted to DTC because we access two DBs on separate servers.

If we were to make the source DB read-only, would it still do this?

Any other suggestions on how to avoid the DTC promotion in this scenario?

Follow-up questions to Remus’ answer (thanks again):

Follow-up #1:
My import routine is structured such that it imports records from the source and creates new records in the destination. Like this:

using(var scope = new TransactionScope())
{
   // read some from source db using Linq2Sql
   // transform source info
   // update destination

   // read some more from source db using Linq2Sql
   // transform source info
   // update destination

}

Are you saying to surround the Linq2Sql bits in a TransactionScope with RequiresNew? Or, I guess, sine I really do not care about transactions at the source, I could surround with TransactionScope with Suppress to that connection’s inclusion in any transaction at all, right?

Follow-up #2:

When you say “open a second connection, even to the same Database” – I have read several variations on this:

  1. “second connection” == second instance of the Connection object even it exactly the same connectionstring
  2. “second connection” == connection to a separate Resource Manager and on SQL2005 and before this means same as 1 above, but on SQL2008 this means a separate instance (i.e. two DBs on the same instance do not get promoted)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:51:58+00:00Added an answer on May 13, 2026 at 10:51 am

    The moment you open a second ADO.Net connection inside a transaction scope, both connections will be promoted to DTC. even if is a new connection to the same DB, doesn’t matter. Database read-onlyness has also nothing to do with it, and couldn’t possible have anything to do with it. First, connections are not database specific since they can change the database after openning. Second, a read only database can do plenty of writes (e.g. can invoke readonlydb.dbo.myProcedure and inside the procedure I can update writabledb.dbo.table).

    If you want to avoid the DTC then you must use different transaction scopes between the two access layers (ie. create a new scope with RequireNew).

    Update

    If is possible to do the reads outside of the scope it would be perfect:

    // read some from source db using Linq2Sql 
    // read some more from source db using Linq2Sql 
    using(var scope = new TransactionScope()) 
    { 
       // transform source info 
       // update destination 
    
       // transform source info 
       // update destination 
    } 
    

    I understand this is higly unlikely though, as probably the second set of reads is dependent o the result of first transform/update usually. So you would best supress the scope when doing the read:

    using(var scope = new TransactionScope()) 
    { 
       using(var nada= new TransactionScope(TransactionScopeOption.Supress))
       {
           // read some from source db using Linq2Sql 
           // transform source info 
       }
       // update destination 
    
       using(var nada= new TransactionScope(TransactionScopeOption.Supress))
       {
           // read some more from source db using Linq2Sql
           // transform source info 
       } 
       // update destination 
    } 
    

    BTW I assume that ‘read some data using linq’ means u actually enumerate the query, don’t just create the query expression and use the expression later. I don’t know exactly how a transaction scope interacts with a query expression, but my assumption is that the scope applies to the query execution, not the declaration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 440k
  • Answers 440k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The easiest way to do this is to make the… May 15, 2026 at 5:12 pm
  • Editorial Team
    Editorial Team added an answer I would change your approach to a CI build. Doing… May 15, 2026 at 5:12 pm
  • Editorial Team
    Editorial Team added an answer This is the best I could come up with: git… May 15, 2026 at 5:12 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.