Transaction (Process ID 106) was deadlocked

  • ive seen this Deadlock Error message out on the internet being discussed, but no solution being offered.

    i have a windows service that's running Select Statements [one at a time] - so unless there's some command in sql server that would re-run these - it could be a problem for me.

    now if im running this select proc manually - of course i see the message and re-run the process, but how can this be accomplished programatically.

    see msg below:

    Transaction (Process ID 106) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

    thanks for any help on this

    rik

  • Switch traceflag 1204 on on the server and whenever SQL encounters a deadlock it will write a deadlock graph into the error log. that can help you track down the other half of the deadlock and should give you enough infoto fix the problem.

    There's no single one-size-fits-all solution to deadlocks. You've got to see teh transactions on each side and work out why they're deadlocking and then take steps to fix them.

    They can usually be fixed by one or more of the following

     - appropriate indexes on the tables

     - rearranging statements within a transaction

     - removing unnecessary statements from a transaction block

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • darn, i was afraid the answer wouldnt be simple. i'll use your suggestion and see if i can locate the culprit.

    thanks again

    rik

  • If you are not concerned about "dirty reads" you can use the with (nolock) statement or Set Transaction Isolation Level Read Uncommitted on the select statements being run.

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

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