Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Types of Deadlocks in SQL Server

Types of Deadlocks in SQL Server

Scheduled Pinned Locked Moved Database
databasesql-serversysadminhelpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John L Ponratnam
    wrote on last edited by
    #1

    Please help me out, what are the types of deadlocks in SQL Server; and how are the ways to solve it?

    Regards, John.L.Ponratnam

    D A I 3 Replies Last reply
    0
    • J John L Ponratnam

      Please help me out, what are the types of deadlocks in SQL Server; and how are the ways to solve it?

      Regards, John.L.Ponratnam

      D Offline
      D Offline
      David Mujica
      wrote on last edited by
      #2

      I can only think of one type of deadlock, meaning that 2 or more processes are trying to get to the same set of resources. There are however many type of "Locks". 1) Shared locks 2) Exclusive locks 3) Update locks 4) Intent locks Here is how a deadlock can occur: Process 1 Locks resource A Looking to lock resource B Process 2 Locks resource B Looking to lock resource A Classic deadlock situation. The way to avoid this is to lock the resources in the same order, this way process 1 & 2 would never be able to lock each other out. Either process 1 or proccess 2 would be granted resource A, then lock resource B and continue on. Most database engines solve the deadlock issue by choosing a "victim" and forcing a rollback of the transaction, thus releasing the locks owned by it. Typically once the victim has been choosen, the remaining processes can continue on with their work.

      1 Reply Last reply
      0
      • J John L Ponratnam

        Please help me out, what are the types of deadlocks in SQL Server; and how are the ways to solve it?

        Regards, John.L.Ponratnam

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        So doesn't google work for you? there are thousands of hits.

        Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

        1 Reply Last reply
        0
        • J John L Ponratnam

          Please help me out, what are the types of deadlocks in SQL Server; and how are the ways to solve it?

          Regards, John.L.Ponratnam

          I Offline
          I Offline
          i i i
          wrote on last edited by
          #4

          these might be helpful exec sp_who exec sp_who2 exec sp_lock exec sp_monitor

          Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups