What is deadlock and how to avoid the deadlocks.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
What are “lost updates”?
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?
How to get number of days in a given year?
How ssrs maintain security?
what is the difference between Delete and Truncate
4 Answers CarrizalSoft Technologies, Geo Research Centre,
what is extended StoreProcedure ?
Different types of keys in SQL?
What is the use of @@spid?
How to find the login name linked to a given user name?
Find nth lowest salary or get nth lowest salary?
what is differencial backup?how to work?Anybody explai it?