What is deadlock and how to avoid the deadlocks.

Answers were Sorted based on User's Feedback



What is deadlock and how to avoid the deadlocks...

Answer / moin

A deadlock occurs when there is a cyclic dependency between
two or more threads for some set of resources.

Is This Answer Correct ?    13 Yes 1 No

What is deadlock and how to avoid the deadlocks...

Answer / dba

P1 has lock on R1
P2 has lock on R2
P1 requests lock on R2
P2 Requests lock on R1

Where P & R are corresponding processes and resources.

Deadlock consists of two processes requesting locks on
resources thus, blocking each other.

You can avoid Deadlocks:
Access objects in the same order
Use lower isolation levels
Keep Transactions short and in one batch
Avoid user interactions in transaction
Use bound connections

Is This Answer Correct ?    7 Yes 1 No

What is deadlock and how to avoid the deadlocks...

Answer / raghu

Consider there are transcations going on 1 row, some one is
trying to update a column in that row while others are
trying to retrive data of same row,while update locks the
row for some period of time others cannot select it, hence
deadlock occurs.

To kill the process is solution. In sql server 2005 use sql
profiler to view the process, in that see the column named
transactions if its value is more than 1 right click and
kill the process.

Is This Answer Correct ?    4 Yes 4 No

Post New Answer

More SQL Server Interview Questions

What are “lost updates”?

0 Answers  


write query for fourth maximum salary from employee table

14 Answers   Mind Tree, SP Software,


How many types of functions are there in sql server?

0 Answers  


How to get number of days in a given year?

4 Answers   ADP,


How ssrs maintain security?

0 Answers  






what is the difference between Delete and Truncate

4 Answers   CarrizalSoft Technologies, Geo Research Centre,


what is extended StoreProcedure ?

3 Answers   Satyam,


Different types of keys in SQL?

0 Answers   Infosys,


What is the use of @@spid?

0 Answers  


How to find the login name linked to a given user name?

0 Answers  


Find nth lowest salary or get nth lowest salary?

0 Answers  


what is differencial backup?how to work?Anybody explai it?

2 Answers   HCL,


Categories